Package com.actelion.research.gui.dock
Class Dockable
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- com.actelion.research.gui.dock.Dockable
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
public class Dockable extends javax.swing.JPanel
A lightweight component derived from JPanel that features certain subcomponents that make it look similar to a frame or internal frame. It shows a titlebar above its content component. The title bar has an optional icon on the left, a title text and an optional toolbar on the right.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description Dockable(JDockingPanel dockingPanel, javax.swing.JComponent content, java.lang.String title, java.awt.event.ActionListener al, boolean isClosable)
Constructs aTitledComponent
with the specified title and content panel.Dockable(JDockingPanel dockingPanel, javax.swing.JComponent content, java.lang.String title, java.awt.event.ActionListener al, boolean isClosable, boolean hasMenuButton)
Constructs aTitledComponent
with the specified title and content panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JComponent
borrowContent()
Removes the content temporarily to be added to another container Must be followed later by a endBorrowContent() call.void
endBorrowContent()
Returns the content from temporarily adding it to another copntainer.javax.swing.JComponent
getContent()
Returns the content - null, if none has been set.java.awt.Component
getDragHandle()
PopupProvider
getPopupProvider()
java.lang.String
getTitle()
Returns the title of dockable header.boolean
hasMenuButton()
boolean
isMaximized()
boolean
isSelected()
Answers if the panel is currently selected, i.e.boolean
isVisibleDockable()
Answers if the panel is currently visible, i.e.protected void
notifyVisibility(boolean isVisible)
Method used by the JDockingPanel to inform the dockable when its visibility changes.void
setContentMinimumSize(java.awt.Dimension size)
Sets the minimum size of the encapsulated content component and sets the minimum width of the dockable header.void
setPopupProvider(PopupProvider p)
void
setSelected(boolean selected)
This panel draws its title bar differently if it is selected, which may be used to indicate to the user that this panel has the focus, or should get more attention than other simple internal frames.void
setTitle(java.lang.String newText)
Sets a new title text of the dockable header.void
updateUI()
Updates the UI.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
-
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, setVisible, 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
-
-
-
-
Constructor Detail
-
Dockable
public Dockable(JDockingPanel dockingPanel, javax.swing.JComponent content, java.lang.String title, java.awt.event.ActionListener al, boolean isClosable)
Constructs aTitledComponent
with the specified title and content panel.- Parameters:
content
-title
- the initial title, which must be unique within the JDockingPanelal
- the ActionListener to receive close_and max_ action commands isClosable
- determines whether the title area contains a close button
-
Dockable
public Dockable(JDockingPanel dockingPanel, javax.swing.JComponent content, java.lang.String title, java.awt.event.ActionListener al, boolean isClosable, boolean hasMenuButton)
Constructs aTitledComponent
with the specified title and content panel.- Parameters:
content
-title
- the initial title, which must be unique within the JDockingPanelal
- the ActionListener to receive close_title, max_title and popup_title action eventsisClosable
- determines whether the title area contains a close buttonhasMenuButton
- determines whether the title area contains a pupup button
-
-
Method Detail
-
setContentMinimumSize
public void setContentMinimumSize(java.awt.Dimension size)
Sets the minimum size of the encapsulated content component and sets the minimum width of the dockable header. This effectively limits the minimum size of the content component.
-
getTitle
public java.lang.String getTitle()
Returns the title of dockable header.- Returns:
- String the current title text
-
setTitle
public void setTitle(java.lang.String newText)
Sets a new title text of the dockable header.- Parameters:
newText
- the title text to be set
-
borrowContent
public javax.swing.JComponent borrowContent()
Removes the content temporarily to be added to another container Must be followed later by a endBorrowContent() call.- Returns:
- the current content
-
endBorrowContent
public void endBorrowContent()
Returns the content from temporarily adding it to another copntainer. Must be followed later by a returnContent() call.
-
getContent
public javax.swing.JComponent getContent()
Returns the content - null, if none has been set.- Returns:
- the current content
-
isSelected
public boolean isSelected()
Answers if the panel is currently selected, i.e. the active one. In the selected state, the header background is rendered differently.- Returns:
- boolean
-
isMaximized
public boolean isMaximized()
-
notifyVisibility
protected void notifyVisibility(boolean isVisible)
Method used by the JDockingPanel to inform the dockable when its visibility changes.- Parameters:
isVisible
- new visibility
-
isVisibleDockable
public boolean isVisibleDockable()
Answers if the panel is currently visible, i.e. docked and not hidden by other dockables in a tabbed pane.- Returns:
- boolean
-
setSelected
public void setSelected(boolean selected)
This panel draws its title bar differently if it is selected, which may be used to indicate to the user that this panel has the focus, or should get more attention than other simple internal frames.- Parameters:
selected
- a boolean, where true means the frame is selected (currently active) and false means it is not
-
updateUI
public void updateUI()
Updates the UI. In addition to the superclass behavior, we need to update the header component.- Overrides:
updateUI
in classjavax.swing.JPanel
-
getDragHandle
public java.awt.Component getDragHandle()
-
getPopupProvider
public PopupProvider getPopupProvider()
-
setPopupProvider
public void setPopupProvider(PopupProvider p)
-
hasMenuButton
public boolean hasMenuButton()
-
-