|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.core.AbstractMenuHelper
org.peace_tools.core.JobMenuHelper
public class JobMenuHelper
The file menu helper for the application. This class encapsulates the code related to the operations performed by various menu items in the "Job" menu. This class is typically created once from the MainFrame.createMenus() method. The primary motivation for introducing sub-menu handler classes is to improve code organization and minimize code clutter. Note that the JobMenuHelper is essentially an event handler that is set on the various menu items in this class. This helper class also provides a createJobMenu() method that actually creates the file menu.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.peace_tools.core.AbstractMenuHelper |
---|
AbstractMenuHelper.ActionType, AbstractMenuHelper.HelperType |
Field Summary | |
---|---|
private static java.lang.String |
CANT_ABORT_JOB
An error message that is formatted (to fill-in missing information) and displayed to the user if aborting a job fails. |
private static java.lang.String |
CANT_FIND_SERVER
An error message that is formatted (to fill-in missing information) and displayed to the user when a server entry could not be successfully located to abort a job. |
private Job |
job
The currently selected job entry (if any). |
private static java.lang.String[] |
MenuSubTitles
The various sub menu titles that are used in the main menu. |
private static java.lang.String |
SESSION_PURPOSE
An error message that is formatted (to fill-in missing information) and displayed to the user as the reason for making a remote server connection. |
private static java.lang.String |
SUCCESS_MSG
A success message that is formatted (to fill-in missing information) and displayed to the user indicating that the job was aborted. |
private static java.lang.String |
SURE_ABORT_JOB
An verification message that is formatted (to fill-in missing information) and displayed to the user just before a job is aborted on a server. |
Fields inherited from class org.peace_tools.core.AbstractMenuHelper |
---|
contextItemList, mainFrame, table, tree |
Constructor Summary | |
---|---|
JobMenuHelper(MainFrame mainFrame)
The constructor. |
Method Summary | |
---|---|
void |
abortJob(Job job)
Method to abort a job running on a server. |
void |
actionPerformed(java.awt.event.ActionEvent event)
|
javax.swing.JMenu |
createJobMenu(javax.swing.JToolBar toolbar,
AbstractMenuHelper vmh)
Helper method to create the job menu. |
java.awt.event.ActionListener |
getActionListener()
The action listener to handle actions created by this menu helper. |
javax.swing.event.ListSelectionListener |
getListSelectionListener(javax.swing.JTable table)
The listener to be used in JTable to update tools & menu items. |
javax.swing.JMenuItem |
getMenuItem(AbstractMenuHelper.ActionType actionType,
boolean mainMenu)
Obtain a main menu item for the given action type. |
javax.swing.AbstractButton |
getTool(AbstractMenuHelper.ActionType actionType,
boolean mainToolBar)
Obtain a tool bar button for the given action type. |
javax.swing.event.TreeSelectionListener |
getTreeSelectionListener(javax.swing.JTree tree)
The listener to be used in JTree to update tools & menu items. |
void |
valueChanged(javax.swing.event.ListSelectionEvent event)
The selection listener/handler for a table. |
Methods inherited from class org.peace_tools.core.AbstractMenuHelper |
---|
getHelperType, setEnabled, tableChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Job job
private static final java.lang.String[] MenuSubTitles
private static final java.lang.String CANT_FIND_SERVER
private static final java.lang.String SURE_ABORT_JOB
private static final java.lang.String CANT_ABORT_JOB
private static final java.lang.String SESSION_PURPOSE
private static final java.lang.String SUCCESS_MSG
Constructor Detail |
---|
public JobMenuHelper(MainFrame mainFrame)
mainFrame
- The main frame that logically owns the "File" menu in its
top-level menu bar. This reference is saved in this class for future use.Method Detail |
---|
public javax.swing.JMenu createJobMenu(javax.swing.JToolBar toolbar, AbstractMenuHelper vmh)
toolbar
- The tool bar to which frequently used shortcuts can
be added typically in the form of icons. If the tool bar is null, then
shortcuts are not added.vmh
- The view menu helper associated with the main frame. This
entry is used to create menu entry for viewing the "Jobs" tab.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
public void abortJob(Job job)
job
- The job to be aborted. This entry cannot be null.public java.awt.event.ActionListener getActionListener()
AbstractMenuHelper
getActionListener
in class AbstractMenuHelper
public javax.swing.event.ListSelectionListener getListSelectionListener(javax.swing.JTable table)
AbstractMenuHelper
Note: The list selection listeners handle only single selection model for the table.
getListSelectionListener
in class AbstractMenuHelper
table
- The JTable to which the list selection listener is
going to be added. This reference is maintained by the menu
helper to handle row selection events.
public void valueChanged(javax.swing.event.ListSelectionEvent event)
Note: Currently we only handle JTable and not JList.
valueChanged
in interface javax.swing.event.ListSelectionListener
event
- The selection event associated with this method.
This event is not really used for any major information. So
it can be null.public javax.swing.JMenuItem getMenuItem(AbstractMenuHelper.ActionType actionType, boolean mainMenu)
AbstractMenuHelper
Note: The returned menu item has all the necessary information already filled-in. Do not modify the action command and other properties as it will interfere with correct operation of the menu item.
getMenuItem
in class AbstractMenuHelper
actionType
- The action type for which a main menu item
is to be created.mainMenu
- If this flag is true, then it indicates that
the menu should be created to be used in the main menu. Otherwise
it is assumed that the menu item will be used in a context
sensitive popup menu.
public javax.swing.AbstractButton getTool(AbstractMenuHelper.ActionType actionType, boolean mainToolBar)
AbstractMenuHelper
Note: The returned button has all the necessary information already filled-in. Do not modify the action command and other properties as it will interfere with correct operation of the too bar button.
getTool
in class AbstractMenuHelper
actionType
- The action type for which a tool bar button
is to be created.mainToolBar
- If this flag is true, then it indicates that
the tool will be used in the main tool bar in PEACE. Otherwise
it is is assumed that the tool will be used in a view specific
tool bar.
public javax.swing.event.TreeSelectionListener getTreeSelectionListener(javax.swing.JTree tree)
AbstractMenuHelper
getTreeSelectionListener
in class AbstractMenuHelper
tree
- The JTree to which the tree selection listener is
going to be added. This reference is maintained by the menu
helper to handle tree selection events.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |