|
||||||||||
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.HelpMenuHelper
public class HelpMenuHelper
The help menu helper for the application. This class encapsulates the code related to the operations performed by various menu items in the "Help" 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 HelpMenuHelper is essentially an event handler that is set on the various menu items in this class. This helper class also provides a createHelpMenu() method that actually creates the "Help" 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 |
ABOUT_ERROR
This message is displayed when the default system browser could not be launched to display help. |
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 title 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 | |
---|---|
HelpMenuHelper(MainFrame mainFrame)
The constructor. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
|
javax.swing.JMenu |
createHelpMenu(javax.swing.JToolBar toolbar)
Helper method to create the help 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. |
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
private static final java.lang.String ABOUT_ERROR
Constructor Detail |
---|
public HelpMenuHelper(MainFrame mainFrame)
mainFrame
- The main frame that logically owns the "Help" menu in its
top-level menu bar. This reference is saved in this class for future use.Method Detail |
---|
public javax.swing.JMenu createHelpMenu(javax.swing.JToolBar toolbar)
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.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
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 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 |