001 package com.croftsoft.apps.neuro;
002
003 import java.awt.*;
004
005 import com.croftsoft.core.CroftSoftConstants;
006
007 /***********************************************************************
008 * Neuro configuration.
009 *
010 * Can be modified to be persistent.
011 *
012 * @version
013 * $Id: NeuroConfigImp.java,v 1.3 2008/08/30 01:40:43 croft Exp $
014 * @since
015 * 2008-08-17
016 * @author
017 * <a href="https://www.croftsoft.com/">David Wallace Croft</a>
018 ***********************************************************************/
019
020 public final class NeuroConfigImp
021 implements NeuroConfig
022 ////////////////////////////////////////////////////////////////////////
023 ////////////////////////////////////////////////////////////////////////
024 {
025
026 private static final String VERSION
027 = "$Date: 2008/08/30 01:40:43 $";
028
029 private static final String TITLE
030 = "CroftSoft Neuro";
031
032 private static final String INFO
033 = TITLE + "\n"
034 + "Version " + VERSION + "\n"
035 + CroftSoftConstants.COPYRIGHT + "\n"
036 + CroftSoftConstants.DEFAULT_LICENSE + "\n"
037 + CroftSoftConstants.HOME_PAGE + "\n";
038
039 private static final int
040 FRAME_WIDTH = 600,
041 FRAME_HEIGHT = 400;
042
043 private static final double UPDATE_RATE = 85.0;
044
045 private static final Color
046 BACKGROUND_COLOR = Color.WHITE,
047 FOREGROUND_COLOR = Color.BLACK;
048
049 private static final String
050 SHUTDOWN_CONFIRMATION_PROMPT = "Exit " + TITLE + "?";
051
052 private static final Cursor CURSOR
053 = new Cursor ( Cursor.CROSSHAIR_CURSOR );
054
055 private static final Font FONT
056 = new Font ( "Arioso", Font.BOLD, 20 );
057
058 //
059
060 private String exampleParameter;
061
062 ////////////////////////////////////////////////////////////////////////
063 ////////////////////////////////////////////////////////////////////////
064
065 public static NeuroConfig load ( String [ ] args )
066 ////////////////////////////////////////////////////////////////////////
067 {
068 // Could load from a persistent XML file.
069 // See "Enumerated Accessors" tutorial at
070 // https://www.croftsoft.com/library/tutorials/enum/
071
072 final NeuroConfig neuroConfig = new NeuroConfigImp ( );
073
074 if ( ( args != null )
075 && ( args.length > 0 ) )
076 {
077 neuroConfig.setExampleParameter ( args [ 0 ] );
078 }
079
080 return neuroConfig;
081 }
082
083 ////////////////////////////////////////////////////////////////////////
084 ////////////////////////////////////////////////////////////////////////
085
086 public Color getBackgroundColor ( ) { return BACKGROUND_COLOR; }
087
088 public Cursor getCursor ( ) { return CURSOR; }
089
090 public String getExampleParameter ( ) { return exampleParameter; }
091
092 public Color getForegroundColor ( ) { return FOREGROUND_COLOR; }
093
094 public String getInfo ( ) { return INFO; }
095
096 public Font getFont ( ) { return FONT; }
097
098 public Dimension getFrameSize ( )
099 { return new Dimension ( FRAME_WIDTH, FRAME_HEIGHT ); }
100
101 public String getFrameTitle ( ) { return TITLE; }
102
103 public String getShutdownConfirmationPrompt ( )
104 { return SHUTDOWN_CONFIRMATION_PROMPT; }
105
106 public String getThreadName ( ) { return TITLE; }
107
108 public double getUpdateRate ( ) { return UPDATE_RATE; }
109
110 ////////////////////////////////////////////////////////////////////////
111 ////////////////////////////////////////////////////////////////////////
112
113 public void setExampleParameter ( final String exampleParameter )
114 ////////////////////////////////////////////////////////////////////////
115 {
116 this.exampleParameter = exampleParameter;
117 }
118
119 ////////////////////////////////////////////////////////////////////////
120 ////////////////////////////////////////////////////////////////////////
121 }