com.altair.hwm.toolkit.datamodel
Class HWMDataModelImpl

java.lang.Object
  extended by com.altair.hwm.toolkit.datamodel.HWMDataModelImpl
All Implemented Interfaces:
HWMDataModel, IHWMDataModel, java.awt.event.KeyListener, java.io.Externalizable, java.io.Serializable, java.util.EventListener

public class HWMDataModelImpl
extends java.lang.Object
implements IHWMDataModel, java.io.Externalizable, java.awt.event.KeyListener

Title: HWMDataModelImpl

Description: This is the data model class which is created for each instance of the framework by the toolkit.

Company: Altair Engineering, Inc.

See Also:
Serialized Form

Field Summary
static int searchStartIndex
           
static java.lang.String VERSION
          The version of this class
 
Constructor Summary
HWMDataModelImpl(HWMModelInstance hwmModelInstance)
          Constructor
HWMDataModelImpl(HWMModelInstance hwmModelInstance, HWMClassLoader hwmClassLoader)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
          Add a listener
 void addPropertyChangeListener(java.lang.String strName, java.beans.PropertyChangeListener propChangeListener)
          Add a listener for a particular property
 void ChangePropertyName(java.lang.String strOldName, java.lang.String strNewName)
          Change the name of a property in the datamodel.
 void ClearAll()
          Clears all the properties
 void ClearAllRuns()
          Clears all the properties
 void CopyRun(java.lang.String strRunName, java.lang.String strCopyRunName)
          Create a new run as a copy of an existing run
 java.util.Hashtable CreateRun(java.lang.String strRunName, boolean bCopyScratchPad)
          Create the data for the given run #
 void DeleteRun(java.lang.String strRunName)
          Delete the data for the given run name
 void FireEvent(java.lang.Object objSender, java.lang.String strPropName, java.lang.Object objOldVal, java.lang.Object objNewVal)
          Fire event to all the listeners
 void FireEvent(java.beans.PropertyChangeEvent propChangeEvent)
          Fire event to all the listeners
 void FireEvent(java.lang.String strPropName, java.lang.Object objOldVal, java.lang.Object objNewVal)
          Fire event to all the listeners
 java.lang.String GetActiveRunName()
          Return the active run name
 java.util.Vector GetAllPropertyNames()
          Get a list of all properties avaliable in the datamodel
 java.util.Hashtable GetDataFromScratchPad()
          ADDED DURING DATA MODEL VIEWER DEVELOPMENT Returns the ScratchPad Data that are stored in DataModel
 HWMDataModelViewerMgr GetDataModelViewerMgr()
          Return the HWMDataModelViewerMgr, which manages data model viewer
 boolean GetEnable(java.lang.String strBeanInstance)
          Gets the property "enable".
 java.lang.Object GetProperty(java.lang.String strName)
          Gets the property value
 java.lang.Object GetProperty(java.lang.String strBeanInstance, java.lang.String strName)
          Gets the property value.
 int GetRunCount()
          Return the number of runs
 java.util.Hashtable GetRunData(java.lang.String strRunName)
          Return the data for the given run #
 java.util.Vector GetRunNames()
          Return the names of all runs
 java.lang.Object GetValue(java.lang.String strBeanInstance)
          Gets the property value.
 boolean GetVisible(java.lang.String strBeanInstance)
          Gets the property "visible".
 boolean IsDataChangedByTask()
          Check if the data has been changed by the cuurent task
 boolean IsPropertyTransient(java.lang.String strPropName)
          Returns a flag indicating if the property is set as transient
 void keyPressed(java.awt.event.KeyEvent arg0)
           
 void keyReleased(java.awt.event.KeyEvent arg0)
           
 void keyTyped(java.awt.event.KeyEvent arg0)
           
 void myDataViewer()
           
 void OnMigrateProject(HWMDataModelImpl hwmOldDM)
          Gets the data form the old data model and puts it into the new data model
 void ReadDataModel(org.jdom.Element elemDataModel)
          Reads the data model from a XML element
 void readExternal(java.io.ObjectInput objIn)
          Reads the data model
 void RemoveProperty(java.lang.String strName)
          Remove the property value
 void removePropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
          Removes a listener
 void removePropertyChangeListener(java.lang.String strName, java.beans.PropertyChangeListener propChangeListener)
          Remove a listener for a particular property
 void RemovePropertyFromActiveRun(java.lang.String strRunName, java.lang.String strName)
          Remove the property value from run name
 void SetActiveRun(java.lang.String strRunName)
          Set the given run as active and reset the workflow state
 void SetClassLoader(HWMClassLoader hwmClassLoader)
          Set the clas loader so that the datamodel will be able to instantiate all the objects contained in it (while deserializing)
 void SetDataChangedByTask(boolean bState)
          Whenever, a new task is selected, the workflow model will reset the flag denoting whether the data has been changed by the current task (Set the flag to false)
 void SetEnable(java.lang.String strBeanInstance, boolean bEnable)
          Sets the property "enable".
 void SetProperty(java.lang.String strName, boolean bNewValue)
          Sets the boolean property value
 void SetProperty(java.lang.String strName, java.lang.Object objNewValue)
          Sets the property value
 void SetProperty(java.lang.String strBeanInstance, java.lang.String strName, boolean bNewValue)
          Sets the boolean property value.
 void SetProperty(java.lang.String strBeanInstance, java.lang.String strName, java.lang.Object objNewValue)
          Sets the property value.
 void SetPropertyAsTransient(java.lang.String strPropName, boolean bTransient)
          Sets the property to be transient or non-transient
 void SetPropertyInActiveRun(java.lang.String strBeanInstance, java.lang.String strName, java.lang.Object objNewValue)
          Sets the property value in the active run.
 void SetPropertyUsingSender(java.lang.Object objSender, java.lang.String strName, java.lang.Object objNewValue)
          Sets the property value
 void SetPropertyUsingSender(java.lang.Object objSender, java.lang.String strBeanInstance, java.lang.String strName, java.lang.Object objNewValue)
          Sets the property value.
 void SetValue(java.lang.String strBeanInstance, java.lang.Object objNewValue)
          Sets the property value.
 void SetValueInActiveRun(java.lang.String strBeanInstance, java.lang.Object objNewValue)
          Sets the property value in active run.
 void SetVisible(java.lang.String strBeanInstance, boolean bVisible)
          Sets the property "visible".
 void ShowDataViewer()
          Show the Data Model Viewer
 void ShowMessage(java.lang.String str)
           
 void WriteDataModel(org.jdom.Element elemDataModel)
          Writes the data model to a XML element
 void writeExternal(java.io.ObjectOutput objOut)
          Writes the data model
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
The version of this class

