com.altair.hwm.toolkit.frame
Class HWMFrameModel

java.lang.Object
  extended by com.altair.hwm.toolkit.frame.HWMFrameModel
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener
Direct Known Subclasses:
HWMAppFrameModel, HWMDsgnFrameModel

public abstract class HWMFrameModel
extends java.lang.Object
implements java.beans.PropertyChangeListener

Title: HWMFrameModel

Description: This is the model class for the frame.

Company: Altair Engineering, Inc.


Field Summary
static java.lang.String PROP_FRAME_MODELACTIVE
          These statics represent the properties fired by the frame model
 
Constructor Summary
HWMFrameModel(java.awt.Component frameEPIC, IHWMFrame ihwmFrame)
          Constructor
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener propListener)
          Add a property change listener
 void ClearAll()
           
 HWMModelInstance GetActiveModelInstance()
          Get the active model instance
 HWMTplProps GetActiveTplProps()
          Get the process definition properties for the currently active model instance
 java.awt.Component GetEPICFrame()
          Returns the parent component.
 HWPMInteraction GetHWPMInteraction()
          Get the HWPMInteraction instance
 IHWMFrame GetIHWMFrame()
          Returns the IHWMFrame interface.
 HWMModelInstance GetInstance(java.lang.String strInstName)
          Gets the instance with given name
 int GetInstanceIndex(java.lang.String strInstName)
          Gets the instance with given name
 java.util.Vector GetModelInstances()
          Return the vector of model instances.
 int GetNumModelInstances()
          Get the # of opened files
 HWMTplProps GetTplProps(java.lang.String strTplFileName)
          Get the process definition properties for the given model instance
 void Initialize()
          Initialize all the beans in the process definition and call run on them
abstract  boolean IsDesignerMode()
          Returns a flag if its designer or app mode.
 boolean IsPMMode()
          Returns true if in PM mode else false
 void OnCloseFile(HWMModelInstance hwmModelInst, boolean bSave)
          Close the file represented by the given model instance
 void OnExit()
          Called when JVM session is about to end i.e.
 void OnSaveAsFile(HWMModelInstance hwmModelInst, java.lang.String sSaveAsfilename)
           
 void OnSaveFile(HWMModelInstance hwmModelInst)
          Save the instance
 void propertyChange(java.beans.PropertyChangeEvent propChgEvt)
          Fired when any property changes
 void Quit(boolean bSave, boolean bAskUser)
          This will ask the frame to quit
 void removePropertyChangeListener(java.beans.PropertyChangeListener propListener)
          Remove a property change listener
 void SetActiveInstance(HWMModelInstance hwmModelInstance)
          Sets the active instance
 void SetActiveInstance(int nIndex)
          Sets the active instance
 void SetActiveInstance(java.lang.String strName)
          Sets the active instance
 void SetHWPMInteraction(HWPMInteraction hwpmInteraction)
          Instantiate the HWPMInteraction class to listen to the specified port
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_FRAME_MODELACTIVE

public static final java.lang.String PROP_FRAME_MODELACTIVE
These statics represent the properties fired by the frame model

See Also:
Constant Field Values
Constructor Detail

HWMFrameModel

public HWMFrameModel(java.awt.Component frameEPIC,
                     IHWMFrame ihwmFrame)
Constructor

Parameters:
frameEPIC - The main frame for EPIC
ihwmFrame - The handle to IHWMFrame interface
Method Detail

OnSaveFile

public void OnSaveFile(HWMModelInstance hwmModelInst)
                throws java.lang.Exception
Save the instance

Parameters:
hwmModelInst - The model instance
Throws:
java.lang.Exception

OnSaveAsFile

public void OnSaveAsFile(HWMModelInstance hwmModelInst,
                         java.lang.String sSaveAsfilename)
                  throws java.lang.Exception
Throws:
java.lang.Exception

OnCloseFile

public void OnCloseFile(HWMModelInstance hwmModelInst,
                        boolean bSave)
                 throws java.lang.Exception
Close the file represented by the given model instance

