Package adams.gui.core
Class DetachablePanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.core.DetachablePanel
-
- All Implemented Interfaces:
CleanUpHandler,PopupMenuProvider,ImageObserver,MenuContainer,Serializable,Accessible
- Direct Known Subclasses:
AbstractInvestigatorTab,AbstractOutputPanelWithPopupMenu,MultiPagePane.DetachablePage
public class DetachablePanel extends BasePanel implements PopupMenuProvider, CleanUpHandler
Ancestor for panels that can be detached in a frame and also reattached again.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 static StringDETACH_ICONprotected BaseButtonm_ButtonReattachthe button for reattaching.protected BasePanelm_ContentPanelthe content panel.protected BaseFramem_DetachedFramethe frame for detaching the component.protected Set<ChangeListener>m_DetachListenersthe detach listeners.protected Stringm_FrameTitlethe frame title to use.protected Pointm_LastFramePositionthe last position of the frame.protected Dimensionm_LastFrameSizethe last size of the frame.protected BasePanelm_PanelReattachthe panel with a "reattach" frame.protected PopupMenuCustomizer<DetachablePanel>m_PopupMenuCustomizerthe optional popup menu customizer.protected Set<ChangeListener>m_ReattachListenersthe reattach listeners.static StringREATTACH_ICON-
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 DetachablePanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDetachListener(ChangeListener l)Adds the listener for detach events.voidaddReattachListener(ChangeListener l)Adds the listener for reattach events.voidcleanUp()Cleans up data structures, frees up memory.voidclearDetachListeners()Removes all detach event listeners.voidclearReattachListeners()Removes all reattach event listeners.protected JPopupMenucreatePopupMenu()Creates and returns the popup menu.voiddetach()Detaches the content into a separate frame.BasePanelgetContentPanel()Returns the content panel where to add the other widgets.StringgetFrameTitle()Returns the frame title to use.JPopupMenugetPopupMenu()Returns the popup menu.PopupMenuCustomizer<DetachablePanel>getPopupMenuCustomizer()Returns the current popup customizer in use.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.booleanisDetached()Returns whether the content is currently detached and displayed in a frame.protected voidnotifyDetachListeners()Notifies all detach listeners.protected voidnotifyReattachListeners()Notifies all reattach listeners.voidreattach()Reattaches the content from a separate frame.voidremoveDetachListener(ChangeListener l)Removes the listener for detach events.voidremoveReattachListener(ChangeListener l)Removes the listener for reattach events.voidsetFrameTitle(String value)Sets the frame title to use.voidsetPopupMenuCustomizer(PopupMenuCustomizer<DetachablePanel> value)Sets the popup customizer to use.-
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
-
DETACH_ICON
public static final String DETACH_ICON
- See Also:
- Constant Field Values
-
REATTACH_ICON
public static final String REATTACH_ICON
- See Also:
- Constant Field Values
-
m_ContentPanel
protected BasePanel m_ContentPanel
the content panel.
-
m_PopupMenuCustomizer
protected PopupMenuCustomizer<DetachablePanel> m_PopupMenuCustomizer
the optional popup menu customizer.
-
m_DetachedFrame
protected BaseFrame m_DetachedFrame
the frame for detaching the component.
-
m_PanelReattach
protected BasePanel m_PanelReattach
the panel with a "reattach" frame.
-
m_ButtonReattach
protected BaseButton m_ButtonReattach
the button for reattaching.
-
m_FrameTitle
protected String m_FrameTitle
the frame title to use.
-
m_LastFrameSize
protected Dimension m_LastFrameSize
the last size of the frame.
-
m_LastFramePosition
protected Point m_LastFramePosition
the last position of the frame.
-
m_DetachListeners
protected Set<ChangeListener> m_DetachListeners
the detach listeners.
-
m_ReattachListeners
protected Set<ChangeListener> m_ReattachListeners
the reattach listeners.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBasePanel
-
getContentPanel
public BasePanel getContentPanel()
Returns the content panel where to add the other widgets.- Returns:
- the panel for the content
-
isDetached
public boolean isDetached()
Returns whether the content is currently detached and displayed in a frame.- Returns:
- true if detached
-
detach
public void detach()
Detaches the content into a separate frame.
-
reattach
public void reattach()
Reattaches the content from a separate frame.
-
setPopupMenuCustomizer
public void setPopupMenuCustomizer(PopupMenuCustomizer<DetachablePanel> value)
Sets the popup customizer to use.- Parameters:
value- the customizer, can be null
-
getPopupMenuCustomizer
public PopupMenuCustomizer<DetachablePanel> getPopupMenuCustomizer()
Returns the current popup customizer in use.- Returns:
- the customizer, null if none set
-
createPopupMenu
protected JPopupMenu createPopupMenu()
Creates and returns the popup menu.- Returns:
- the menu
-
getPopupMenu
public JPopupMenu getPopupMenu()
Returns the popup menu.- Specified by:
getPopupMenuin interfacePopupMenuProvider
-
setFrameTitle
public void setFrameTitle(String value)
Sets the frame title to use.- Parameters:
value- the title for the detached frame
-
getFrameTitle
public String getFrameTitle()
Returns the frame title to use.- Returns:
- the title fro the detached frame
-
addDetachListener
public void addDetachListener(ChangeListener l)
Adds the listener for detach events.- Parameters:
l- the listener to add
-
removeDetachListener
public void removeDetachListener(ChangeListener l)
Removes the listener for detach events.- Parameters:
l- the listener to remove
-
clearDetachListeners
public void clearDetachListeners()
Removes all detach event listeners.
-
notifyDetachListeners
protected void notifyDetachListeners()
Notifies all detach listeners.
-
addReattachListener
public void addReattachListener(ChangeListener l)
Adds the listener for reattach events.- Parameters:
l- the listener to add
-
removeReattachListener
public void removeReattachListener(ChangeListener l)
Removes the listener for reattach events.- Parameters:
l- the listener to remove
-
clearReattachListeners
public void clearReattachListeners()
Removes all reattach event listeners.
-
notifyReattachListeners
protected void notifyReattachListeners()
Notifies all reattach listeners.
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler
-
-