See Also:
Constant Field Values

searchStartIndex

public static int searchStartIndex
Constructor Detail

HWMDataModelImpl

public HWMDataModelImpl(HWMModelInstance hwmModelInstance,
                        HWMClassLoader hwmClassLoader)
Constructor

Parameters:
hwmClassLoader - The class loader to use.

HWMDataModelImpl

public HWMDataModelImpl(HWMModelInstance hwmModelInstance)
Constructor

Parameters:
hwmClassLoader - The class loader to use.
Method Detail

SetClassLoader

public void SetClassLoader(HWMClassLoader hwmClassLoader)
Set the clas loader so that the datamodel will be able to instantiate all the objects contained in it (while deserializing)

Parameters:
hwmClassLoader - The class loader to use.

GetRunData

public java.util.Hashtable GetRunData(java.lang.String strRunName)
                               throws java.lang.Exception
Return the data for the given run #

Parameters:
strRunName - The run name whose data is to be retrieved
Returns:
Hahstable Map from name to value
Throws:
java.lang.Exception

CreateRun

public java.util.Hashtable CreateRun(java.lang.String strRunName,
                                     boolean bCopyScratchPad)
                              throws java.lang.Exception
Create the data for the given run #

Specified by:
CreateRun in interface IHWMDataModel
Parameters:
strRunName - The run name to create
bCopyScratchPad - If true, scratchpad is copied into the new run
Returns:
Hahstable Map from name to value
Throws:
java.lang.Exception

CopyRun

public void CopyRun(java.lang.String strRunName,
                    java.lang.String strCopyRunName)
             throws java.lang.Exception
Create a new run as a copy of an existing run

Specified by:
CopyRun in interface IHWMDataModel
Parameters:
strRunName - The run name to create
strCopyRunName - The name of the run to copy
Throws:
java.lang.Exception

DeleteRun

public void DeleteRun(java.lang.String strRunName)
               throws java.lang.Exception
Delete the data for the given run name

Specified by:
DeleteRun in interface IHWMDataModel
Parameters:
strRunName - The run to delete
Throws:
java.lang.Exception

GetRunCount

public int GetRunCount()
Return the number of runs

Specified by:
GetRunCount in interface IHWMDataModel
Returns:
int # of runs

GetRunNames

