UI
Class GEVAControl

java.lang.Object
  extended by UI.GEVAControl
Direct Known Subclasses:
GEVAContainerControl, GEVAPropertyControl

public abstract class GEVAControl
extends java.lang.Object

Base class on which all UI controls are derived

Author:
eliottbartley

Field Summary
protected  java.lang.String comment
          All controls have a comment, which is displayed as a tooltip
protected  GEVADirtyListener dirtyListener
          All controls have a reference back to the GUI window.
protected  java.lang.String name
          The text input/output to the properties file to identif the property this control relates to.
protected  GEVAContainerControl parent
          All controls have a parent (though a Book will have a null parent)
protected  java.lang.String title
          The text displayed to the user describing this controls purpose
protected  java.lang.String type
          Remember the type name so generic types will know their specifics
 
Method Summary
 void addActionListener(GEVAActionListener listener)
          Add a listener for events on this object
abstract  int countComponents()
          Abstract way for a container to know about its child's awt components.
protected  boolean fireActionEvent(GEVAActionEvent event)
          Called by GEVA* control when an event occurs and notifies all listeners of that event
 java.lang.String getComment()
          Get this control's comment
 java.awt.Component getComponent()
          Abstract way for a container to know about its child's awt components.
abstract  java.awt.Component getComponent(int index)
          Abstract way for a container to know about its child's awt components.
 java.lang.String getName()
          Get this control's name
 GEVAContainerControl getParent()
          Get this control's parent control
abstract  java.lang.String getText()
          Get the value of teh control, using a text string
 java.lang.String getTitle()
          Get this control's title
 java.lang.String getType()
          Get this control's type
 boolean isType(java.lang.String type)
          Helper - check if this is of type type
abstract  boolean load(java.util.Properties properties)
          A control should override this to get its properties.
 void removeActionListener(GEVAActionListener listener)
          Remove a listener for events on this object
abstract  boolean save(java.util.Properties properties)
          A control should override this to set its properties.
abstract  void setEnabled(boolean enabled)
          Make this control enabled or disabled.
abstract  void setText(java.lang.String text)
          Set the value of the control, using a text string
abstract  void setVisible(boolean show)
          Make this control visible
protected abstract  void setVisibleControlGroup(java.lang.String name, boolean show)
          Make all the controls in the control group visible or hidden.
abstract  void validate()
          Get this control to validate itself
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirtyListener

protected GEVADirtyListener dirtyListener
All controls have a reference back to the GUI window. This is so they can call on the GUI's setDirty() when they are updated


parent

protected GEVAContainerControl parent
All controls have a parent (though a Book will have a null parent)


type

protected java.lang.String type
Remember the type name so generic types will know their specifics


title

protected java.lang.String title
The text displayed to the user describing this controls purpose


name

protected java.lang.String name
The text input/output to the properties file to identif the property this control relates to. Container controls will leave this at null (null names will not write to the Properties file)


comment

protected java.lang.String comment
All controls have a comment, which is displayed as a tooltip

Method Detail

getParent

public GEVAContainerControl getParent()
Get this control's parent control

Returns:
this control's parent control or null if it has no parent

getType

public java.lang.String getType()
Get this control's type

Returns:
this control's type

isType

public boolean isType(java.lang.String type)
Helper - check if this is of type type

Parameters:
type - The type to test against this control's type
Returns:
true if this control is type type, else false

getTitle

public java.lang.String getTitle()
Get this control's title

Returns:
this control's title

getName

public java.lang.String getName()
Get this control's name

Returns:
this control's name

getComment

public java.lang.String getComment()
Get this control's comment

Returns:
this control's comment

setEnabled

public abstract void setEnabled(boolean enabled)
Make this control enabled or disabled.

Parameters:
enabled - true to enabled, false to disable

load

public abstract boolean load(java.util.Properties properties)
A control should override this to get its properties.

Parameters:
properties - The properties of a loaded properties file

save

public abstract boolean save(java.util.Properties properties)
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

Parameters:
properties - The properties of a loaded properties file

getComponent

public java.awt.Component getComponent()
Abstract way for a container to know about its child's awt components. Helper that gets the first component (all controls should have a component)

Returns:
The main awt component of the control

getComponent

public abstract java.awt.Component getComponent(int index)
Abstract way for a container to know about its child's awt components.

Parameters:
index - The index of the component to get
Returns:
The indexed awt component of the control

countComponents

public abstract int countComponents()
Abstract way for a container to know about its child's awt components. Counts how many components the child has

Returns:
The number (N) components the child has. getComponent(0)..getComponent(N-1) must all return valid components

addActionListener

public void addActionListener(GEVAActionListener listener)
Add a listener for events on this object

Parameters:
listener - Listener that implements GEVAActionListener

removeActionListener

public void removeActionListener(GEVAActionListener listener)
Remove a listener for events on this object

Parameters:
listener - Listener that implements GEVAActionListener

fireActionEvent

protected boolean fireActionEvent(GEVAActionEvent event)
Called by GEVA* control when an event occurs and notifies all listeners of that event

Parameters:
event - The details of the event that occurred
Returns:
Return value based on event action. See GEVAActionEvent.java (LOAD/SAVE/DIRTY/VALID)

setVisibleControlGroup

protected abstract void setVisibleControlGroup(java.lang.String name,
                                               boolean show)
Make all the controls in the control group visible or hidden.

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 abstract void setVisible(boolean show)
Make this control visible

Parameters:
show - Specify true to show this control, else false to hide

getText

public abstract java.lang.String getText()
Get the value of teh control, using a text string

Returns:
The value of the control in string format

setText

public abstract void setText(java.lang.String text)
Set the value of the control, using a text string

Parameters:
text - The value to set

validate

public abstract void validate()
Get this control to validate itself