edu.wisc.ssec.mcidasv.startupmanager.options
Class MemoryOption

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
      extended by edu.wisc.ssec.mcidasv.startupmanager.options.MemoryOption
All Implemented Interfaces:
Option, ActionListener, EventListener

public class MemoryOption
extends AbstractOption
implements ActionListener


Nested Class Summary
static class MemoryOption.Prefix
           
private static class MemoryOption.State
           
 
Field Summary
private  MemoryOption.Prefix currentPrefix
           
private  MemoryOption.State currentState
           
private  String defaultPrefValue
           
private  boolean doneInit
           
private  String failsafeValue
           
private  MemoryOption.Prefix initPrefixValue
           
private  int initSliderValue
           
private  String initTextValue
           
private  JRadioButton jrbNumber
           
private  JRadioButton jrbSlider
           
private  ButtonGroup jtbBg
           
private  int maxmem
           
private  int maxSliderValue
           
private static Pattern MEMSTRING
           
private  JComboBox memVals
           
private  int minSliderValue
           
 ChangeListener percentListener
           
private static MemoryOption.Prefix[] PREFIXES
           
private  JSlider slider
           
private  JLabel sliderLabel
           
private  JPanel sliderPanel
           
private  McVTextField text
           
private  JPanel textPanel
           
private  String value
           
 
Constructor Summary
MemoryOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void fromPrefsFormat(String prefText)
          Initializes the current option using a relevant variable from the startup script.
 JPanel getComponent()
          Returns the GUI component that represents the option.
private  String[] getNames(MemoryOption.Prefix[] arr)
           
 JComponent getSliderComponent()
           
 JComponent getTextComponent()
           
 String getValue()
          Returns the value of the option.
private  void handleNewValue(JTextField field, JComboBox box)
           
private  boolean isSlider()
           
private  boolean isValid()
           
private  void setState(MemoryOption.State newState)
           
 void setValue(String newValue)
          Forces the value of the option to the data specified.
 String toString()
          Friendly string representation of the option.
 
Methods inherited from class edu.wisc.ssec.mcidasv.startupmanager.options.AbstractOption
getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, onValidPlatform, toPrefsFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIXES

private static final MemoryOption.Prefix[] PREFIXES

currentPrefix

private MemoryOption.Prefix currentPrefix

MEMSTRING

private static final Pattern MEMSTRING

defaultPrefValue

private final String defaultPrefValue

failsafeValue

private String failsafeValue

value

private String value

jrbSlider

private JRadioButton jrbSlider

jrbNumber

private JRadioButton jrbNumber

jtbBg

private ButtonGroup jtbBg

sliderPanel

private JPanel sliderPanel

sliderLabel

private JLabel sliderLabel

slider

private JSlider slider

textPanel

private JPanel textPanel

text

private McVTextField text

memVals

private JComboBox memVals

initTextValue

private String initTextValue

initPrefixValue

private MemoryOption.Prefix initPrefixValue

minSliderValue

private int minSliderValue

maxSliderValue

private int maxSliderValue

initSliderValue

private int initSliderValue

maxmem

private int maxmem

currentState

private MemoryOption.State currentState

doneInit

private boolean doneInit

percentListener

public ChangeListener percentListener
Constructor Detail

MemoryOption

public MemoryOption(String id,
                    String label,
                    String defaultValue,
                    OptionMaster.OptionPlatform optionPlatform,
                    OptionMaster.Visibility optionVisibility)
Method Detail

getNames

private String[] getNames(MemoryOption.Prefix[] arr)

setState

private void setState(MemoryOption.State newState)

isValid

private boolean isValid()

isSlider

private boolean isSlider()

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

handleNewValue

private void handleNewValue(JTextField field,
                            JComboBox box)

getComponent

public JPanel getComponent()
Description copied from class: AbstractOption
Returns the GUI component that represents the option. BooleanOptions are represented by a JCheckBox, while TextOptions appear as a JTextField.

Specified by:
getComponent in interface Option
Specified by:
getComponent in class AbstractOption
Returns:
The GUI representation of this option.

getSliderComponent

public JComponent getSliderComponent()

getTextComponent

public JComponent getTextComponent()

toString

public String toString()
Description copied from class: AbstractOption
Friendly string representation of the option.

Specified by:
toString in interface Option
Specified by:
toString in class AbstractOption
Returns:
String containing relevant info about the option.
See Also:
TextOption.toString(), BooleanOption.toString()

getValue

public String getValue()
Description copied from class: AbstractOption
Returns the value of the option. Note that BooleanOptions return either "0" or "1".

Specified by:
getValue in interface Option
Specified by:
getValue in class AbstractOption
Returns:
The current value of the option.

fromPrefsFormat

public void fromPrefsFormat(String prefText)
Description copied from class: AbstractOption
Initializes the current option using a relevant variable from the startup script.

Specified by:
fromPrefsFormat in interface Option
Overrides:
fromPrefsFormat in class AbstractOption
Parameters:
prefText - Line from the startup script that represents the current option.

setValue

public void setValue(String newValue)
Description copied from class: AbstractOption
Forces the value of the option to the data specified. Note that BooleanOptions accept either "0", or "1".

Specified by:
setValue in interface Option
Specified by:
setValue in class AbstractOption
Parameters:
newValue - New value to use.