com.altair.hwm.toolkit.beans
Class HWMBeanInstance

java.lang.Object
  extended by com.altair.hwm.toolkit.beans.HWMBeanInstance

public class HWMBeanInstance
extends java.lang.Object

Title: HWMBeanInstance

Description: Encapsulates beans and other information such as size of bean, location of bean etc.

Company: Altair Engineering, Inc.


Constructor Summary
HWMBeanInstance(HWMModelInstance hwmModelInstance)
          Constructor
 
Method Summary
 java.lang.Object GetBean()
          Returns the bean
 int GetBeanID()
          Returns the id
 HWMBeanWrapper GetBeanWrapper()
          Gets the bean wrapper
 HWMBeanInfo GetHWMBeanInfo()
          Returns the HWMBeanInfo
 java.lang.String GetInstanceName()
          Get the name of the bean instance
 java.awt.Point GetLocation()
          Returns the location
 java.awt.Dimension GetSize()
          Returns the size
 java.lang.String GetValidBeanName(java.lang.String strName)
          Given a name for the instance, validate it.
 boolean IsValidBeanName()
          Determine if the bean instance name that has been set in this class is truly unique across the project
 boolean IsValidBeanName(java.lang.String strName)
          Determine if the bean instance name is truly unique across the project
 void LoadProject(HWMObjectInputStream inStream)
          Retrieve the project file.
 void OnMigrateProject(HWMBeanInstance hwmBeanInstOldDefPrj, HWMBeanInstance hwmBeanInstOldPrj)
          Migrates the prj to a new template.
 void PositionBeanInPage()
          Positions bean based on its location and size.
 void ReadVersion1_0(HWMObjectInputStream inStream)
          Retrieve the project file.
 void ReadVersion2_0(HWMObjectInputStream inStream)
          Retrieve the project file (V2.0).
 void ReadVersion3_0(HWMObjectInputStream inStream)
          Retrieve the project file (V3.0).
 void SaveProject(java.io.ObjectOutputStream outStream)
          Save the project file.
 void SetBean(java.lang.Object newBean)
          Sets the bean
 void SetBeanID(int newBeanID)
          Sets the id
 void SetBeanWrapper(HWMBeanWrapper beanWrapper)
          Gets the bean wrapper
 void SetHWMBeanInfo(HWMBeanInfo hwmBeanInfo)
          Sets the bean info
 void SetInstanceName(java.lang.String strName)
          Set the name of the bean instance
 void SetLocation(java.awt.Point newLocation)
          Sets the location
 void SetSize(java.awt.Dimension newSize)
          Sets the size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HWMBeanInstance

public HWMBeanInstance(HWMModelInstance hwmModelInstance)
Constructor

Method Detail

PositionBeanInPage

public void PositionBeanInPage()
Positions bean based on its location and size.


SetBeanWrapper

public void SetBeanWrapper(HWMBeanWrapper beanWrapper)
Gets the bean wrapper

Parameters:
beanWrapper - The wrapper for the bean

GetBeanWrapper

public HWMBeanWrapper GetBeanWrapper()
Gets the bean wrapper

Returns:
HWMBeanWrapper The wrapper for the bean

GetLocation

public java.awt.Point GetLocation()
Returns the location

Returns:
Point

SetLocation

public void SetLocation(java.awt.Point newLocation)
Sets the location

Parameters:
newLocation -

SetSize

public void SetSize(java.awt.Dimension newSize)
Sets the size

Parameters:
newSize -

GetSize

public java.awt.Dimension GetSize()
Returns the size

Returns:
Dimension

SetBeanID

public void SetBeanID(int newBeanID)
Sets the id

Parameters:
newBeanID -

GetBeanID

public int GetBeanID()
Returns the id

Returns:
int

SetBean

public void SetBean(java.lang.Object newBean)
Sets the bean

Parameters:
newBean -

GetBean

public java.lang.Object GetBean()
Returns the bean

Returns:
Object

SetHWMBeanInfo

