Class DefaultDockingPort
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.flexdock.docking.defaults.DefaultDockingPort
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,DockingConstants
,DockingPort
,DockingListener
,DockingMonitor
- Direct Known Subclasses:
FloatingDockingPort
,Viewport
public class DefaultDockingPort extends javax.swing.JPanel implements DockingPort, DockingConstants
This is aContainer
that implements theDockingPort
interface. It provides a default implementation ofDockingPort
to allow ease of development within docking-enabled applications.The
DefaultDockingPort
handles docking in one of three ways. If the port is empty, then all incomingDockables
are docked to the CENTER region. If the port is not empty, then all incomingDockables
docked to the CENTER region are embedded within aJTabbedPane
. All incomingDockables
docked to an outer region (NORTH, SOUTH, EAST, and WEST) of a non-empty port are placed into a split layout using aJSplitPane
.For centrally docked
Components
, the immediate child of theDefaultDockingPort
may or may not be aJTabbedPane
. IfisSingleTabAllowed()
returnstrue
for the currentDefaultDockingPort
, then the immediate child returned bygetDockedComponent()
will return aJTabbedPane
instance even if there is only oneDockable
embedded within the port. If there is a singleDockable
in the port, butisSingleTabAllowed()
returnsfalse
, thengetDockedComponent()
will return theComponent
that backs the currently dockedDockable
, returned by theDockable's
getComponent()
method.isSingleTabAllowed()
is a scoped property that may apply to this port, all ports across the JVM, or all ports within a user defined scope.getDockedComponent()
will return aJTabbedPane
at all times if there is more than one centrally dockedDockable
within the port, and all dockedComponents
will reside within the tabbed pane.Components that are docked in the NORTH, SOUTH, EAST, or WEST regions are placed in a
JSplitPane
splitting the layout of theDockingPort
between child components. Each region of theJSplitPane
contains a newDefaultDockingPort
, which, in turn, contains the docked components. In this situation,getDockedComponent()
will return aJSplitPane
reference.A key concept that drives the
DefaultDockingPort
, then, is the notion that thisDockingPort
implementation may only ever have one single child component, which may or may not be a wrapper for other child components. BecauseJSplitPane
contains childDefaultDockingPorts
, each of thoseDefaultDockingPorts
is available for further sub-docking operations.Since a
DefaultDockingPort
may only contain one child component, there is a container hierarchy to manage tabbed interfaces, split layouts, and sub-docking. As components are removed from this hierarchy, the hierarchy itself must be reevaluated. Removing a component from a childDefaultDockingPort
within aJSplitPane
renders the childDefaultDockingPort
unnecessary, which, in turn, renders the notion of splitting the layout with aJSplitPane
unnecessary (since there are no longer two components to split the layout between). Likewise, removing a child component from aJTabbedPane
such that there is only one child left within theJTabbedPane
removes the need for a tabbed interface to begin with.When the
DockingManager
removes a component from aDockingPort
viaDockingManager.undock(Dockable dockable)
it uses a call toundock()
on the currentDockingPort
.undock()
automatically handles the reevaluation of the container hierarchy to keep wrapper-container usage at a minimum. SinceDockingManager
makes this callback automatic, developers normally will not need to call this method explicitly. However, when removing a component from aDefaultDockingPort
using application code, developers should keep in mind to useundock()
instead ofremove()
. Border management after docking and undocking operations are accomplished using aBorderManager
.setBorderManager()
may be used to set the border manager instance and customize border management.- Author:
- Christopher Butler
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultDockingPort.PortLayout
-
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
-
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from interface org.flexdock.docking.event.DockingListener
DockingListener.Stub
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList
dockingListeners
-
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 org.flexdock.docking.DockingConstants
ACTIVE_WINDOW, BOTTOM, CENTER, CENTER_REGION, CLOSE_ACTION, DEFAULT_PERSISTENCE_KEY, DOCKING_ID, EAST_REGION, HEAVYWEIGHT_DOCKABLES, HORIZONTAL, LEFT, MOUSE_PRESSED, NORTH_REGION, PERMANENT_FOCUS_OWNER, PIN_ACTION, REGION, RIGHT, SOUTH_REGION, TOP, UNINITIALIZED, UNINITIALIZED_RATIO, UNKNOWN_REGION, UNSPECIFIED_SIBLING_PREF, VERTICAL, WEST_REGION
-
Fields inherited from interface org.flexdock.docking.DockingPort
INITIAL_TAB_POSITION
-
-
Constructor Summary
Constructors Constructor Description DefaultDockingPort()
Creates a newDefaultDockingPort
with a persistent ID equal to theString
value of this a random UUID.DefaultDockingPort(java.lang.String id)
Creates a newDefaultDockingPort
with the specified persistent ID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Component
add(java.awt.Component comp)
Overridden to set the currently docked component.java.awt.Component
add(java.awt.Component comp, int index)
Overridden to set the currently docked component.void
add(java.awt.Component comp, java.lang.Object constraints)
Overridden to set the currently docked component.void
add(java.awt.Component comp, java.lang.Object constraints, int index)
Overridden to set the currently docked component.java.awt.Component
add(java.lang.String name, java.awt.Component comp)
Overridden to set the currently docked component.void
addDockingListener(DockingListener listener)
Adds aDockingListener
to observe docking events for thisDockingPort
.void
clear()
Removes allDockables
from thisDockingPort
.protected BorderManager
createBorderManager()
Creates a standard border manager for this docking port.protected java.awt.LayoutManager
createLayout()
protected javax.swing.JTabbedPane
createTabbedPane()
If this method returnsnull
, implementations may throw NullPointerExceptions.boolean
dock(java.awt.Component comp, java.lang.String region)
Docks the specified component within the specified region.boolean
dock(Dockable dockable, java.lang.String region)
Docks the specifiedDockable
within the specified region.void
dockingCanceled(DockingEvent evt)
No operation.void
dockingComplete(DockingEvent evt)
Requests activation for the newly docked Dockable.void
dragStarted(DockingEvent evt)
No operation.void
dropStarted(DockingEvent evt)
No operation.LayoutNode
exportLayout()
Returns aLayoutNode
containing metadata that describes the current layout contained within thisDefaultDockingPort
.BorderManager
getBorderManager()
Returns the currently intalledBorderManager
.protected Dockable
getCenterDockable()
java.awt.Component
getComponent(java.lang.String region)
Returns theComponent
currently docked within the specifiedregion
.Dockable
getDockable(java.lang.String region)
Returns theDockable
currently docked within the specifiedregion
.Dockable
getDockableAt(java.awt.Point location)
Returns the direct childDockable
located at the specifiedPoint
.java.util.Set
getDockables()
Returns allDockables
docked within thisDockingPort
and all sub-DockingPorts
.protected java.util.Set
getDockableSet(int depth, int level, java.lang.Class desiredClass)
java.awt.Component
getDockedComponent()
Returns the childComponent
currently embedded within withDockingPort
.DockingListener[]
getDockingListeners()
Returns an array of allDockingListeners
added to thisDockingPort
.DockingPortPropertySet
getDockingProperties()
Returns aDockingPortPropertySet
instance associated with thisDockingPort
.DockingStrategy
getDockingStrategy()
Returns theDockingStrategy
used by thisDockingPort
.protected int
getInitTabPlacement()
java.lang.String
getPersistentId()
Returns aString
identifier that is unique toDockingPorts
within a JVM instance, but persistent across JVM instances.java.lang.String
getRegion(java.awt.Point location)
Returns the docking region within thisDockingPort
that contains the specifiedPoint
.RegionChecker
getRegionChecker()
Returns theRegionChecker
currently used by thisDockingPort
.void
importLayout(LayoutNode node)
Clears out the existing layout within thisDockingPort
and reconstructs a new layout based upon the specifiedLayoutNode
.void
installMaximizedDockable(Dockable dockable)
Asks thisDockingPort
to temporarily install the specifiedDockable
and maximize its component.boolean
isDockingAllowed(java.awt.Component comp, java.lang.String region)
Returnstrue
if docking is allowed for the specifiedComponent
within the suppliedregion
,false
otherwise.boolean
isParentDockingPort(java.awt.Component comp)
Indicates whether or not the specified component is docked somewhere within thisDefaultDockingPort
.boolean
isRoot()
Returns a boolean indicating whether or not thisDockingPort
is nested within anotherDockingPort
.boolean
isSingleTabAllowed()
Returnstrue
if single tabs are allowed within thisDockingPort
,false
otherwise.boolean
isTabsAsDragSource()
Returnstrue
if drag-to-dock support is enabled for tabs and their associatedDockables
,false
otherwise.protected boolean
isValidDockableChild(java.awt.Component c, java.lang.Class desiredClass)
protected boolean
isValidDockingRegion(java.lang.String region)
void
paint(java.awt.Graphics g)
Overridden to provide enhancements during drag operations.void
releaseForMaximization(Dockable dockable)
Asks thisDockingPort
to temporarily release its childDockable
for use by anotherDockingPort
to achieve maximization.void
remove(int index)
Overridden to decorate superclass method, keeping track of internal docked-component reference.void
removeAll()
Overridden to decorate superclass method, keeping track of internal docked-component reference.void
removeDockingListener(DockingListener listener)
Removes the specifiedDockingListener
from thisDockingPort
.void
returnFromMaximization()
Notifies thisDockingPort
that theDockable
previously released for maximization via a call toDockingPort.releaseForMaximization(Dockable)
is now ready to be returned to its original state inside thisDockingPort
.void
setBorderManager(BorderManager mgr)
Sets the currently installedBorderManager
.void
setDragInProgress(boolean inProgress)
This method is used internally by the framework to notifyDefaultDockingPorts
whether a drag operation is or is not currently in progress and should not be called by application-level developers.void
setPersistentId(java.lang.String id)
Sets the persisent ID to be used for thisDockingPort
.void
setRoot(boolean root)
This method is used internally by the framework to notifyDefaultDockingPorts
whether they are "root"DockingPorts
according to the rules specified byisRoot()
on theDockingPort
interface.void
setSingleTabAllowed(boolean allowed)
Sets the "single tab" property for thisDockingPort
, allowing or disallowing a singleDockable
within theDockingPort
to appear within a tabbed layout.void
setTabsAsDragSource(boolean enabled)
Enables or disables drag support for docking operations on the tabs used within an embedded tabbed layout.boolean
undock(java.awt.Component comp)
Undocks the specifiedComponent
and returns a boolean indicating the success of the operation.void
undockingComplete(DockingEvent evt)
No operation.void
undockingStarted(DockingEvent evt)
No operation.void
uninstallMaximizedDockable()
Notifies thisDockingPort
that theDockable
previously installed for maximization via a call toDockingPort.installMaximizedDockable(Dockable)
should now be returned to its originalDockingPort
and that thisDockingPort
should return to its original state from before the call toDockingPort.installMaximizedDockable(Dockable)
.protected void
updateTab(Dockable dockable)
-
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, 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
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, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.flexdock.docking.DockingPort
getClientProperty, putClientProperty
-
-
-
-
Constructor Detail
-
DefaultDockingPort
public DefaultDockingPort()
Creates a newDefaultDockingPort
with a persistent ID equal to theString
value of this a random UUID.- See Also:
UUID
-
DefaultDockingPort
public DefaultDockingPort(java.lang.String id)
Creates a newDefaultDockingPort
with the specified persistent ID. Ifid
isnull
, then theString
value of thisObject's
hash code is used. The persistent ID will be the same value returned by invokinggetPersistentId()
for thisDefaultDockingPort
.- Parameters:
id
- the persistent ID for the newDefaultDockingPort
instance.
-
-
Method Detail
-
createLayout
protected java.awt.LayoutManager createLayout()
-
createBorderManager
protected BorderManager createBorderManager()
Creates a standard border manager for this docking port.This method is called from the constructor.
- Returns:
- the border manager for this docking port.
-
add
public java.awt.Component add(java.awt.Component comp)
Overridden to set the currently docked component. Should not be called by application code.- Overrides:
add
in classjava.awt.Container
- Parameters:
comp
- the component to be added
-
add
public java.awt.Component add(java.awt.Component comp, int index)
Overridden to set the currently docked component. Should not be called by application code.- Overrides:
add
in classjava.awt.Container
- Parameters:
comp
- the component to be addedindex
- the position at which to insert the component, or-1
to append the component to the end
-
add
public void add(java.awt.Component comp, java.lang.Object constraints)
Overridden to set the currently docked component. Should not be called by application code.- Overrides:
add
in classjava.awt.Container
- Parameters:
comp
- the component to be addedconstraints
- an object expressing layout contraints for this component
-
add
public void add(java.awt.Component comp, java.lang.Object constraints, int index)
Overridden to set the currently docked component. Should not be called by application code.- Overrides:
add
in classjava.awt.Container
- Parameters:
comp
- the component to be addedconstraints
- an object expressing layout contraints for thisindex
- the position in the container's list at which to insert the component;-1
means insert at the end
-
add
public java.awt.Component add(java.lang.String name, java.awt.Component comp)
Overridden to set the currently docked component. Should not be called by application code.- Overrides:
add
in classjava.awt.Container
- Parameters:
name
- the name of theComponent
to be added.comp
- theComponent
to add.
-
isDockingAllowed
public boolean isDockingAllowed(java.awt.Component comp, java.lang.String region)
Returnstrue
if docking is allowed for the specifiedComponent
within the suppliedregion
,false
otherwise. It is important to note that success of a docking operation relies on many factors and a return value oftrue
from this method does not necessarily guarantee that a call todock()
will succeed. This method merely indicates that the currentDockingPort
does not have any outstanding reason to block a docking operation with respect to the specifiedComponent
andregion
.If
comp
isnull
orregion
is invalid according toDockingManager.isValidDockingRegion(String region)
, then this method returnsfalse
.If this
DockingPort
is not already the parentDockingPort
for the specifiedComponent
, then this method returnstrue
.If this
DockingPort
is already the parentDockingPort
for the specifiedComponent
, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multipleDockables
, and thus the tab ordering may be rearranged, or shifted into a split layout. Ifcomp
is the only dockedComponent
within thisDockingPort
, then this method returnsfalse
since the layout cannot be rearranged. Otherwise, this method returnstrue
.- Specified by:
isDockingAllowed
in interfaceDockingPort
- Parameters:
comp
- theComponent
whose docking availability is to be checkedregion
- the region to be checked for docking availability for the specifiedComponent
.- Returns:
true
if docking is allowed for the specifiedComponent
within the suppliedregion
,false
otherwise.- See Also:
DockingPort.isDockingAllowed(Component, String)
,DockingManager.isValidDockingRegion(String)
,isParentDockingPort(Component)
-
getRegion
public java.lang.String getRegion(java.awt.Point location)
Returns the docking region within thisDockingPort
that contains the specifiedPoint
. Valid return values are those regions defined inDockingConstants
and includeNORTH_REGION
,SOUTH_REGION
,EAST_REGION
,WEST_REGION
,CENTER_REGION
, andUNKNOWN_REGION
.If
location
isnull
, thenUNKNOWN_REGION
is returned.This method gets the
RegionChecker
for thisDockingPort
by callinggetRegionChecker()
. It then attempts to locate theDockable
at the specifiedlocation
by callinggetDockableAt(Point location)
.This method defers processing to
getRegion(Component c, Point p)
for the currentRegionChecker
. If aDockable
was found at the specifiedPoint
, then the location of thePoint
is translated to the coordinate system of theComponent
for the embeddedDockable
and thatComponent
and modifiedPoint
are passed intogetRegion(Component c, Point p)
} for the currentRegionChecker
. If noDockable
was found, then the specifiedPoint
is left unmodified and thisDockingPort
and the suppliedPoint
are passed togetRegion(Component c, Point p)
} for the currentRegionChecker
.- Specified by:
getRegion
in interfaceDockingPort
- Parameters:
location
- the location within thisDockingPort
to examine for a docking region.- Returns:
- the docking region within this
DockingPort
that contains the specifiedPoint
- See Also:
getRegionChecker()
,getDockableAt(Point)
,Dockable.getComponent()
,RegionChecker.getRegion(Component, Point)
-
getRegionChecker
public RegionChecker getRegionChecker()
Returns theRegionChecker
currently used by thisDockingPort
. This method retrieves theDockingPortPropertySet
instance for thisDockingPort
by callinggetDockingProperties()
. It then returns by invokinggetRegionChecker()
on the resolvedDockingPortPropertySet
.- Returns:
- the
RegionChecker
currently used by thisDockingPort
. - See Also:
getDockingProperties()
,DockingPortPropertySet.getRegionChecker()
-
getDockableAt
public Dockable getDockableAt(java.awt.Point location)
Returns the direct childDockable
located at the specifiedPoint
. Iflocation
isnull
, or thisDockingPort
is empty, then anull
reference is returned.If this
DockingPort
contains a split layout, then any nestedDockables
will be within a sub-DockingPort
and not a direct child of thisDockingPort
. Therefore, ifgetDockedComponent()
returns aJSplitPane
, then this method will return anull
reference.If this
DockingPort
contains a tabbed layout, then theJTabbedPane
returned bygetDockedComponent()
will be checked for aDockable
at the specifiedPoint
.- Parameters:
location
- the location within theDockingPort
to test for aDockable
.- Returns:
- the direct child
Dockable
located at the specifiedPoint
. - See Also:
getDockedComponent()
,DockingManager.getDockable(Component)
,Container.getComponentAt(int x, int y)
-
getComponent
public java.awt.Component getComponent(java.lang.String region)
Returns theComponent
currently docked within the specifiedregion
.If this
DockingPort
has either a single childDockable
or a tabbed layout, then the supplied region must beCENTER_REGION
or this method will return anull
reference. If there is a single childDockable
, then this method will return the sameComponent
as returned bygetDockedComponent()
. If there is a tabbed layout, then this method will return theComponent
in the currently selected tab.If this
DockingPort
has a split layout, then a check forCENTER_REGION
will return anull
reference. For outer regions (NORTH_REGION
,SOUTH_REGION
,EAST_REGION
, orWEST_REGION
), the supplied region parameter must match the orientation of the embeddedJSplitPane
. Thus for a vertically oriented split pane, checks forEAST_REGION
andWEST_REGION
will return anull
reference. Likewise, for a horizontally oriented split pane, checks forNORTH_REGION
andSOUTH_REGION
will return anull
reference.Outer regions are mapped to corresponding split pane regions.
NORTH_REGION
maps to the split pane's top component,SOUTH_REGION
maps to the bottom,EAST_REGION
maps to the right, andWEST_REGION
maps to the left. The sub-DockingPort
for the split pane region that corresponds to the specifiedregion
parameter will be resolved and this method will return thatComponent
retrieved by calling itsgetDockedComponent()
method. Note that thegetDockedComponent()
call to a sub-DockingPort
implies that theJTabbedPane
orJSplitPane
for the sub-port may be returned if the sub-port contains multipleDockables
.If this
DockingPort
is empty, then this method returns anull
reference.- Specified by:
getComponent
in interfaceDockingPort
- Parameters:
region
- the region to be checked for a dockedComponent
- Returns:
- the
Component
docked within the specified region. - See Also:
DockingPort.getComponent(String)
,getDockedComponent()
-
getDockable
public Dockable getDockable(java.lang.String region)
Returns theDockable
currently docked within the specifiedregion
. This method dispatches togetComponent(String region)
to retrieve theComponent
docked within the specified region and returns its associatedDockable
viaDockingManager.getDockable(Component comp)
.There are somewhat strict semantics associated with retrieving the
Component
in a particular docking region. API documentation forgetComponent(String region)
should be referenced for a listing of the rule set. Ifregion
is invalid according toDockingManager.isValidDockingRegion(String region)
, then this method returns anull
reference.- Specified by:
getDockable
in interfaceDockingPort
- Parameters:
region
- the region to be checked for a dockedDockable
- Returns:
- the
Dockable
docked within the specified region. - See Also:
DockingPort.getDockable(String)
,getComponent(String)
,getDockedComponent()
,DockingManager.getDockable(Component)
,DockingManager.isValidDockingRegion(String)
-
createTabbedPane
protected javax.swing.JTabbedPane createTabbedPane()
If this method returnsnull
, implementations may throw NullPointerExceptions. Do not expect NPE checking.- Returns:
- a valid JTabbedPane.
-
updateTab
protected void updateTab(Dockable dockable)
-
getDockingStrategy
public DockingStrategy getDockingStrategy()
Returns theDockingStrategy
used by thisDockingPort
. This method dispatches togetDockingStrategy(Object obj)
, passingthis
as an argument. By default,DefaultDockingStrategy
is used unless a differentDockingStrategy
has been assigned by the end user forDefaultDockingPort
.- Specified by:
getDockingStrategy
in interfaceDockingPort
- Returns:
- the
DockingStrategy
used by thisDockingPort
. - See Also:
DockingPort.getDockingStrategy()
,DockingManager.getDockingStrategy(Object)
-
clear
public void clear()
Removes allDockables
from thisDockingPort
. Internally, this method dispatches toremoveAll()
. This ensures that not only dockedComponents
are removed, that that all wrapper containers such asJTabbedPanes
,JSplitPanes
, and sub-DockingPorts
are removed as well.- Specified by:
clear
in interfaceDockingPort
- See Also:
DockingPort.clear()
,removeAll()
-
dock
public boolean dock(java.awt.Component comp, java.lang.String region)
Docks the specified component within the specified region. This method attempts to resolve theDockable
associated with the specifiedComponent
by invokingDockingManager.getDockable(Component comp)
. Processing is then dispatched todock(Dockable dockable, String region)
.If no
Dockable
is resolved for the specifiedComponent
, then this method attempts to register theComponent
as aDockable
automatically by callingDockingManager.registerDockable(Component comp)
.If either
comp
orregion
region arenull
, then this method returnsfalse
. Otherwise, this method returns a boolean indicating the success of the docking operation based upondock(Dockable dockable, String region)
.- Specified by:
dock
in interfaceDockingPort
- Parameters:
comp
- theComponent
to be docked within thisDockingPort
region
- the region within thisDockingPort
to dock the specifiedComponent
- Returns:
true
if the docking operation was successful,false
otherwise.- See Also:
DockingPort.dock(Component, String)
,dock(Dockable, String)
,DockingManager.getDockable(Component)
,DockingManager.registerDockable(Component)
-
dock
public boolean dock(Dockable dockable, java.lang.String region)
Docks the specifiedDockable
within the specified region. TheComponent
used for docking is returned by callinggetComponent()
on the specifiedDockable
. This method returnsfalse
immediately if the specifiedDockable
isnull
or ifisDockingAllowed(Component comp, String region)
returnsfalse
.If this
DockingPort
is currently empty, then theDockable
is docked into theCENTER_REGION
, regardless of the suppliedregion
parameter's value.If
isSingleTabAllowed()
returnsfalse
and theDockingPort
is emtpy, then theDockable
will be added directly to theDockingPort
and will take up all available space within theDockingPort
. In this case, subsequent calls togetDockedComponent()
will return the dockableComponent
.If
isSingleTabAllowed()
returnstrue
and theDockingPort
is emtpy, then aJTabbedPane
will be added directly to theDockingPort
and will take up all available space within theDockingPort
. The dockableComponent
will be added as a tab within the tabbed pane. In this case, subsequent calls togetDockedComponent()
will return theJTabbedPane
.If the
DockingPort
is not empty, and the specified region isCENTER_REGION
, then the dockableComponent
will be added to theJTabbedPane
returned bygetDockedComponent()
. If thisDockingPort
only contained a single dockableComponent
without a tabbed pane, then the currently dockedComponent
is removed, aJTabbedPane
is created and added, and both the oldComponent
and the new one are added to theJTabbedPane
. In this case, subsequent calls togetDockedComponent()
will return theJTabbedPane
.If the
DockingPort
is not empty, and the specified region isNORTH_REGION
,SOUTH_REGION
,EAST_REGION
, orWEST_REGION
, then the currently dockedComponent
is removed and replaced with aJSplitPane
. Two newDefaultDockingPorts
are created as sub-ports and are added to each side of theJSplitPane
. The previously dockedComponent
is docked to the CENTER_REGION of one of the sub-ports and the newComponent
is added to the other. In this case, subsequent calls togetDockedComponent()
will return theJSplitPane
. In this fasion, the sub-ports will now be capable of handling further sub-docking within the layout.JSplitPane
and sub-DockingPort
creation are delegated to theDockingStrategy
returned bygetDockingStrategy()
. Initial splitpane divider location is also controlled by thisDockingStrategy
.- Specified by:
dock
in interfaceDockingPort
- Parameters:
dockable
- theDockable
to be docked within thisDockingPort
region
- the region within thisDockingPort
to dock the specifiedDockable
- Returns:
true
if the docking operation was successful,false
otherwise.- See Also:
DockingPort.dock(Dockable, String)
,isDockingAllowed(Component, String)
,getDockedComponent()
,getDockingStrategy()
,DockingStrategy.createDockingPort(DockingPort)
,DockingStrategy.createSplitPane(DockingPort, String)
,DockingStrategy.getInitialDividerLocation(DockingPort, JSplitPane)
,DockingStrategy.getDividerProportion(DockingPort, JSplitPane)
-
getDockedComponent
public java.awt.Component getDockedComponent()
Returns the childComponent
currently embedded within withDockingPort
. If theDockingPort
is empty, then this method returns anull
reference. If there is a singleDockable
docked within it with no tabbed layout, then theComponent
for thatDockable
is returned per itsgetComponent()
method. If there is a tabbed layout present, then aJTabbedPane
is returned. If there is a split layout present, then aJSplitPane
is returned.- Specified by:
getDockedComponent
in interfaceDockingPort
- See Also:
DockingPort.getDockedComponent()
-
getPersistentId
public java.lang.String getPersistentId()
Returns aString
identifier that is unique toDockingPorts
within a JVM instance, but persistent across JVM instances. This is used for configuration mangement, allowing the JVM to recognize aDockingPort
instance within an application instance, persist the ID, and recall it in later application instances. The ID should be unique within an appliation instance so that there are no collisions with otherDockingPort
instances, but it should also be consistent from JVM to JVM so that the association between aDockingPort
instance and its ID can be remembered from session to session.The value returned by this method will come from the most recent call to
setPersistentId(String id)
. IfsetPersistentId(String id)
was invoked with anull
argument, then theString
verion of thisDockingPort's
hash code is used. Therefore, this method will never return anull
reference.- Specified by:
getPersistentId
in interfaceDockingPort
- Returns:
- the persistent ID for this
DockingPort
- See Also:
DockingPort.getPersistentId()
,setPersistentId(String)
,DockingManager.getDockingPort(String)
-
setPersistentId
public void setPersistentId(java.lang.String id)
Sets the persisent ID to be used for thisDockingPort
. Ifid
isnull
, then theString
value of thisDockingPort's
hash code is used.DockingPorts
are tracked by persistent ID withinDockingManager
. Whenever this method is called, theDockingManager's
tracking mechanism is automatically upated for thisDockingPort
.- Specified by:
setPersistentId
in interfaceDockingPort
- Parameters:
id
- the persistent ID to be used for thisDockingPort
- See Also:
getPersistentId()
,DockingManager.getDockingPort(String)
,DockingPortTracker.updateIndex(DockingPort)
-
isSingleTabAllowed
public boolean isSingleTabAllowed()
Returnstrue
if single tabs are allowed within thisDockingPort
,false
otherwise.Generally the tabbed interface does not appear until two or more
Dockables
are docked to theCENTER_REGION
of theDockingPort
and tabs are required to switch between them. When there is only a singleDockable
within theDockingPort
, the default behavior for the dockableComponent
to take up all of the space within theDockingPort
.If this method returns
true
, then a singleDockable
within thisDockingPort
will reside within a tabbed layout that contains only one tab.The value returned by this method is a scoped property. This means there may be many different "scopes" at which the single-tab property may be set. For instance, a "global" setting may override the individual setting for this
DockingPort
, and thisDockingPort's
particular setting may override the global default setting.org.flexdock.docking.props.PropertyManager
should be referenced for further information on scoped properties.- Returns:
true
if single tabs are allowed within thisDockingPort
,false
otherwise.- See Also:
setSingleTabAllowed(boolean)
,DockingManager.isSingleTabsAllowed()
,DockingManager.setSingleTabsAllowed(boolean)
,PropertyManager
,DockingPortPropertySet.isSingleTabsAllowed()
,DockingPortPropertySet.setSingleTabsAllowed(boolean)
-
setSingleTabAllowed
public void setSingleTabAllowed(boolean allowed)
Sets the "single tab" property for thisDockingPort
, allowing or disallowing a singleDockable
within theDockingPort
to appear within a tabbed layout.Generally the tabbed interface does not appear until two or more
Dockables
are docked to theCENTER_REGION
of theDockingPort
and tabs are required to switch between them. When there is only a singleDockable
within theDockingPort
, the default behavior for the dockableComponent
to take up all of the space within theDockingPort
.If the single tab property is set to
true
, then a singleDockable
within thisDockingPort
will reside within a tabbed layout that contains only one tab.The single tab property is a scoped property. This means there may be many different "scopes" at which the single-tab property may be set. For instance, a "global" setting may override the individual setting for this
DockingPort
, and thisDockingPort's
particular setting may override the global default setting. This method applied a value only to the local scope for this particularDockingPort
.org.flexdock.docking.props.PropertyManager
should be referenced for further information on scoped properties.- Parameters:
allowed
-true
if a single-tabbed layout should be allowed,false
otherwise- See Also:
isSingleTabAllowed()
,DockingManager.setSingleTabsAllowed(boolean)
,DockingManager.isSingleTabsAllowed()
,PropertyManager
,DockingPortPropertySet.setSingleTabsAllowed(boolean)
,DockingPortPropertySet.isSingleTabsAllowed()
-
isParentDockingPort
public boolean isParentDockingPort(java.awt.Component comp)
Indicates whether or not the specified component is docked somewhere within thisDefaultDockingPort
. This method returnstrue
if the specifiedComponent
is a direct child of theDefaultDockingPort
or is a direct child of aJTabbedPane
orJSplitPane
that is currently theDefaultDockingPort's
docked component. Otherwise, this method returnsfalse
. Ifcomp
isnull
, then then this method returnfalse
- Specified by:
isParentDockingPort
in interfaceDockingPort
- Parameters:
comp
- the Component to be tested.- Returns:
- a boolean indicating whether or not the specified component is
docked somewhere within this
DefaultDockingPort
. - See Also:
DockingPort.isParentDockingPort(java.awt.Component)
,Component.getParent()
,getDockedComponent()
-
isValidDockingRegion
protected boolean isValidDockingRegion(java.lang.String region)
-
getCenterDockable
protected Dockable getCenterDockable()
-
remove
public void remove(int index)
Overridden to decorate superclass method, keeping track of internal docked-component reference.- Overrides:
remove
in classjava.awt.Container
- Parameters:
index
- the index of the component to be removed.- See Also:
Container.remove(int)
-
removeAll
public void removeAll()
Overridden to decorate superclass method, keeping track of internal docked-component reference.- Overrides:
removeAll
in classjava.awt.Container
- See Also:
Container.removeAll()
-
setBorderManager
public void setBorderManager(BorderManager mgr)
Sets the currently installedBorderManager
. This method provides a means of customizing border managment following any successful call todock(Dockable dockable, String region)
orundock(Component comp)
, allowing cleanup of borders for nestedComponents
within the docking layout.null
values are allowed.- Parameters:
mgr
- theBorderManager
assigned to to manage docked component borders.- See Also:
getBorderManager()
,BorderManager
-
getBorderManager
public BorderManager getBorderManager()
Returns the currently intalledBorderManager
. TheBorderManager
is used any time a successful call todock(Dockable dockable, String region)
orundock(Component comp)
has been issued to clean up borders for nestedComponents
within the docking layout. This method will return anull
reference if there is noBorderManager
installed.- Returns:
- the currently installed
BorderManager
. - See Also:
setBorderManager(BorderManager)
,BorderManager
-
undock
public boolean undock(java.awt.Component comp)
Undocks the specifiedComponent
and returns a boolean indicating the success of the operation.Since
DefaultDockingPort
may only contain one child component, there i s a container hierarchy to manage tabbed interfaces, split layouts, and sub-docking. As components are removed from this hierarchy, the hierarchy itself must be reevaluated. Removing a component from a child code>DefaultDockingPort} within aJSplitPane
renders the childDefaultDockingPort
unnecessary, which, in turn, renders the notion of splitting the layout with aJSplitPane
unnecessary (since there are no longer two components to split the layout between). Likewise, removing a child component from aJTabbedPane
such that there is only one child left within theJTabbedPane
removes the need for a tabbed interface to begin with.This method automatically handles the reevaluation of the container hierarchy to keep wrapper-container usage at a minimum. Since
DockingManager
makes this callback automatic, developers normally will not need to call this method explicitly. However, when removing a component from aDefaultDockingPort
using application code, developers should keep in mind to use this method instead ofremove()
.- Specified by:
undock
in interfaceDockingPort
- Parameters:
comp
- theComponent
to be undocked.- Returns:
- a boolean indicating the success of the operation
- See Also:
DockingPort.undock(Component comp)
,DockingManager.undock(Dockable)
-
getDockables
public java.util.Set getDockables()
Returns allDockables
docked within thisDockingPort
and all sub-DockingPorts
. The returnedSet
will containDockable
instances. If there are noDockables
present, an emptySet
will be returned. This method will never return anull
reference.- Specified by:
getDockables
in interfaceDockingPort
- Returns:
- all
Dockables
docked within thisDockingPort
and all sub-DockingPorts
. - See Also:
DockingPort.getDockables()
-
getDockableSet
protected java.util.Set getDockableSet(int depth, int level, java.lang.Class desiredClass)
-
isValidDockableChild
protected boolean isValidDockableChild(java.awt.Component c, java.lang.Class desiredClass)
-
addDockingListener
public void addDockingListener(DockingListener listener)
Adds aDockingListener
to observe docking events for thisDockingPort
.null
arguments are ignored.- Specified by:
addDockingListener
in interfaceDockingMonitor
- Parameters:
listener
- theDockingListener
to add to thisDockingPort
.- See Also:
DockingMonitor.addDockingListener(DockingListener)
,getDockingListeners()
,removeDockingListener(DockingListener)
-
getDockingListeners
public DockingListener[] getDockingListeners()
Returns an array of allDockingListeners
added to thisDockingPort
. If there are no listeners present for thisDockingPort
, then a zero-length array is returned.- Specified by:
getDockingListeners
in interfaceDockingMonitor
- Returns:
- an array of all
DockingListeners
added to thisDockingPort
. - See Also:
DockingMonitor.getDockingListeners()
,addDockingListener(DockingListener)
,removeDockingListener(DockingListener)
-
removeDockingListener
public void removeDockingListener(DockingListener listener)
Removes the specifiedDockingListener
from thisDockingPort
. If the specifiedDockingListener
isnull
, or the listener has not previously been added to thisDockingPort
, then noException
is thrown and no action is taken.- Specified by:
removeDockingListener
in interfaceDockingMonitor
- Parameters:
listener
- theDockingListener
to remove from thisDockingPort
- See Also:
DockingMonitor.removeDockingListener(DockingListener)
,addDockingListener(DockingListener)
,getDockingListeners()
-
dockingCanceled
public void dockingCanceled(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dockingCanceled
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.dockingCanceled(DockingEvent)
-
dockingComplete
public void dockingComplete(DockingEvent evt)
Requests activation for the newly docked Dockable.- Specified by:
dockingComplete
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.dockingComplete(DockingEvent)
-
dragStarted
public void dragStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dragStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.dragStarted(DockingEvent)
-
dropStarted
public void dropStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dropStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.dropStarted(DockingEvent)
-
undockingComplete
public void undockingComplete(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
undockingComplete
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.undockingComplete(DockingEvent)
-
undockingStarted
public void undockingStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
undockingStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
DockingListener.undockingStarted(DockingEvent)
-
getDockingProperties
public DockingPortPropertySet getDockingProperties()
Returns aDockingPortPropertySet
instance associated with thisDockingPort
. This method returns the default implementation supplied by the framework by invokinggetDockingPortPropertySet(DockingPort port)
onorg.flexdock.docking.props.PropertyManager
and supplying an argument ofthis
.- Specified by:
getDockingProperties
in interfaceDockingPort
- Returns:
- the
DockingPortPropertySet
associated with thisDockingPort
. This method will not return anull
reference. - See Also:
DockingPortPropertySet
,DockingPort.getDockingProperties()
,PropertyManager.getDockingPortPropertySet(DockingPort)
-
setTabsAsDragSource
public void setTabsAsDragSource(boolean enabled)
Enables or disables drag support for docking operations on the tabs used within an embedded tabbed layout. If tab-drag-source is enabled, then the tab that corresponds to aDockable
within an embedded tabbed layout will respond to drag events as if the tab were a component included within theList
returned by callinggetDragSources()
on theDockable
. This allows dragging a tab to initiate drag-to-dock operations.- Parameters:
enabled
-true
if drag-to-dock support should be enabled for tabs and their associatedDockables
,false
otherwise.- See Also:
isTabsAsDragSource()
,Dockable.getDragSources()
-
isTabsAsDragSource
public boolean isTabsAsDragSource()
Returnstrue
if drag-to-dock support is enabled for tabs and their associatedDockables
,false
otherwise. If tab-drag-source is enabled, then the tab that corresponds to aDockable
within an embedded tabbed layout will respond to drag events as if the tab were a component included within theList
returned by callinggetDragSources()
on theDockable
. This allows dragging a tab to initiate drag-to-dock operations.- Returns:
true
if drag-to-dock support is enabled for tabs and their associatedDockables
,false
otherwise.- See Also:
setTabsAsDragSource(boolean)
,Dockable.getDragSources()
-
getInitTabPlacement
protected int getInitTabPlacement()
-
isRoot
public boolean isRoot()
Returns a boolean indicating whether or not thisDockingPort
is nested within anotherDockingPort
. If there are no otherDockingPorts
within thisDockingPort's
container ancestor hierarchy, then this method will returntrue
. Otherwise, this method will returnfalse
. If the thisDockingPort
is not validated and/or is not part of a container hierarchy, this method should returntrue
.- Specified by:
isRoot
in interfaceDockingPort
- Returns:
false
if thisDockingPort
is nested within anotherDockingPort
,true
otherwise.- See Also:
DockingPort.isRoot()
-
setRoot
public void setRoot(boolean root)
This method is used internally by the framework to notifyDefaultDockingPorts
whether they are "root"DockingPorts
according to the rules specified byisRoot()
on theDockingPort
interface. This method should not be called by application-level developers. It will most likely be removed in future versions and the logic contained herein will be managed by some type of change listener.- Parameters:
root
-true
if this is a "root"DockingPort
,false
otherwise.- See Also:
isRoot()
,DockingPort.isRoot()
-
setDragInProgress
public void setDragInProgress(boolean inProgress)
This method is used internally by the framework to notifyDefaultDockingPorts
whether a drag operation is or is not currently in progress and should not be called by application-level developers. It will most likely be removed in future versions and the logic contained herein will be managed by some type of change listener.- Parameters:
inProgress
-true
if a drag operation involving thisDockingPort
is currently in progress,false
otherwise.
-
paint
public void paint(java.awt.Graphics g)
Overridden to provide enhancements during drag operations. SomeDragPreview
implementations may by able to supply aBufferedImage
for thisDockingPort
to use for painting operations. This may be useful for cases in which the dimensions of dockedComponents
are altered in realtime during the drag operation to provide a "ghost" image for theDragPreview
. In this case, visual feedback for altered subcomponents within thisDockingPort
may be blocked in favor of a temporaryBufferedImage
for the life of the drag operation.- Overrides:
paint
in classjavax.swing.JComponent
- Parameters:
g
- theGraphics
context in which to paint- See Also:
JComponent.paint(java.awt.Graphics)
-
exportLayout
public LayoutNode exportLayout()
Returns aLayoutNode
containing metadata that describes the current layout contained within thisDefaultDockingPort
. TheLayoutNode
returned by this method will be aDockingPortNode
that constitutes the root of a tree structure containing variousDockingNode
implementations; specificallySplitNode
,DockableNode
, andDockingPortNode
. Each of these nodes isSerializable
, implying theLayoutNode
itself may be written to external storage and later reloaded into thisDockingPort
viaimportLayout(LayoutNode node)
.- Specified by:
exportLayout
in interfaceDockingPort
- Returns:
- a
LayoutNode
representing the current layout state within thisDockingPort
- See Also:
DockingPort.importLayout(LayoutNode)
,importLayout(LayoutNode)
,LayoutManager.createLayout(DockingPort)
,LayoutNode
,DockingNode
,DockingPortNode
,SplitNode
,DockableNode
-
importLayout
public void importLayout(LayoutNode node)
Clears out the existing layout within thisDockingPort
and reconstructs a new layout based upon the specifiedLayoutNode
.At present, this method can only handle
LayoutNodes
that have been generated byDefaultDockingPort's
exportLayout()
method. If the specifiedLayoutNode
isnull
or is otherwise not an instance ofDockingPortNode
, then this method returns immediately with no action taken.Otherwise, the necessary
Dockables
are docked within thisDockingPort
and all subsequently generated sub-DockingPorts
in a visual configuration mandated by the tree structure modeled by the specifiedLayoutNode
.- Specified by:
importLayout
in interfaceDockingPort
- Parameters:
node
- theLayoutNode
whose layout is to be instantiated within thisDockingPort
- See Also:
DockingPort.importLayout(LayoutNode)
,exportLayout()
,LayoutNode
,DockingNode
,DockingPortNode
,SplitNode
,DockableNode
-
installMaximizedDockable
public void installMaximizedDockable(Dockable dockable)
Description copied from interface:DockingPort
Asks thisDockingPort
to temporarily install the specifiedDockable
and maximize its component. This method is called byDockingManager
in the course of maximizing aDockable
. Client code should not call this method directly.This
DockingPort
is expected to display the specified dockable's component such that it occupies all (or the majority) of its screen resources. Also, thisDockingPort
is expected to internally store enough information to restore its current state after a subsequent call toDockingPort.uninstallMaximizedDockable()
.- Specified by:
installMaximizedDockable
in interfaceDockingPort
- Parameters:
dockable
- theDockable
that is requested to be maximized- See Also:
DockingManager.toggleMaximized(Component)
,DockingManager.toggleMaximized(Dockable)
-
uninstallMaximizedDockable
public void uninstallMaximizedDockable()
Description copied from interface:DockingPort
Notifies thisDockingPort
that theDockable
previously installed for maximization via a call toDockingPort.installMaximizedDockable(Dockable)
should now be returned to its originalDockingPort
and that thisDockingPort
should return to its original state from before the call toDockingPort.installMaximizedDockable(Dockable)
. This method is called byDockingManager
in the course of restoring a maximizedDockable
. Client code should not call this method directly.This
DockingPort
is expected to remove the maximized dockable's component from its swing container hierarchy.- Specified by:
uninstallMaximizedDockable
in interfaceDockingPort
- See Also:
DockingManager.toggleMaximized(Component)
,DockingManager.toggleMaximized(Dockable)
-
releaseForMaximization
public void releaseForMaximization(Dockable dockable)
Description copied from interface:DockingPort
Asks thisDockingPort
to temporarily release its childDockable
for use by anotherDockingPort
to achieve maximization. This method is called byDockingManager
in the course of maximizing aDockable
. Client code should not call this method directly.This
DockingPort
is expected to remove the specified dockable's component from its swing container hierarchy. Also, thisDockingPort
is expected to internally store enough information to restore its current state after a subsequent call toDockingPort.returnFromMaximization()
.- Specified by:
releaseForMaximization
in interfaceDockingPort
- Parameters:
dockable
- theDockable
that is requested to be maximized- See Also:
DockingManager.toggleMaximized(Component)
,DockingManager.toggleMaximized(Dockable)
-
returnFromMaximization
public void returnFromMaximization()
Description copied from interface:DockingPort
Notifies thisDockingPort
that theDockable
previously released for maximization via a call toDockingPort.releaseForMaximization(Dockable)
is now ready to be returned to its original state inside thisDockingPort
. This method is called byDockingManager
in the course of restoring a maximizedDockable
. Client code should not call this method directly.- Specified by:
returnFromMaximization
in interfaceDockingPort
- See Also:
DockingManager.toggleMaximized(Component)
,DockingManager.toggleMaximized(Dockable)
-
-