Package adams.gui.tools
Class FavoritesManagementPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.tools.FavoritesManagementPanel
-
- All Implemented Interfaces:
MenuBarProvider
,ImageObserver
,MenuContainer
,Serializable
,Accessible
public class FavoritesManagementPanel extends BasePanel implements MenuBarProvider
A panel for managing one's GOE favorites.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FavoritesManagementPanel.AbstractFavoritesListModel
Abstract List model class for displaying favorites.static class
FavoritesManagementPanel.FavoritesListModel
A list model for displaying the favorites of a specific superclass.static class
FavoritesManagementPanel.SuperclassListModel
Table model class for displaying the superclasses.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseButton
m_ButtonFavoriteAdd
the button for adding a favorite.protected BaseButton
m_ButtonFavoriteEdit
the button for editing a favorite.protected BaseButton
m_ButtonFavoriteRemove
the button for removing a favorite.protected BaseButton
m_ButtonFavoriteRemoveAll
the button for removing all favorites.protected BaseButton
m_ButtonFavoriteRename
the button for renaming a favorite.protected BaseButton
m_ButtonSuperclassAdd
the button for adding a superclass.protected BaseButton
m_ButtonSuperclassRemove
the button for removing a superclass.protected BaseButton
m_ButtonSuperclassRemoveAll
the button for removing all superclasses.protected Favorites
m_Favorites
the favorites in use.protected GenericArrayEditorDialog
m_GAEDialog
the generic array editor for manipulating the favorites.protected GenericObjectEditorDialog
m_GOEDialog
the generic object editor for manipulating the favorites.protected FavoritesManagementPanel.FavoritesListModel
m_ListModelFavorites
the list model for the superclasses.protected FavoritesManagementPanel.SuperclassListModel
m_ListModelSuperclass
the list model for the superclasses.protected JMenuBar
m_MenuBar
the menu bar, if used.protected JMenuItem
m_MenuItemClose
the "close" menu item.protected JMenuItem
m_MenuItemRevert
the "revert" menu item.protected JMenuItem
m_MenuItemSave
the "save" menu item.protected BaseListWithButtons
m_PanelFavorites
the panel for the favorites.protected BaseListWithButtons
m_PanelSuperclasses
the panel for the superclasses.static String
SEPARATOR
the separator between name and commandline of favorite.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description FavoritesManagementPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addFavorite(Class cls, boolean array)
Pops up dialog for adding a new favorite.protected void
addSuperclass()
Adds a new superclass for favorites.protected boolean
checkForModified()
Returns whether we can proceed with the operation or not, depending on whether the user saved the placeholders or discarded the changes.protected void
close()
Closes the dialog or frame.protected void
editFavorite(Class cls, boolean array, String entry)
Pops up a dialog for editing a favorite.protected GenericArrayEditorDialog
getGAEEditor()
Returns the GAE editor dialog to use.protected GenericObjectEditorDialog
getGOEEditor()
Returns the GOE editor dialog to use.JMenuBar
getMenuBar()
Creates a menu bar (singleton per panel object).protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.protected void
renameFavorite(Class cls, boolean array, String entry)
Pops up a dialog for renaming a favorite.protected void
revert()
Reverts the changes.protected void
save()
Saves the current favorites.protected void
update()
Updates menu, buttons and title.protected void
updateButtons()
Updates the state of the buttons.protected void
updateMenu()
updates the enabled state of the menu items.protected void
updateTitle()
Updates the title of the dialog.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
the separator between name and commandline of favorite.- See Also:
- Constant Field Values
-
m_Favorites
protected Favorites m_Favorites
the favorites in use.
-
m_MenuBar
protected JMenuBar m_MenuBar
the menu bar, if used.
-
m_MenuItemSave
protected JMenuItem m_MenuItemSave
the "save" menu item.
-
m_MenuItemRevert
protected JMenuItem m_MenuItemRevert
the "revert" menu item.
-
m_MenuItemClose
protected JMenuItem m_MenuItemClose
the "close" menu item.
-
m_PanelSuperclasses
protected BaseListWithButtons m_PanelSuperclasses
the panel for the superclasses.
-
m_ButtonSuperclassAdd
protected BaseButton m_ButtonSuperclassAdd
the button for adding a superclass.
-
m_ButtonSuperclassRemove
protected BaseButton m_ButtonSuperclassRemove
the button for removing a superclass.
-
m_ButtonSuperclassRemoveAll
protected BaseButton m_ButtonSuperclassRemoveAll
the button for removing all superclasses.
-
m_PanelFavorites
protected BaseListWithButtons m_PanelFavorites
the panel for the favorites.
-
m_ButtonFavoriteAdd
protected BaseButton m_ButtonFavoriteAdd
the button for adding a favorite.
-
m_ButtonFavoriteEdit
protected BaseButton m_ButtonFavoriteEdit
the button for editing a favorite.
-
m_ButtonFavoriteRename
protected BaseButton m_ButtonFavoriteRename
the button for renaming a favorite.
-
m_ButtonFavoriteRemove
protected BaseButton m_ButtonFavoriteRemove
the button for removing a favorite.
-
m_ButtonFavoriteRemoveAll
protected BaseButton m_ButtonFavoriteRemoveAll
the button for removing all favorites.
-
m_ListModelSuperclass
protected FavoritesManagementPanel.SuperclassListModel m_ListModelSuperclass
the list model for the superclasses.
-
m_ListModelFavorites
protected FavoritesManagementPanel.FavoritesListModel m_ListModelFavorites
the list model for the superclasses.
-
m_GOEDialog
protected GenericObjectEditorDialog m_GOEDialog
the generic object editor for manipulating the favorites.
-
m_GAEDialog
protected GenericArrayEditorDialog m_GAEDialog
the generic array editor for manipulating the favorites.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
getGOEEditor
protected GenericObjectEditorDialog getGOEEditor()
Returns the GOE editor dialog to use.- Returns:
- the dialog
-
getGAEEditor
protected GenericArrayEditorDialog getGAEEditor()
Returns the GAE editor dialog to use.- Returns:
- the dialog
-
addSuperclass
protected void addSuperclass()
Adds a new superclass for favorites. Automatically pops up dialog for adding a favorite.
-
addFavorite
protected void addFavorite(Class cls, boolean array)
Pops up dialog for adding a new favorite.- Parameters:
cls
- the superclass the favorite is forarray
- whether this for an array
-
editFavorite
protected void editFavorite(Class cls, boolean array, String entry)
Pops up a dialog for editing a favorite.- Parameters:
cls
- the superclass of the favoritearray
- whether this for an arrayentry
- the entry in the list
-
renameFavorite
protected void renameFavorite(Class cls, boolean array, String entry)
Pops up a dialog for renaming a favorite.- Parameters:
cls
- the superclass of the favoritearray
- whether for an arrayentry
- the entry in the list
-
getMenuBar
public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.- Specified by:
getMenuBar
in interfaceMenuBarProvider
- Returns:
- the menu bar
-
updateTitle
protected void updateTitle()
Updates the title of the dialog.
-
updateMenu
protected void updateMenu()
updates the enabled state of the menu items.
-
updateButtons
protected void updateButtons()
Updates the state of the buttons.
-
update
protected void update()
Updates menu, buttons and title.
-
checkForModified
protected boolean checkForModified()
Returns whether we can proceed with the operation or not, depending on whether the user saved the placeholders or discarded the changes. In case of custom placeholdersm the use will never get asked.- Returns:
- true if safe to proceed
-
save
protected void save()
Saves the current favorites.
-
revert
protected void revert()
Reverts the changes.
-
close
protected void close()
Closes the dialog or frame.
-
-