public void SetHWMBeanInfo(HWMBeanInfo hwmBeanInfo)
Sets the bean info

Parameters:
newHWMBeanInfo -

GetHWMBeanInfo

public HWMBeanInfo GetHWMBeanInfo()
Returns the HWMBeanInfo

Returns:
HWMBeanInfo

SetInstanceName

public void SetInstanceName(java.lang.String strName)
Set the name of the bean instance


GetInstanceName

public java.lang.String GetInstanceName()
Get the name of the bean instance


IsValidBeanName

public boolean IsValidBeanName()
Determine if the bean instance name that has been set in this class is truly unique across the project

Returns:
boolean true=>Instance name is unique; false otherwise

IsValidBeanName

public boolean IsValidBeanName(java.lang.String strName)
Determine if the bean instance name is truly unique across the project

Parameters:
strName - The bean instance name (to check if this is unique)
Returns:
boolean true=>Instance name is unique; false otherwise

GetValidBeanName

public java.lang.String GetValidBeanName(java.lang.String strName)
Given a name for the instance, validate it. If a bean with the same name exists, append it with the first available number to make it unique and return the unique name

Parameters:
The - name of the instance to validate
Returns:
The available unique name

SaveProject

public void SaveProject(java.io.ObjectOutputStream outStream)
                 throws java.io.IOException
Save the project file. The project file has the info about the bean being used

Parameters:
outStream - -- The stream to "serialize" to
Throws:
java.io.IOException

LoadProject

public void LoadProject(HWMObjectInputStream inStream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException,
                        java.lang.InstantiationException,
                        java.beans.IntrospectionException
Retrieve the project file. The project file has all the information regarding the properties of the individual beans. This will read the version and call the appropriate function to load the class with the given version.

Parameters:
inStream - -- The stream to read from
Throws:
IOException, - ClassNotFoundException, IllegalAccessException InstantiationException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.beans.IntrospectionException

ReadVersion1_0

public void ReadVersion1_0(HWMObjectInputStream inStream)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.beans.IntrospectionException
Retrieve the project file. The project file has all the information regarding the properties of the individual beans.

Parameters:
inStream - -- The stream to read from
Throws:
IOException, - ClassNotFoundException, IllegalAccessException InstantiationException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.beans.IntrospectionException

ReadVersion2_0

public void ReadVersion2_0(HWMObjectInputStream inStream)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.beans.IntrospectionException
Retrieve the project file (V2.0). The project file has all the information regarding the individual beans.

Parameters:
inStream - -- The stream to read from
Throws:
IOException, - ClassNotFoundException, IllegalAccessException InstantiationException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.beans.IntrospectionException

ReadVersion3_0

public void ReadVersion3_0(HWMObjectInputStream inStream)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.beans.IntrospectionException
Retrieve the project file (V3.0). The project file has all the information regarding the individual beans.

Parameters:
inStream - -- The stream to read from
Throws:
IOException, - ClassNotFoundException, IllegalAccessException InstantiationException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.beans.IntrospectionException

OnMigrateProject

public void OnMigrateProject(HWMBeanInstance hwmBeanInstOldDefPrj,
                             HWMBeanInstance hwmBeanInstOldPrj)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException,
                             java.beans.IntrospectionException,
                             java.lang.InstantiationException,
                             java.lang.IllegalAccessException
Migrates the prj to a new template. It will get all the props that have a get/set method and then checks the properties that have changed from the old default project to the old prj that needs to be migrated. If a property has changed, it will set the property on the new bean in the bean instance.

Parameters:
hwmBeanInstOldDefPrj - The bean instance that was loaded from the old template's default project
hwmBeanInstOldPrj - The bean instance that was loaded from the project that should migrate to the new template
Throws:
IntrospectionException, - InstantiationException, IllegalAccessException
java.io.IOException
java.lang.ClassNotFoundException
java.beans.IntrospectionException
java.lang.InstantiationException
java.lang.IllegalAccessException