public java.util.Vector GetRunNames()
Return the names of all runs

Specified by:
GetRunNames in interface IHWMDataModel
Returns:
Vector Vector of available run names

GetActiveRunName

public java.lang.String GetActiveRunName()
Return the active run name

Specified by:
GetActiveRunName in interface IHWMDataModel
Returns:
String Active run name

SetActiveRun

public void SetActiveRun(java.lang.String strRunName)
                  throws java.lang.Exception
Set the given run as active and reset the workflow state

Specified by:
SetActiveRun in interface IHWMDataModel
Parameters:
strRunName - Run name to activate
Throws:
java.lang.Exception

SetPropertyAsTransient

public void SetPropertyAsTransient(java.lang.String strPropName,
                                   boolean bTransient)
Sets the property to be transient or non-transient

Specified by:
SetPropertyAsTransient in interface HWMDataModel
Specified by:
SetPropertyAsTransient in interface IHWMDataModel
Parameters:
strPropName - The name of the property
bTransient - If true, this property is set to transient i.e. not saved. Else, it is saved.

IsPropertyTransient

public boolean IsPropertyTransient(java.lang.String strPropName)
Returns a flag indicating if the property is set as transient

Specified by:
IsPropertyTransient in interface HWMDataModel
Specified by:
IsPropertyTransient in interface IHWMDataModel
Parameters:
strPropName - The name of the property
Returns:
boolean Returns true if this property is set as transient else returns false.

SetPropertyUsingSender

public void SetPropertyUsingSender(java.lang.Object objSender,
                                   java.lang.String strName,
                                   java.lang.Object objNewValue)
Sets the property value

Specified by:
SetPropertyUsingSender in interface IHWMDataModel
Parameters:
objSender - The sender who should not be notified (can be null)
strName - The name of the property
objNewValue - The value for the given property

SetProperty

public void SetProperty(java.lang.String strName,
                        java.lang.Object objNewValue)
Sets the property value

Specified by:
SetProperty in interface HWMDataModel
Specified by:
SetProperty in interface IHWMDataModel
Parameters:
strName - The name of the property
objNewValue - The value for the given property

SetPropertyUsingSender

public void SetPropertyUsingSender(java.lang.Object objSender,
                                   java.lang.String strBeanInstance,
                                   java.lang.String strName,
                                   java.lang.Object objNewValue)
Sets the property value. The datamodel will concatenate and store the data as "BeanInstance.PropertyName". It is will also fire an event to the bean whose property is being changed except to the Sender object

Specified by:
SetPropertyUsingSender in interface IHWMDataModel
Parameters:
objSender - The sender who should not be notified (can be null)
strBeanInstance - The Bean instance whose property is being set
strName - The name of the property
objNewValue - The value for the given property

SetProperty

public void SetProperty(java.lang.String strBeanInstance,
                        java.lang.String strName,
                        java.lang.Object objNewValue)
Sets the property value. The datamodel will concatenate and store the data as "BeanInstance.PropertyName". It is will also fire an event to the bean whose property is being changed strBeanInstance The Bean instance whose property is being set

Specified by:
SetProperty in interface IHWMDataModel
Parameters:
strName - The name of the property
objNewValue - The value for the given property

SetPropertyInActiveRun

public void SetPropertyInActiveRun(java.lang.String strBeanInstance,
                                   java.lang.String strName,
                                   java.lang.Object objNewValue)
Sets the property value in the active run. The datamodel will concatenate and store the data as "BeanInstance.PropertyName".

Specified by:
SetPropertyInActiveRun in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
strName - The name of the property
objNewValue - The value for the given property

SetProperty

public void SetProperty(java.lang.String strBeanInstance,
                        java.lang.String strName,
                        boolean bNewValue)
Sets the boolean property value. This function will create a Boolean The datamodel will concatenate and store the data as "BeanInstance.PropertyName". It is will also fire an event to the bean whose property is being changed strBeanInstance The Bean instance whose property is being set

Parameters:
strName - The name of the property
objNewValue - The value for the given property

SetProperty

public void SetProperty(java.lang.String strName,
                        boolean bNewValue)
Sets the boolean property value

Parameters:
strName - The name of the property
bNewValue - The value for the (boolean)property

SetValueInActiveRun

public void SetValueInActiveRun(java.lang.String strBeanInstance,
                                java.lang.Object objNewValue)
Sets the property value in active run. The datamodel will concatenate and store the data as "BeanInstance.value".

Specified by:
SetValueInActiveRun in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
objNewValue - The value for the given property