Parameters:
hwmModelInst - The model instance to close
bSave - If true, the file is saved before closing
Throws:
java.lang.Exception

Quit

public void Quit(boolean bSave,
                 boolean bAskUser)
This will ask the frame to quit

Parameters:
bSave - If true and bAskUser is false, then the file is saved else not saved
bAskUser - If true then the user is prompted to save the file else the bSave flag takes the precedence

OnExit

public void OnExit()
Called when JVM session is about to end i.e. someone is going to call System.exit(0);


ClearAll

public void ClearAll()

GetInstanceIndex

public int GetInstanceIndex(java.lang.String strInstName)
                     throws java.lang.Exception
Gets the instance with given name

Parameters:
strInstName - The name for the instance(i.e. prj name in app mode and pmt name in dsgn mode)
Returns:
int The position of the model instance
Throws:
java.lang.Exception

GetInstance

public HWMModelInstance GetInstance(java.lang.String strInstName)
Gets the instance with given name

Parameters:
strInstName - The name for the instance(i.e. prj name in app mode and pmt name in dsgn mode)
Returns:
HWMModelInstance The model instance, null if the instance is not present

GetActiveModelInstance

public HWMModelInstance GetActiveModelInstance()
Get the active model instance

Returns:
HWMModelInstance The currently active model instance

Initialize

public void Initialize()
                throws java.lang.Exception
Initialize all the beans in the process definition and call run on them

Throws:
java.lang.Exception

GetNumModelInstances

public int GetNumModelInstances()
Get the # of opened files

Returns:
int The number of opened files

GetModelInstances

public java.util.Vector GetModelInstances()
Return the vector of model instances.

Returns:
Vector the vector of model instances.

GetActiveTplProps

public HWMTplProps GetActiveTplProps()
Get the process definition properties for the currently active model instance

Returns:
HWMTplProps The process definition properties for the currently active model instance

GetTplProps

public HWMTplProps GetTplProps(java.lang.String strTplFileName)
Get the process definition properties for the given model instance

Parameters:
strTplFileName - The pmt file for which the pmt props are returned
Returns:
HWMTplProps The process definition properties for the given model instance

SetActiveInstance

public void SetActiveInstance(java.lang.String strName)
                       throws java.lang.Exception
Sets the active instance

Parameters:
strName - The name of the instance
Throws:
java.lang.Exception

SetActiveInstance

public void SetActiveInstance(int nIndex)
                       throws java.lang.Exception
Sets the active instance

Parameters:
nIndex - If nIndex > number of opened instances, the first instance is made active. If no instances are opened, then the current instance is set to null.
Throws:
java.lang.Exception

SetActiveInstance

public void SetActiveInstance(HWMModelInstance hwmModelInstance)
                       throws java.lang.Exception
Sets the active instance

Parameters:
hwmModelInstance - The current model instance
Throws:
java.lang.Exception

IsDesignerMode

public abstract boolean IsDesignerMode()
Returns a flag if its designer or app mode. Implemented by derived classes

Returns:
boolean true if designer else false

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent propChgEvt)
Fired when any property changes

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener propListener)
Add a property change listener


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener propListener)
Remove a property change listener


SetHWPMInteraction

public void SetHWPMInteraction(HWPMInteraction hwpmInteraction)
                        throws java.lang.Exception
Instantiate the HWPMInteraction class to listen to the specified port

Throws:
java.lang.Exception - If any error occurs

GetHWPMInteraction

public HWPMInteraction GetHWPMInteraction()
Get the HWPMInteraction instance


IsPMMode

public boolean IsPMMode()
Returns true if in PM mode else false

Returns:
boolean true if in PM mode else false

GetEPICFrame

public java.awt.Component GetEPICFrame()
Returns the parent component. Use this as the parent for displaying any dialogs so that it will acquire the icon from this component.

Returns:
Component The parent component. This can be any of the top level containers like frame, window etc. It can be null, if view has not been created at all.

GetIHWMFrame

public IHWMFrame GetIHWMFrame()
Returns the IHWMFrame interface.

Returns:
IHWMFrame The concrete class implementing IHWMFrame.