UI
Class GEVAChoiceProperty

java.lang.Object
  extended by UI.GEVAControl
      extended by UI.GEVAPropertyControl
          extended by UI.GEVAChoiceProperty
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class GEVAChoiceProperty
extends GEVAPropertyControl
implements java.awt.event.ActionListener

A name value control whose value is a drop down list. Supports special types for boolean values, group values, and enumerations. Boolean values always write true or false to the file, but can display using more suitable names. Alternative values are set in the params ("hi,bye" - if hi is selected, true is output, bye=false) Group values are enumerations that also show a named control group Enumerated values are set in params, interleaved with the control group ("name1,controlGroup1,name2,controlGroup2...") Enumerations are values that are written to the file as they appear in the params ("name1,name2...")


Field Summary
static java.lang.String PT_BOOL
          Constructor type.
static java.lang.String PT_ENUM
          Constructor type.
static java.lang.String PT_GROUP
          Constructor type.
 
Fields inherited from class UI.GEVAPropertyControl
initial, params
 
Fields inherited from class UI.GEVAControl
comment, dirtyListener, name, parent, title, type
 
Constructor Summary
GEVAChoiceProperty(GEVADirtyListener dirtyListener, GEVAPropertyContainer parent, java.lang.String type, java.lang.String title, java.lang.String name, java.lang.String comment, java.lang.String initial, java.lang.String params)
          Create a drop-down control
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 java.awt.Component getComponent(int index)
          Abstract way for a container to know about its child's awt components.
 java.lang.String getText()
          Get the value of teh control, using a text string
 boolean load(java.util.Properties properties)
          A control should override this to get its properties.
 boolean save(java.util.Properties properties)
          A control should override this to set its properties.
 void setEnabled(boolean enabled)
          Make this control enabled or disabled.
 void setText(java.lang.String text)
          Set the value of the control, using a text string
 boolean valid()
           
 void validate()
          Get this control to validate itself
 
Methods inherited from class UI.GEVAPropertyControl
addInvalidReason, countComponents, getParam, getParam, getParamBoolean, getParamBoolean, getParamDouble, getParamDouble, getParamEqual, getParamInt, getParamInt, resetInvalidReason, setVisible, setVisibleControlGroup
 
Methods inherited from class UI.GEVAControl
addActionListener, fireActionEvent, getComment, getComponent, getName, getParent, getTitle, getType, isType, removeActionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PT_BOOL

public static final java.lang.String PT_BOOL
Constructor type. Accepts true/false (or their equivelants)

See Also:
Constant Field Values

PT_GROUP

public static final java.lang.String PT_GROUP
Constructor type. Accepts name,group list pairs

See Also:
Constant Field Values

PT_ENUM

public static final java.lang.String PT_ENUM
Constructor type. Accepts comma separated lists

See Also:
Constant Field Values
Constructor Detail

GEVAChoiceProperty

public GEVAChoiceProperty(GEVADirtyListener dirtyListener,
                          GEVAPropertyContainer parent,
                          java.lang.String type,
                          java.lang.String title,
                          java.lang.String name,
                          java.lang.String comment,
                          java.lang.String initial,
                          java.lang.String params)
Create a drop-down control

Parameters:
dirtyListener - GUI that listens to dirty events
parent - Container for this control
type - Can be PT_BOOL, PT_GROUP, or PT_ENUM. If PT_BOOL, saved value will be either true or false (regardless of params value (see params)). If PT_GROUP, params must include a GEVAControlGroup name after each entry. This named group will be shown when the entry is selected, else hidden. PT_GROUP also saves the value as it appears in params If this is PT_ENUM, the drop-down displays and saves the values exactly as they appear in params
title - The title to show in the GUI of this control
name - The name used when saving this to the properties file
comment - A tooltip
initial - The initially selected entry
params - Comma separated list of entries to add to the drop-down. If type is PT_BOOL params is a comma separated pair of names that relate to a true/false output. If not specified, it default to "true,false". If given, only the first two entries are used. e.g. "a,b,c" will show the drop-donw with just entries a and b. If fewer than two entries is given, the remaining are padded with the "true,false" values. e.g. "a" shows as a and false. When loading or saving, the values are output/input as true and false regardless of what they appear as to the user. e.g. "yes, no" shows yes and no to the user, but saves/loads as true and false respectively. If type is PT_GROUP params is a a comma separated list of "entry,group" pairs (e.g. "fit,fitopts,fat,fatopts"), where 'entry' is the text that is displayed in the drop-down, and 'group' is the name of a group of controls. The named group must be added to the book container that this control is a [grand-]child of (see GEVABookContainer.addControlGroup). When 'entry' is selected from the drop-down, its related 'group' is shown and all others (in this drop- down) are hidden. When loading/saving, the entry selected, as it appears, is used for the input/output value. If type is PT_ENUM params is a comma separated list of entries that are displayed and loaded/saved as is
Method Detail

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: GEVAControl
Make this control enabled or disabled.

Specified by:
setEnabled in class GEVAControl
Parameters:
enabled - true to enabled, false to disable

load

public boolean load(java.util.Properties properties)
Description copied from class: GEVAControl
A control should override this to get its properties.

Specified by:
load in class GEVAControl
Parameters:
properties - The properties of a loaded properties file

save

public boolean save(java.util.Properties properties)
Description copied from class: GEVAControl
A control should override this to set its properties. After all controls have had a chance to set the properties, the properties file will be written to by the caller

Specified by:
save in class GEVAControl
Parameters:
properties - The properties of a loaded properties file

getComponent

public java.awt.Component getComponent(int index)
Description copied from class: GEVAControl
Abstract way for a container to know about its child's awt components.

Overrides:
getComponent in class GEVAPropertyControl
Parameters:
index - The index of the component to get
Returns:
The indexed awt component of the control

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

valid

public boolean valid()

validate

public void validate()
Description copied from class: GEVAControl
Get this control to validate itself

Specified by:
validate in class GEVAControl

getText

public java.lang.String getText()
Description copied from class: GEVAControl
Get the value of teh control, using a text string

Specified by:
getText in class GEVAControl
Returns:
The value of the control in string format

setText

public void setText(java.lang.String text)
Description copied from class: GEVAControl
Set the value of the control, using a text string

Specified by:
setText in class GEVAControl
Parameters:
text - The value to set