SetValue

public void SetValue(java.lang.String strBeanInstance,
                     java.lang.Object objNewValue)
Sets the property value. The datamodel will concatenate and store the data as "BeanInstance.value". It is will also fire an event to the bean whose property is being changed

Specified by:
SetValue in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
objNewValue - The value for the given property

GetValue

public java.lang.Object GetValue(java.lang.String strBeanInstance)
Gets the property value. The datamodel will concatenate and get the data "BeanInstance.value".

Specified by:
GetValue in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
Returns:
Object The value for the given property. If such a property does not exist, then null

SetEnable

public void SetEnable(java.lang.String strBeanInstance,
                      boolean bEnable)
Sets the property "enable". The datamodel will concatenate and store the data as "BeanInstance.enable". It is will also fire an event to the bean whose property is being changed

Specified by:
SetEnable in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
bEnable - The enable state

GetEnable

public boolean GetEnable(java.lang.String strBeanInstance)
Gets the property "enable". The datamodel will concatenate and get the data "BeanInstance.enable".

Specified by:
GetEnable in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
Returns:
boolean The enable state (true by default)

SetVisible

public void SetVisible(java.lang.String strBeanInstance,
                       boolean bVisible)
Sets the property "visible". The datamodel will concatenate and store the data as "BeanInstance.visible". It is will also fire an event to the bean whose property is being changed

Specified by:
SetVisible in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
bVisible - The visible state

GetVisible

public boolean GetVisible(java.lang.String strBeanInstance)
Gets the property "visible". The datamodel will concatenate and get the data "BeanInstance.visible".

Specified by:
GetVisible in interface IHWMDataModel
Parameters:
strBeanInstance - The Bean instance whose property is being set
Returns:
boolean The enable state (true by default)

GetProperty

public java.lang.Object GetProperty(java.lang.String strName)
Gets the property value

Specified by:
GetProperty in interface HWMDataModel
Specified by:
GetProperty in interface IHWMDataModel
Parameters:
strName - The name of the property
Returns:
Object The value for the given property. If such a property does not exist, then null

GetProperty

public java.lang.Object GetProperty(java.lang.String strBeanInstance,
                                    java.lang.String strName)
Gets the property value. The datamodel will concatenate and get the data "BeanInstance.PropertyName". strBeanInstance The Bean instance whose property is being set

Specified by:
GetProperty in interface IHWMDataModel
Parameters:
strName - The name of the property
Returns:
Object The value for the given property. If such a property does not exist, then null

RemoveProperty

public void RemoveProperty(java.lang.String strName)
Remove the property value

Specified by:
RemoveProperty in interface HWMDataModel
Specified by:
RemoveProperty in interface IHWMDataModel
Parameters:
strName - The name of the property to remove

RemovePropertyFromActiveRun

public void RemovePropertyFromActiveRun(java.lang.String strRunName,
                                        java.lang.String strName)
Remove the property value from run name

Specified by:
RemovePropertyFromActiveRun in interface IHWMDataModel
Parameters:
strName - The name of the property to remove

ChangePropertyName

public void ChangePropertyName(java.lang.String strOldName,
                               java.lang.String strNewName)
Change the name of a property in the datamodel. The datamodel will do nothing if a property by the old name does not exist in the datamodel

Specified by:
ChangePropertyName in interface IHWMDataModel
Parameters:
strOldName - The old name of the property
strNewName - The new name of the property.

IsDataChangedByTask

public boolean IsDataChangedByTask()
Check if the data has been changed by the cuurent task


SetDataChangedByTask

public void SetDataChangedByTask(boolean bState)
Whenever, a new task is selected, the workflow model will reset the flag denoting whether the data has been changed by the current task (Set the flag to false)


FireEvent

public void FireEvent(java.beans.PropertyChangeEvent propChangeEvent)
Fire event to all the listeners

Specified by:
FireEvent in interface HWMDataModel
Specified by:
FireEvent in interface IHWMDataModel
Parameters:
objSender - The sender who should not be notified (can be null)
propChangeEvent - The property change event.

FireEvent

public void FireEvent(java.lang.String strPropName,
                      java.lang.Object objOldVal,
                      java.lang.Object objNewVal)
Fire event to all the listeners

Specified by:
FireEvent in interface HWMDataModel
Specified by:
FireEvent in interface IHWMDataModel
Parameters:
strPropName - The property name.
objOldVal - The old value for the property.
objNewVal - The new value for the property. NOTE: If the oldValue = newValue, then the event is not fired

FireEvent

