org.peace_tools.core.job
Class MSTWizardPage

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.peace_tools.generic.GenericWizardPage
                      extended by org.peace_tools.core.job.MSTWizardPage
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, WizardPage

public class MSTWizardPage
extends GenericWizardPage
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener

This class serves as an interactive page in a JobWizard. This page permits the user to provide the information about the local MST file where the data is to be stored. This wizard page also permits the user to select a server on which the job must be run. In addition, the wizard page permits the user to specify the number of nodes and CPUs to be used for a parallel job. Note that this wizard page checks to ensure that the MST file does not exist, yet.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JButton browse
          The browse button to be enabled the user to choose the directory where the file is to be stored.
private static java.lang.String CPU_INFO_MSG
          A generic informational message that is displayed to the user to provide information about the u/v heuristic.
private static java.lang.String INVALID_MST_MSG
          A generic informational message that is displayed to the user if the selected MST file is invalid.
private  javax.swing.JTextField mstFile
          Field to read/display the install path where the MST file will be saved after it is generated on the server.
private  javax.swing.JSpinner[] nodeInfo
          The array of two configuration parameter values for the CPUs and nodes per CPU on the server.
private static long serialVersionUID
          A serialization UID to keep the compiler happy.
private  javax.swing.JComboBox serverList
          The combo box that permits the user to select the server to be used for running the job.
private  JobWizard wizard
          A reference to the wizard dialog that logically owns this page.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MSTWizardPage(JobWizard wizard)
          The constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Method to handle clicking of "Browse" button.
private  javax.swing.JComponent createMSTFileBox()
          Helper method to create the MST file entry dialog box along with a "Browse" button.
private  javax.swing.JPanel createServerList()
          Helper method to create the combo-box to select a server.
private  javax.swing.JPanel createServerPanel()
          Helper method to create the server information entry components in this wizard page.
protected  java.lang.String getMSTFile()
          Obtain the path to the MST file entered by the user.
protected  int[] getPlatformConfiguration()
          Obtain platform-specific job configuration information.
protected  Server getSelectedServer()
          Helper method to obtain selected server ID.
protected  java.lang.String getSummary(java.lang.String indent)
          Obtain the name of the server that the user has selected.
 void pageChanged(WizardDialog dialog, int currPage, int prevPage)
          This method is called just before this page is to be displayed.
 boolean pageChanging(WizardDialog dialog, int currPage, int nextPage)
          This method validates the MST file set for in this page.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Listener for CPUs and Nodes/CPU spinner input boxes to update memory.
 
Methods inherited from class org.peace_tools.generic.GenericWizardPage
getPage, getSubTitle, getTitle, setTitle
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wizard

private final JobWizard wizard
A reference to the wizard dialog that logically owns this page. This reference is used to enable and disable buttons on this wizard appropriately.


mstFile

private javax.swing.JTextField mstFile
Field to read/display the install path where the MST file will be saved after it is generated on the server.


browse

private javax.swing.JButton browse
The browse button to be enabled the user to choose the directory where the file is to be stored.


serverList

private javax.swing.JComboBox serverList
The combo box that permits the user to select the server to be used for running the job.


nodeInfo

private javax.swing.JSpinner[] nodeInfo
The array of two configuration parameter values for the CPUs and nodes per CPU on the server. The last two spinners are used for memory and run time values.


CPU_INFO_MSG

private static final java.lang.String CPU_INFO_MSG
A generic informational message that is displayed to the user to provide information about the u/v heuristic.

See Also:
Constant Field Values

INVALID_MST_MSG

private static final java.lang.String INVALID_MST_MSG
A generic informational message that is displayed to the user if the selected MST file is invalid.

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
A serialization UID to keep the compiler happy.

See Also:
Constant Field Values
Constructor Detail

MSTWizardPage

public MSTWizardPage(JobWizard wizard)
The constructor. The constructor sets up the various components on this wizard page. The components include: a text box and button to specify the MST file (this file must not yet exist as we are going to generate it from the job), a combo box to select the server to run the job (this server must have peace already installed on it), JSpinners for number of nodes and CPUs per node to run the job.

