public class McvToolbarEditor extends java.lang.Object implements java.awt.event.ActionListener
Modifier and Type | Class and Description |
---|---|
private static class |
McvToolbarEditor.IconCellRenderer
Renders a toolbar action and its icon within the
TwoListPanel 's
JList s. |
private static class |
McvToolbarEditor.SpaceIcon
SpaceIcon is a class that represents a "space" entry
in the TwoListPanel that holds the current toolbar actions. |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
CMD_ADDSPACE
Add a "space" entry
|
private static java.lang.String |
CMD_EXPORTMENUPLUGIN
action command
|
private static java.lang.String |
CMD_EXPORTPLUGIN
action command
|
private static java.lang.String |
CMD_RELOAD
Action command for reloading the toolbar list with original items
|
private javax.swing.JComponent |
contents
All of the toolbar editor's GUI components.
|
protected static int |
ICON_SIZE
Size of the icons to be shown in the
TwoListPanel . |
private static java.lang.String |
MENU_PLUGINEXPORT |
private javax.swing.JComboBox |
menuIdBox
Used to export toolbars to plugin.
|
private javax.swing.JTextField |
menuNameFld
Used to export toolbars to plugin.
|
private javax.swing.JCheckBox |
menuOverwriteCbx
Used to export toolbars to plugin.
|
private static java.lang.String |
MSG_ENTER_NAME |
private static java.lang.String |
MSG_SELECT_ENTRIES |
(package private) ucar.unidata.xml.XmlResourceCollection |
resources
The toolbar XML resources.
|
private static java.lang.String |
SPACE
ID that represents a "space" in the toolbar.
|
private int |
spaceCount
Provides simple IDs for the space entries.
|
private static java.lang.String |
TT_EXPORT_SELECT |
private static java.lang.String |
TT_EXPORT_SELECTMENU |
private static java.lang.String |
TT_OVERWRITE |
private ucar.unidata.ui.TwoListPanel |
twoListPanel
The GUI component that stores both available and selected actions.
|
private UIManager |
uiManager
Used to notify the application that a toolbar update should occur.
|
Constructor and Description |
---|
McvToolbarEditor(UIManager mngr)
Builds a toolbar editor and associates it with the
UIManager . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
Handles events such as exporting plugins, reloading contents, and adding
spaces.
|
boolean |
anyChanges()
Has
twoListPanel been changed? |
void |
doApply()
Writes out the toolbar xml.
|
private void |
doExport(java.util.List<java.lang.Object> tfos)
Export the actions
|
private void |
doExportToMenu(java.util.List<java.lang.Object> tfos)
Export the selected actions as a menu to the plugin manager.
|
protected javax.swing.Icon |
getActionIcon(java.lang.String actionId)
Returns the icon associated with
actionId . |
private java.util.List<ucar.unidata.util.TwoFacedObject> |
getAllActions()
Returns a
List of TwoFacedObject s containing all of the
actions known to McIDAS-V. |
javax.swing.JComponent |
getContents()
Returns the
JComponent that contains all of the toolbar editor's
UI components. |
private java.util.List<ucar.unidata.util.TwoFacedObject> |
getCurrentToolbar() |
ucar.unidata.ui.TwoListPanel |
getTLP()
Returns the
TwoListPanel being used to store the lists of
available and selected actions. |
private void |
init()
Initializes the editor window contents.
|
static boolean |
isSpace(ucar.unidata.util.TwoFacedObject tfo)
Determines if a given toolbar entry (in the form of a
TwoFacedObject ) represents a space. |
private java.util.List<ucar.unidata.util.TwoFacedObject> |
sortTwoFaced(java.util.List<ucar.unidata.util.TwoFacedObject> objs)
Sorts a
List of
TwoFacedObjects by label. |
protected static final int ICON_SIZE
TwoListPanel
.private static final java.lang.String MENU_PLUGINEXPORT
private static final java.lang.String MSG_ENTER_NAME
private static final java.lang.String MSG_SELECT_ENTRIES
private static final java.lang.String CMD_ADDSPACE
private static final java.lang.String CMD_RELOAD
private static final java.lang.String CMD_EXPORTPLUGIN
private static final java.lang.String CMD_EXPORTMENUPLUGIN
private static final java.lang.String TT_EXPORT_SELECT
private static final java.lang.String TT_EXPORT_SELECTMENU
private static final java.lang.String TT_OVERWRITE
private static final java.lang.String SPACE
private int spaceCount
private UIManager uiManager
private javax.swing.JComponent contents
private ucar.unidata.ui.TwoListPanel twoListPanel
ucar.unidata.xml.XmlResourceCollection resources
private javax.swing.JTextField menuNameFld
private javax.swing.JComboBox menuIdBox
private javax.swing.JCheckBox menuOverwriteCbx
public McvToolbarEditor(UIManager mngr)
UIManager
.mngr
- The application's UI Manager.protected javax.swing.Icon getActionIcon(java.lang.String actionId)
actionId
.public static boolean isSpace(ucar.unidata.util.TwoFacedObject tfo)
TwoFacedObject
) represents a space.tfo
- The entry to test.private java.util.List<ucar.unidata.util.TwoFacedObject> getCurrentToolbar()
private java.util.List<ucar.unidata.util.TwoFacedObject> getAllActions()
List
of TwoFacedObject
s containing all of the
actions known to McIDAS-V.public ucar.unidata.ui.TwoListPanel getTLP()
TwoListPanel
being used to store the lists of
available and selected actions.public javax.swing.JComponent getContents()
JComponent
that contains all of the toolbar editor's
UI components.private void init()
private void doExportToMenu(java.util.List<java.lang.Object> tfos)
tfos
- selected actionsprivate void doExport(java.util.List<java.lang.Object> tfos)
tfos
- the actionspublic void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
ae
- The event that invoked this method.public boolean anyChanges()
twoListPanel
been changed?true
if there have been changes, false
otherwise.public void doApply()
private java.util.List<ucar.unidata.util.TwoFacedObject> sortTwoFaced(java.util.List<ucar.unidata.util.TwoFacedObject> objs)
Sorts a List
of
TwoFacedObjects
by label. Case is ignored.
objs
- The list that needs some sortin' out.objs
.