public void FireEvent(java.lang.Object objSender,
                      java.lang.String strPropName,
                      java.lang.Object objOldVal,
                      java.lang.Object objNewVal)
Fire event to all the listeners

Specified by:
FireEvent in interface IHWMDataModel
Parameters:
objSender - The sender who should not be notified (can be null)
strPropName - The property name.
objOldVal - The old value for the property.
objNewVal - The new value for the property. NOTE: If the oldValue = newValue, then the event is not fired

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
Add a listener

Specified by:
addPropertyChangeListener in interface HWMDataModel
Specified by:
addPropertyChangeListener in interface IHWMDataModel
Parameters:
propChangeListener - The listener object which will be notified.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String strName,
                                      java.beans.PropertyChangeListener propChangeListener)
Add a listener for a particular property

Specified by:
addPropertyChangeListener in interface HWMDataModel
Specified by:
addPropertyChangeListener in interface IHWMDataModel
Parameters:
strName - Name of the property to listen to.
propChangeListener - The listener object which will be notified.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener propChangeListener)
Removes a listener

Specified by:
removePropertyChangeListener in interface HWMDataModel
Specified by:
removePropertyChangeListener in interface IHWMDataModel
Parameters:
propChangeListener - The listener object which will be removed.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String strName,
                                         java.beans.PropertyChangeListener propChangeListener)
Remove a listener for a particular property

Specified by:
removePropertyChangeListener in interface HWMDataModel
Specified by:
removePropertyChangeListener in interface IHWMDataModel
Parameters:
strName - Name of the property.
propChangeListener - The listener object which should be removed.

ClearAll

public void ClearAll()
Clears all the properties

Specified by:
ClearAll in interface HWMDataModel
Specified by:
ClearAll in interface IHWMDataModel

ClearAllRuns

public void ClearAllRuns()
Clears all the properties


GetAllPropertyNames

public java.util.Vector GetAllPropertyNames()
Get a list of all properties avaliable in the datamodel

Specified by:
GetAllPropertyNames in interface IHWMDataModel
Returns:
Vector A vector of the property names in the datamodel

GetDataFromScratchPad

public java.util.Hashtable GetDataFromScratchPad()
ADDED DURING DATA MODEL VIEWER DEVELOPMENT Returns the ScratchPad Data that are stored in DataModel

Specified by:
GetDataFromScratchPad in interface IHWMDataModel
Returns:
Hashtable - The Data from ScratchPad

OnMigrateProject

public void OnMigrateProject(HWMDataModelImpl hwmOldDM)
                      throws java.lang.Exception
Gets the data form the old data model and puts it into the new data model

Parameters:
hwmOldDM - -- The old data model
Throws:
java.lang.Exception - - when any error occurs

ReadDataModel

public void ReadDataModel(org.jdom.Element elemDataModel)
                   throws java.io.IOException,
                          java.lang.ClassNotFoundException
Reads the data model from a XML element

Specified by:
ReadDataModel in interface HWMDataModel
Specified by:
ReadDataModel in interface IHWMDataModel
Parameters:
elemDataModel - The element representing the datamodel
Throws:
IOException, - ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

WriteDataModel

public void WriteDataModel(org.jdom.Element elemDataModel)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Writes the data model to a XML element

Specified by:
WriteDataModel in interface HWMDataModel
Specified by:
WriteDataModel in interface IHWMDataModel
Parameters:
elemDataModel - The element representing the datamodel
Throws:
IOException, - ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

readExternal

public void readExternal(java.io.ObjectInput objIn)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the data model

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
objIn - The input stream to read form
Throws:
IOException, - ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput objOut)
                   throws java.io.IOException
Writes the data model

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
objOut - The output stream to write to
Throws:
java.io.IOException

ShowDataViewer

public void ShowDataViewer()
Description copied from interface: IHWMDataModel
Show the Data Model Viewer

Specified by:
ShowDataViewer in interface IHWMDataModel

GetDataModelViewerMgr

public HWMDataModelViewerMgr GetDataModelViewerMgr()
Description copied from interface: IHWMDataModel
Return the HWMDataModelViewerMgr, which manages data model viewer

Specified by:
GetDataModelViewerMgr in interface IHWMDataModel

myDataViewer

public void myDataViewer()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

keyTyped

public void keyTyped(java.awt.event.KeyEvent arg0)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent arg0)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent arg0)
Specified by:
keyReleased in interface java.awt.event.KeyListener

ShowMessage

public void ShowMessage(java.lang.String str)