Parameters:
wizard - The wizard that logically owns this page.
Method Detail

createMSTFileBox

private javax.swing.JComponent createMSTFileBox()
Helper method to create the MST file entry dialog box along with a "Browse" button. This method is invoked only once from the constructor. This method was introduced just to streamline the code in the constructor

Returns:
A component containing the MST file entry text box along with informational labels.

createServerPanel

private javax.swing.JPanel createServerPanel()
Helper method to create the server information entry components in this wizard page. This includes a combo-box to select a server and spinners for nodes and cpus/node. This method is invoked only once from the constructor. This method was introduced just to streamline the code in the constructor

Returns:
A component containing the input fields related to server information.

createServerList

private javax.swing.JPanel createServerList()
Helper method to create the combo-box to select a server. This method is invoked only once from the createServerPanel method. This method was introduced just to streamline the code better.

Returns:
A panel containing the server list and labels.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Method to handle clicking of "Browse" button. This method essentially enables and disables the various inputs depending on the check box.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

pageChanged

public void pageChanged(WizardDialog dialog,
                        int currPage,
                        int prevPage)
This method is called just before this page is to be displayed. This page essentially updates the list of server entries displayed in the combo-box. It also suggests a default MST file name to the user. However, the user can edit the default suggestion and set it to an appropriate value. In addition, it updates the memory requirement for running the job.

Specified by:
pageChanged in interface WizardPage
Overrides:
pageChanged in class GenericWizardPage
Parameters:
dialog - The wizard dialog that is invoking this method.
currPage - The logical (zero-based) index of the current page in the sequence of pages in the wizard that is going to be displayed.
prevPage - The logical (zero-based) index of the previous page that was displayed. For the first page this value is -1.

pageChanging

public boolean pageChanging(WizardDialog dialog,
                            int currPage,
                            int nextPage)
This method validates the MST file set for in this page. This method is invoked just before the user navigates to the adjacent page. This method checks to ensure that the EST file is valid before user navigates to the next page. In addition, it generates warnings about the server, if the current status of the server is not operational.

Specified by:
pageChanging in interface WizardPage
Overrides:
pageChanging in class GenericWizardPage
Parameters:
dialog - The wizard dialog that is invoking this method.
currPage - The logical (zero-based) index of the current page in the sequence of pages in the wizard.
nextPage - The logical (zero-based) index of the next page that is going to be displayed.
Returns:
This method always returns true to indicate that the user can navigate off from this page.

getMSTFile

protected java.lang.String getMSTFile()
Obtain the path to the MST file entered by the user.

Returns:
The path to the MST file entered by the user.

getSelectedServer

protected Server getSelectedServer()
Helper method to obtain selected server ID. This is a helper method that is used to look up the server based on its server ID string (rather than index position). The serverID string is obtained from the string representation of the server entry (assuming that the entry is in the form: serverName (ID: xxxx).

Returns:
The entry corresponding to the given selected server.

getSummary

protected java.lang.String getSummary(java.lang.String indent)
Obtain the name of the server that the user has selected.

Parameters:
indent - A simple indent string for indenting the data displayed by this server.
Returns:
This method is used to obtain the name of the server that the user has selected to run the job.

getPlatformConfiguration

protected int[] getPlatformConfiguration()
Obtain platform-specific job configuration information. This method must be used to obtain the platform specific job configuration information. This method converts the job information into an array and returns it. The returned array has the elements in the order: no. of. nodes, CPUs/node, total memory (in MB), and runTime (in hours).

Returns:
An array of 4 integers that contains the job information entered by the user. The order of the elements in the array is fixed.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Listener for CPUs and Nodes/CPU spinner input boxes to update memory.

This method is invoked whenever the user modifies the number of CPUs or nodes-per-CPU to be used for the job. This method updates the recommended amount of memory to be reserved for this job. The memory is computed using the formula:

Memory = (CPUs * NodesPerCPU * FASTAFileSize) + (CPUs * NodesPerCPU * 256MB)

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - The change event associated with this call back. Currently, this parameters is not used by this method.