Out of the Box Beans

Examples of packages that include some of the standard beans provided in Process Manager follow:

com.altair.hwm.beans.utils

This contains some utility beans, including HWMBasePanel, HWMButton, HWMLabel, HWMTextField, HWMComboBox, and so on.

It is recommended that the Java beans you are developing extend one of the above mentioned classes (rather than JPanel, JButton, and so on), as these classes already implement IHWMControl and the UI of these classes conform to Altair GUI standards.

import com.altair.hwm.interfaces.*;
import com.altair.hwm.beans.utils.*;
public class MyClass extends HWMButton
                      implements ActionListener

/**
* Constructor
*/
public MyClass()

super();
this.setText("My Test");
this.addActionListener(this);
}

/**
* Callback for when the button is pressed
*/
public void actionPerformed(ActionEvent event)

DoSomething();
}

/**
*  The main function wherein, something will be done when the
* button is pressed
*/
public void DoSomething()
{
}

/**
* This method is called by the HWPM engine to set the interface
* with which a bean can communicate directly with the HWPM
* classes.
* @param hwmFrameWork The interface with which a bean can
* communicate with HWPM.
*/
public void SetFrameWork(IHWMFrameWork hwmFrameWork)

super.SetFrameWork(hwmFrameWork);

IHWMDataModel hwmDataModel = m_hwmFrameWork.GetDataModel();

// Add self as listener to any datamodel property change
hwmDataModel.addPropertyChangeListener(this);

//Setup callback hookup to my MenuItem
IMenuToolBarCustomizer hwmMenuToolBarCustomizer =
m_hwmFrameWork.GetMenuToolBarCustomizer();
JMenu menu = hwmMenuToolBarCustomizer.GetMenu("My Menu");
if (menu != null)

JMenuItem menuItem; 
for (int nIndex=0; nIndex<menu.getItemCount(); nIndex++) 
{
menuItem = menu.getItem(nIndex);
String strActionCommand = menuItem.getActionCommand();
if (menuItem.getActionCommand().
compareToIgnoreCase("My Test Item")== 0)

menuItem.setEnabled(true); //IMPORTANT: MUST DO THIS
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)

//DO WHATEVER NEEDS TO BE DONE HERE !!!
}
});

break;
}//if (menuItem.getActionCommand().compareToIgnoreCase(
}//for(int nIndex=0; nIndex<menu.getItemCount(); nIndex++)
} // if (menu != null)

}

} //End of class

This package also contains a utility bean called HWMFileBrowser, which is a "Browse…" button that displays a file browser when selected. In addition to beans, this package also includes some utility classes such as HWMPoint, HWMVector, HWMMatrix, and so on. Please contact Altair to obtain the JavaDocs section for a detailed list.

com.altair.hwm.beans.hm

This package contains some utility beans that are specific to HyperMesh, including:

  • HMStart
  • HMImport
  • HMMesh
  • HMSelect
  • HMBoundingBox
  • HMReflect

com.altair.hwm.beans.database

This package contains some beans that are useful in connecting and communication to/with a database server. Only one bean currently exists in this package, and is called HWMStartDB.

You can write your own beans that connect and communicate with a database server using the functions/APIs provided by the DBServerComm class.