UI
Class GEVAActionEvent

java.lang.Object
  extended by UI.GEVAActionEvent

public class GEVAActionEvent
extends java.lang.Object

Store details of an event being passed on to a listener

Author:
eliottbartley

Field Summary
static int DIRTY
          Event is fired when the control's value is modified either by user input or loading. getActionString() will return the new value of the control returning false will cancel the set dirty action
static int LOAD
          Event is fired when the control is called on to load. getActionString() will return loaded value (it can be modified and will appear as modified) returning false will load the default value rather than the loaded value
static int SAVE
          Event is fired when the control is called on to save. getActionString() will return value about to be saved (it can be modified and will save as modified) returning false will prevent the value from being modified (the original value loaded will be saved)
static int VALID
          Event is fired when the control's value is validated.
 
Constructor Summary
GEVAActionEvent(GEVAControl source, int action, java.lang.String string, int command)
          Create a new event
 
Method Summary
 void addInvalidReason(java.lang.String reason)
          While validating, add an error that will be displayed to the user
 int getAction()
          Get the event that was fired LOAD/SAVE/DIRTY/VALID
 int getActionCommand()
          Get the index associated with the event
 java.lang.String getActionString()
          Get the text associated with the event
 java.lang.String getInvalidReason()
          Get all the accumulated invalid reasons added and resets, ie calling a second time will return null.
 GEVAControl getSource()
          Get the control that fired the event
 boolean isDirty()
          Set to true automatically when setActionString is called
 void setActionString(java.lang.String string)
          Set the text associated with the event (this will allow to modify the result of the event) e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOAD

public static final int LOAD
Event is fired when the control is called on to load. getActionString() will return loaded value (it can be modified and will appear as modified) returning false will load the default value rather than the loaded value

See Also:
Constant Field Values

SAVE

public static final int SAVE
Event is fired when the control is called on to save. getActionString() will return value about to be saved (it can be modified and will save as modified) returning false will prevent the value from being modified (the original value loaded will be saved)

See Also:
Constant Field Values

DIRTY

public static final int DIRTY
Event is fired when the control's value is modified either by user input or loading. getActionString() will return the new value of the control returning false will cancel the set dirty action

See Also:
Constant Field Values

VALID

public static final int VALID
Event is fired when the control's value is validated. This occurs during load, save, and dirty actions. getActionString() will return the value to test returning false will mark the field as invalid. Returning false will highlight the field in red. It will also cause a dialog to display, notifying the user of invalid data during load/save

See Also:
Constant Field Values
Constructor Detail

GEVAActionEvent

public GEVAActionEvent(GEVAControl source,
                       int action,
                       java.lang.String string,
                       int command)
Create a new event

Parameters:
source - The control that fired the event
action - The event's action (LOAD/SAVE/DIRTY/VALID)
string - The string text associated with the event
Method Detail

getSource

public GEVAControl getSource()
Get the control that fired the event


getAction

public int getAction()
Get the event that was fired LOAD/SAVE/DIRTY/VALID


getActionString

public java.lang.String getActionString()
Get the text associated with the event


getActionCommand

public int getActionCommand()
Get the index associated with the event


setActionString

public void setActionString(java.lang.String string)
Set the text associated with the event (this will allow to modify the result of the event) e.g. During save, modifying this will write the modified value to the output file (not the actual value)


isDirty

public boolean isDirty()
Set to true automatically when setActionString is called


addInvalidReason

public void addInvalidReason(java.lang.String reason)
While validating, add an error that will be displayed to the user

Parameters:
reason - The error caused when validating

getInvalidReason

public java.lang.String getInvalidReason()
Get all the accumulated invalid reasons added and resets, ie calling a second time will return null. Returned string will be HTML formatted