com.sas.models
Class StatusStringData

com.sas.models.StatusStringData
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, ComponentInterface, com.sas.lang.ObjectDataInterface, com.sas.lang.StringDataInterface, LinkPropertiesInterface, ModelInterface, com.sas.PublicClonable, AlarmListener, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class StatusStringData
implements AlarmListener

StatusStringData is a class that extends from StringData that changes the text back to the model text after some amount of time after the text is set. The text will be updated with the model text when the refreshAlarm fires. The alarm is stopped when setText() is called and restarted after the text is changed. The alarm is set to fire once by default. If the model text changes and the alarm is not running, the StatusStringData text will be updated with the model text. If the alarm is running and the model is changed, the text will not be updated until the alarm fires.

See Also:
Serialized Form

Field Summary
protected  com.sas.lang.StringDataInterface defaultModel
           
protected  AlarmInterface refreshAlarm
           
 
Fields inherited from class com.sas.lang.StringData
RB_KEY
 
Constructor Summary
StatusStringData()
          Default Constructor.
StatusStringData(java.lang.String str)
          Constructor that sets the text of the defaultModel.
StatusStringData(java.lang.StringBuffer strBuffer)
          Consturctor that sets the text of the defeultModel.
 
Method Summary
 void attachModel(ModelInterface model)
          Attaches the specified model to this view.
protected  void createComponents()
          Create the components used by this class.
 void detachModel(ModelInterface model)
          Detaches the specified model from this view.
 void fireAlarm(AlarmEvent event)
          Listen for the alarm to be triggered.
 AlarmInterface getRefreshAlarm()
          Get the alarm that when fired resets the text to the text of the model.
 java.util.Vector getRequiredInterfaces()
          Get the interfaces required for the model of this Component.
protected  AlarmInterface newRefreshAlarm()
          Create a new AlarmInterface object to fire the alarm that resets the text to the text from the model.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
 void refresh(ModelInterface model)
          Refresh the text with the text from the model.
 void setDefaultValues()
          Set the default values of this class.
 void setRefreshAlarm(AlarmInterface refresh)
          Set the alarm that resets the text when fired to the text of the model.
 void setText(java.lang.String txt)
          Set the text.
 
Methods inherited from class com.sas.lang.StringData
clone, equals, equals, getExtendedBeanInfo, getObjectData, getStringData, getText, hashCode, setObjectData, setStringData
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 

Field Detail

defaultModel

protected com.sas.lang.StringDataInterface defaultModel

refreshAlarm

protected AlarmInterface refreshAlarm
Constructor Detail

StatusStringData

public StatusStringData()
Default Constructor.


StatusStringData

public StatusStringData(java.lang.String str)
Constructor that sets the text of the defaultModel. This is used to reset the model text a certain amount of time after it is set.

Parameters:
str - the string to update the text with when the alarm fires

StatusStringData

public StatusStringData(java.lang.StringBuffer strBuffer)
Consturctor that sets the text of the defeultModel. This is used to reset the model text a certain amount of time after it is set.

Parameters:
str - the stringBuffer to update the String text with when the alarm fires
Method Detail

getRefreshAlarm

public AlarmInterface getRefreshAlarm()
Get the alarm that when fired resets the text to the text of the model.

Returns:
the AlarmInterface object used reset the text when it fires.

setRefreshAlarm

public void setRefreshAlarm(AlarmInterface refresh)
Set the alarm that resets the text when fired to the text of the model.

Parameters:
refresh - the AlarmInterface object used reset the text when it fires.

fireAlarm

public void fireAlarm(AlarmEvent event)
Listen for the alarm to be triggered. The text is reset to the text of the model when this occurs. This calls the refresh( ModelInterface ) method.

Specified by:
fireAlarm in interface AlarmListener
Parameters:
event - the AlarmEvent fired to change the text to the text of the model.

refresh

public void refresh(ModelInterface model)
Refresh the text with the text from the model. This does not affect the alarm that is running.

Specified by:
refresh in interface ViewInterface
Overrides:
refresh in class Component
Parameters:
model - the model used when the text is reset
See Also:
ViewInterface.refresh(com.sas.ModelInterface)

attachModel

public void attachModel(ModelInterface model)
Attaches the specified model to this view.

Specified by:
attachModel in interface ViewInterface
Overrides:
attachModel in class Component
Parameters:
model - Model to attach to
See Also:
ViewInterface

detachModel

public void detachModel(ModelInterface model)
Detaches the specified model from this view.

Specified by:
detachModel in interface ViewInterface
Overrides:
detachModel in class Component
Parameters:
model - Model to detach
See Also:
ViewInterface

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed. This is specifically listening for changes to the text of the model.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class Component
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

setText

public void setText(java.lang.String txt)
Set the text. The alarm is stopped if it is running. The alarm is then restarted after the text is set.

Specified by:
setText in interface com.sas.lang.StringDataInterface
Overrides:
setText in class StringData
Parameters:
txt - the text to be set until the alarm fires

getRequiredInterfaces

public java.util.Vector getRequiredInterfaces()
Get the interfaces required for the model of this Component.

Specified by:
getRequiredInterfaces in interface ViewInterface
Overrides:
getRequiredInterfaces in class Component
Returns:
an array of interface information for each required interface
See Also:
ViewInterface.getRequiredInterfaces()

newRefreshAlarm

protected AlarmInterface newRefreshAlarm()
Create a new AlarmInterface object to fire the alarm that resets the text to the text from the model. An Alarm object is created that delays 10 seconds before firing once and then turning off.

Returns:
a new AlarmInterface object

createComponents

protected void createComponents()
Create the components used by this class.


setDefaultValues

public void setDefaultValues()
Set the default values of this class. This method calls the createComponents() method to create new components.

Specified by:
setDefaultValues in interface ComponentInterface
Overrides:
setDefaultValues in class Component
See Also:
ComponentInterface.setDefaultValues()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.