|
||||||||||
| 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.FileMenuHelper
public class FileMenuHelper
The file menu helper for the application. This class encapsulates the code related to the operations performed by various menu items in the "File" 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 FileMenuHelper is essentially an event handler that is set on the various menu items in this class. This helper class also provides a createFileMenu() method that actually creates the file menu.
Note: This class adds a WindowAdapter so that it can intercept and process window closing event. This window closing event is generated either when the user clicks the close button (typically at the top-right corner) or chooses the "Quit" option.
| 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[] |
ActionCmds
The strings for the action commands generated by the various menu items in the help menu. |
private static java.lang.String[] |
IconNames
The icon file names for each menu item created by this helper. |
private static java.lang.String[] |
MenuSubTitles
The various sub menu titles that are used in the main menu. |
private static java.lang.String[] |
MenuTitles
The strings for each menu title created by this helper. |
| Fields inherited from class org.peace_tools.core.AbstractMenuHelper |
|---|
contextItemList, mainFrame, table, tree |
| Constructor Summary | |
|---|---|
FileMenuHelper(MainFrame mainFrame)
The constructor. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
|
javax.swing.JMenu |
createFileMenu(javax.swing.JToolBar toolbar,
AbstractMenuHelper jobHelper)
Helper method to create the file 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. |
private boolean |
reallyQuit()
Double check before exiting. |
| 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 static final java.lang.String[] MenuTitles
private static final java.lang.String[] IconNames
private static final java.lang.String[] ActionCmds
private static final java.lang.String[] MenuSubTitles
| Constructor Detail |
|---|
public FileMenuHelper(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 createFileMenu(javax.swing.JToolBar toolbar,
AbstractMenuHelper jobHelper)
toolbar - The toolbar to which frequently used shortcuts can
be added typically in the form of icons. If the toolbar is null, then
shortcuts are not added.jobHelper - The job menu helper that must be used to add job
creation entries to the new menu in the "File" menu.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed in interface java.awt.event.ActionListenerpublic java.awt.event.ActionListener getActionListener()
AbstractMenuHelper
getActionListener in class AbstractMenuHelperpublic javax.swing.event.ListSelectionListener getListSelectionListener(javax.swing.JTable table)
AbstractMenuHelperNote: The list selection listeners handle only single selection model for the table.
getListSelectionListener in class AbstractMenuHelpertable - 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 javax.swing.JMenuItem getMenuItem(AbstractMenuHelper.ActionType actionType,
boolean mainMenu)
AbstractMenuHelperNote: 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 AbstractMenuHelperactionType - 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)
AbstractMenuHelperNote: 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 AbstractMenuHelperactionType - 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 AbstractMenuHelpertree - 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.
private boolean reallyQuit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||