UI
Class GEVAPropertyControl

java.lang.Object
  extended by UI.GEVAControl
      extended by UI.GEVAPropertyControl
Direct Known Subclasses:
GEVAChoiceProperty, GEVAFileProperty, GEVANumberProperty, GEVAStringProperty

public abstract class GEVAPropertyControl
extends GEVAControl

Base for controls that fit into a name/value container Row contaier shows as a 2xN GridBoxLayout as a [ Name | Value ] Col contaier shows as a name above value header/value

Author:
eliottbartley

Field Summary
protected  java.lang.String initial
           
protected  java.lang.String[] params
           
 
Fields inherited from class UI.GEVAControl
comment, dirtyListener, name, parent, title, type
 
Method Summary
protected  boolean addInvalidReason(java.lang.String reason)
          Add a error when validating.
 int countComponents()
          Classes that inherits this must have a 'second' component that will be returned to getComponent(1); This will handle the other 2
 java.awt.Component getComponent(int index)
          Abstract way for a container to know about its child's awt components.
 java.lang.String getParam(int index)
          Helper - get params without exception.
 java.lang.String getParam(int index, java.lang.String alternative)
          Helper - get params without exception.
 boolean getParamBoolean(int index)
          Helper - get boolean params without exception.
 boolean getParamBoolean(int index, boolean alternative)
          Helper - get boolean params without exception.
 double getParamDouble(int index)
          Helper - get double params without exception.
 double getParamDouble(int index, double alternative)
          Helper - get double params without exception.
 boolean getParamEqual(int index, java.lang.String value)
          Helper - get whether the parameter is equal to a specific value
 int getParamInt(int index)
          Helper - get integer params without exception.
 int getParamInt(int index, int alternative)
          Helper - get integer params without exception.
protected  void resetInvalidReason()
          Clear out all previous invalid reasons.
 void setVisible(boolean show)
          Make this control visible
 void setVisibleControlGroup(java.lang.String name, boolean show)
          Make all the controls in the control group visible or hidden.
 
Methods inherited from class UI.GEVAControl
addActionListener, fireActionEvent, getComment, getComponent, getName, getParent, getText, getTitle, getType, isType, load, removeActionListener, save, setEnabled, setText, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initial

protected java.lang.String initial

params

protected java.lang.String[] params
Method Detail

getParam

public java.lang.String getParam(int index,
                                 java.lang.String alternative)
Helper - get params without exception.

Parameters:
index - The index of the param to get.
alternative - If the indexed param is outside the number of params or is emtpy, this value is returned instead
Returns:
The indexed param. If the index is outside the actual params, or the param is an empty string, alternative is returned

getParam

public java.lang.String getParam(int index)
Helper - get params without exception.

Parameters:
index - The index of the param to get.
Returns:
The indexed param. If the index is outside the actual params, or the param is an empty string, null is returned

getParamInt

public int getParamInt(int index,
                       int alternative)
Helper - get integer params without exception.

Parameters:
index - The index of the param to get.
alternative - The value to return if index is out of range or no legal value can be parsed from the param
Returns:
The indexed param parsed as a double. If the index is outside the actual params, or the param is not parsable to int, alternative is returned

getParamInt

public int getParamInt(int index)
Helper - get integer params without exception.

Parameters:
index - The index of the param to get.
Returns:
The indexed param parsed as a double. If the index is outside the actual params, or the param is not parsable to int, 0 is returned

getParamDouble

public double getParamDouble(int index,
                             double alternative)
Helper - get double params without exception.

Parameters:
index - The index of the param to get.
alternative - The value to return if index is out of range or no legal value can be parsed from the param
Returns:
The indexed param parsed as a double. If the index is outside the actual params, or the param is not parsable to double, alternative is returned

getParamDouble

public double getParamDouble(int index)
Helper - get double params without exception.

Parameters:
index - The index of the param to get.
Returns:
The indexed param parsed as a double. If the index is outside the actual params, or the param is not parsable to double, 0.0 is returned

getParamBoolean

public boolean getParamBoolean(int index,
                               boolean alternative)
Helper - get boolean params without exception.

Parameters:
index - The index of the param to get.
alternative - The value to return if index is out of range or no legal value can be parsed from the param
Returns:
The indexed param parsed as a boolean. If the index is outside the actual params, or the param is not parsable to double, alternative is returned

getParamBoolean

public boolean getParamBoolean(int index)
Helper - get boolean params without exception.

Parameters:
index - The index of the param to get.
Returns:
The indexed param parsed as a boolean. If the index is outside the actual params, or the param is not parsable to double, false is returned

getParamEqual

public boolean getParamEqual(int index,
                             java.lang.String value)
Helper - get whether the parameter is equal to a specific value

Parameters:
index - The index of the param to test
value - The values to test against
Returns:
true if the parameter at the specified index is equal to value

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.

Specified by:
getComponent in class GEVAControl
Parameters:
index - The index of the component to get
Returns:
The indexed awt component of the control

countComponents

public int countComponents()
Classes that inherits this must have a 'second' component that will be returned to getComponent(1); This will handle the other 2

Specified by:
countComponents in class GEVAControl
Returns:
The number (N) components the child has. getComponent(0)..getComponent(N-1) must all return valid components

setVisibleControlGroup

public void setVisibleControlGroup(java.lang.String name,
                                   boolean show)
Description copied from class: GEVAControl
Make all the controls in the control group visible or hidden.

Specified by:
setVisibleControlGroup in class GEVAControl
Parameters:
name - The name of the control group, as set during the call to addControlGroup
show - Specify true to show the group, else false

setVisible

public void setVisible(boolean show)
Description copied from class: GEVAControl
Make this control visible

Specified by:
setVisible in class GEVAControl
Parameters:
show - Specify true to show this control, else false to hide

resetInvalidReason

protected void resetInvalidReason()
Clear out all previous invalid reasons. Done before performing a new validation


addInvalidReason

protected boolean addInvalidReason(java.lang.String reason)
Add a error when validating. All errors are accumulated until resetInvalidReason is called

Parameters:
reason - The error caused during validation
Returns:
false always