org.flexdock.docking.defaults
Class DefaultDockingPort

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.flexdock.docking.defaults.DefaultDockingPort
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, DockingConstants, DockingPort, DockingListener, DockingMonitor
Direct Known Subclasses:
FloatingDockingPort, Viewport

public class DefaultDockingPort
extends JPanel
implements DockingPort, DockingConstants

This is a Container that implements the DockingPort interface. It provides a default implementation of DockingPort 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 incoming Dockables are docked to the CENTER region. If the port is not empty, then all incoming Dockables docked to the CENTER region are embedded within a JTabbedPane. All incoming Dockables docked to an outer region (NORTH, SOUTH, EAST, and WEST) of a non-empty port are placed into a split layout using a JSplitPane.

For centrally docked Components, the immediate child of the DefaultDockingPort may or may not be a JTabbedPane. If isSingleTabAllowed() returns true for the current DefaultDockingPort, then the immediate child returned by getDockedComponent() will return a JTabbedPane instance even if there is only one Dockable embedded within the port. If there is a single Dockable in the port, but isSingleTabAllowed() returns false, then getDockedComponent() will return the Component that backs the currently docked Dockable, returned by the Dockable'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 a JTabbedPane at all times if there is more than one centrally docked Dockable within the port, and all docked Components 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 the DockingPort between child components. Each region of the JSplitPane contains a new DefaultDockingPort, which, in turn, contains the docked components. In this situation, getDockedComponent() will return a JSplitPane reference.

A key concept that drives the DefaultDockingPort, then, is the notion that this DockingPort implementation may only ever have one single child component, which may or may not be a wrapper for other child components. Because JSplitPane contains child DefaultDockingPorts, each of those DefaultDockingPorts 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 child DefaultDockingPort within a JSplitPane renders the child DefaultDockingPort unnecessary, which, in turn, renders the notion of splitting the layout with a JSplitPane unnecessary (since there are no longer two components to split the layout between). Likewise, removing a child component from a JTabbedPane such that there is only one child left within the JTabbedPane removes the need for a tabbed interface to begin with.

When the DockingManager removes a component from a DockingPort via DockingManager.undock(Dockable dockable) it uses a call to undock() on the current DockingPort. undock() 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 a DefaultDockingPort using application code, developers should keep in mind to use undock() instead of remove(). Border management after docking and undocking operations are accomplished using a BorderManager. setBorderManager() may be used to set the border manager instance and customize border management.

Author:
Christopher Butler
See Also:
Serialized Form

Nested Class Summary
protected  class DefaultDockingPort.PortLayout
           
 
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
 
Nested classes/interfaces inherited from interface org.flexdock.docking.event.DockingListener
DockingListener.Stub
 
Field Summary
protected  ArrayList dockingListeners
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.flexdock.docking.DockingPort
INITIAL_TAB_POSITION
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultDockingPort()
          Creates a new DefaultDockingPort with a persistent ID equal to the String value of this a random UUID.
DefaultDockingPort(String id)
          Creates a new DefaultDockingPort with the specified persistent ID.
 
Method Summary
 Component add(Component comp)
          Overridden to set the currently docked component.
 Component add(Component comp, int index)
          Overridden to set the currently docked component.
 void add(Component comp, Object constraints)
          Overridden to set the currently docked component.
 void add(Component comp, Object constraints, int index)
          Overridden to set the currently docked component.
 Component add(String name, Component comp)
          Overridden to set the currently docked component.
 void addDockingListener(DockingListener listener)
          Adds a DockingListener to observe docking events for this DockingPort.
 void clear()
          Removes all Dockables from this DockingPort.
protected  BorderManager createBorderManager()
          Creates a standard border manager for this docking port.
protected  LayoutManager createLayout()
           
protected  JTabbedPane createTabbedPane()
          If this method returns null, implementations may throw NullPointerExceptions.
 boolean dock(Component comp, String region)
          Docks the specified component within the specified region.
 boolean dock(Dockable dockable, String region)
          Docks the specified Dockable 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 a LayoutNode containing metadata that describes the current layout contained within this DefaultDockingPort.
 BorderManager getBorderManager()
          Returns the currently intalled BorderManager.
protected  Dockable getCenterDockable()
           
 Component getComponent(String region)
          Returns the Component currently docked within the specified region.
 Dockable getDockable(String region)
          Returns the Dockable currently docked within the specified region.
 Dockable getDockableAt(Point location)
          Returns the direct child Dockable located at the specified Point.
 Set getDockables()
          Returns all Dockables docked within this DockingPort and all sub-DockingPorts.
protected  Set getDockableSet(int depth, int level, Class desiredClass)
           
 Component getDockedComponent()
          Returns the child Component currently embedded within with DockingPort.
 DockingListener[] getDockingListeners()
          Returns an array of all DockingListeners added to this DockingPort.
 DockingPortPropertySet getDockingProperties()
          Returns a DockingPortPropertySet instance associated with this DockingPort.
 DockingStrategy getDockingStrategy()
          Returns the DockingStrategy used by this DockingPort.
protected  int getInitTabPlacement()
           
 String getPersistentId()
          Returns a String identifier that is unique to DockingPorts within a JVM instance, but persistent across JVM instances.
 String getRegion(Point location)
          Returns the docking region within this DockingPort that contains the specified Point.
 RegionChecker getRegionChecker()
          Returns the RegionChecker currently used by this DockingPort.
 void importLayout(LayoutNode node)
          Clears out the existing layout within this DockingPort and reconstructs a new layout based upon the specified LayoutNode.
 void installMaximizedDockable(Dockable dockable)
          Asks this DockingPort to temporarily install the specified Dockable and maximize its component.
 boolean isDockingAllowed(Component comp, String region)
          Returns true if docking is allowed for the specified Component within the supplied region, false otherwise.
 boolean isParentDockingPort(Component comp)
          Indicates whether or not the specified component is docked somewhere within this DefaultDockingPort.
 boolean isRoot()
          Returns a boolean indicating whether or not this DockingPort is nested within another DockingPort.
 boolean isSingleTabAllowed()
          Returns true if single tabs are allowed within this DockingPort, false otherwise.
 boolean isTabsAsDragSource()
          Returns true if drag-to-dock support is enabled for tabs and their associated Dockables, false otherwise.
protected  boolean isValidDockableChild(Component c, Class desiredClass)
           
protected  boolean isValidDockingRegion(String region)
           
 void paint(Graphics g)
          Overridden to provide enhancements during drag operations.
 void releaseForMaximization(Dockable dockable)
          Asks this DockingPort to temporarily release its child Dockable for use by another DockingPort 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 specified DockingListener from this DockingPort.
 void returnFromMaximization()
          Notifies this DockingPort that the Dockable previously released for maximization via a call to DockingPort.releaseForMaximization(Dockable) is now ready to be returned to its original state inside this DockingPort.
 void setBorderManager(BorderManager mgr)
          Sets the currently installed BorderManager.
 void setDragInProgress(boolean inProgress)
          This method is used internally by the framework to notify DefaultDockingPorts whether a drag operation is or is not currently in progress and should not be called by application-level developers.
 void setPersistentId(String id)
          Sets the persisent ID to be used for this DockingPort.
 void setRoot(boolean root)
          This method is used internally by the framework to notify DefaultDockingPorts whether they are "root" DockingPorts according to the rules specified by isRoot() on the DockingPort interface.
 void setSingleTabAllowed(boolean allowed)
          Sets the "single tab" property for this DockingPort, allowing or disallowing a single Dockable within the DockingPort 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(Component comp)
          Undocks the specified Component 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 this DockingPort that the Dockable previously installed for maximization via a call to DockingPort.installMaximizedDockable(Dockable) should now be returned to its original DockingPort and that this DockingPort should return to its original state from before the call to DockingPort.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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, 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
 

Field Detail

dockingListeners

protected ArrayList dockingListeners
Constructor Detail

DefaultDockingPort

public DefaultDockingPort()
Creates a new DefaultDockingPort with a persistent ID equal to the String value of this a random UUID.

See Also:
UUID

DefaultDockingPort

public DefaultDockingPort(String id)
Creates a new DefaultDockingPort with the specified persistent ID. If id is null, then the String value of this Object's hash code is used. The persistent ID will be the same value returned by invoking getPersistentId() for this DefaultDockingPort.

Parameters:
id - the persistent ID for the new DefaultDockingPort instance.
Method Detail

createLayout

protected 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 Component add(Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and UNKNOWN_REGION.

If location is null, then UNKNOWN_REGION is returned.

This method gets the RegionChecker for this DockingPort by calling getRegionChecker(). It then attempts to locate the Dockable at the specified location by calling getDockableAt(Point location).

This method defers processing to getRegion(Component c, Point p) for the current RegionChecker. If a Dockable was found at the specified Point, then the location of the Point is translated to the coordinate system of the Component for the embedded Dockable and that Component and modified Point are passed into getRegion(Component c, Point p)} for the current RegionChecker. If no Dockable was found, then the specified Point is left unmodified and this DockingPort and the supplied Point are passed to getRegion(Component c, Point p)} for the current RegionChecker.

Specified by:
getRegion in interface DockingPort
Parameters:
location - the location within this DockingPort to examine for a docking region.
Returns:
the docking region within this DockingPort that contains the specified Point
See Also:
getRegionChecker(), getDockableAt(Point), Dockable.getComponent(), RegionChecker.getRegion(Component, Point)

getRegionChecker

public RegionChecker getRegionChecker()
Returns the RegionChecker currently used by this DockingPort. This method retrieves the DockingPortPropertySet instance for this DockingPort by calling getDockingProperties(). It then returns by invoking getRegionChecker() on the resolved DockingPortPropertySet.

Returns:
the RegionChecker currently used by this DockingPort.
See Also:
getDockingProperties(), DockingPortPropertySet.getRegionChecker()

getDockableAt

public Dockable getDockableAt(Point location)
Returns the direct child Dockable located at the specified Point. If location is null, or this DockingPort is empty, then a null reference is returned.

If this DockingPort contains a split layout, then any nested Dockables will be within a sub-DockingPort and not a direct child of this DockingPort. Therefore, if getDockedComponent() returns a JSplitPane, then this method will return a null reference.

If this DockingPort contains a tabbed layout, then the JTabbedPane returned by getDockedComponent() will be checked for a Dockable at the specified Point.

Parameters:
location - the location within the DockingPort to test for a Dockable.
Returns:
the direct child Dockable located at the specified Point.
See Also:
getDockedComponent(), DockingManager.getDockable(Component), Container.getComponentAt(int x, int y)

getComponent

public Component getComponent(String region)
Returns the Component currently docked within the specified region.

If this DockingPort has either a single child Dockable or a tabbed layout, then the supplied region must be CENTER_REGION or this method will return a null reference. If there is a single child Dockable, then this method will return the same Component as returned by getDockedComponent(). If there is a tabbed layout, then this method will return the Component in the currently selected tab.

If this DockingPort has a split layout, then a check for CENTER_REGION will return a null reference. For outer regions (NORTH_REGION, SOUTH_REGION, EAST_REGION, or WEST_REGION), the supplied region parameter must match the o>

add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and UNKNOWN_REGION.

If location is null, then UNKNOWN_REGION is returned.

This method gets the RegionChecker for this DockingPort by calling getRegionChecker(). It then attempts to locate the Dockable at the specified location by calling getDockableAt(Point location).

This method defers processing to getRegion(Component c, Point p) for the current RegionChecker. If a Dockable was found at the specified Point, then the location of the Point is translated to the coordinate system of the Component for the embedded Dockable and that Component and modified Point are passed into getRegion(Component c, Point p)} for the current RegionChecker. If no Dockable was found, then the specified Point is left unmodified and this DockingPort and the supplied Point are passed to getRegion(Component c, Point p)} for the current RegionChecker.

Specified by:
getRegion in interface DockingPort
Parameters:
location - the location within this DockingPort to examine for a docking region.
Returns:
the docking region within this DockingPort that contains the specified Point
See Also:
getRegionChecker(), getDockableAt(Point), Dockable.getComponent(), RegionChecker.getRegion(Component, Point)

getRegionChecker

public RegionChecker getRegionChecker()
Returns the RegionChecker currently used by this DockingPort. This method retrieves the DockingPortPropertySet instance for this DockingPort by calling getDockingProperties(). It then returns by invoking getRegionChecker() on the resolved DockingPortPropertySet.

Returns:
the RegionChecker currently used by this DockingPort.
See Also:
getDockingProperties(), DockingPortPropertySet.getRegionChecker()

getDockableAt

public Dockable getDockableAt(Point location)
Returns the direct child Dockable located at the specified Point. If location is null, or this DockingPort is empty, then a null reference is returned.

If this DockingPort contains a split layout, then any nested Dockables will be within a sub-DockingPort and not a direct child of this DockingPort. Therefore, if getDockedComponent() returns a JSplitPane, then this method will return a null reference.

If this DockingPort contains a tabbed layout, then the JTabbedPane returned by getDockedComponent() will be checked for a Dockable at the specified Point.

Parameters:
location - the location within the DockingPort to test for a Dockable.
Returns:
the direct child Dockable located at the specified Point.
See Also:
getDockedComponent(), DockingManager.getDockable(Component), Container.getComponentAt(int x, int y)

getComponent

public Component getComponent(String region)
Returns the Component currently docked within the specified region.

If this DockingPort has either a single child Dockable or a tabbed layout, then the supplied region must be CENTER_REGION or this method will return a null reference. If there is a single child Dockable, then this method will return the same Component as returned by getDockedComponent(). If there is a tabbed layout, then this method will return the Component in the currently selected tab.

If this DockingPort has a split layout, then a check for CENTER_REGION will return a null reference. For outer regions (NORTH_REGION, SOUTH_REGION, EAST_REGION, or WEST_REGION), the supplied region parameter must match the o>

add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and UNKNOWN_REGION.

If location is null, then UNKNOWN_REGION is returned.

This method gets the RegionChecker for this DockingPort by calling getRegionChecker(). It then attempts to locate the Dockable at the specified location by calling getDockableAt(Point location).

This method defers processing to getRegion(Component c, Point p) for the current RegionChecker. If a Dockable was found at the specified Point, then the location of the Point is translated to the coordinate system of the Component for the embedded Dockable and that Component and modified Point are passed into getRegion(Component c, Point p)} for the current RegionChecker. If no Dockable was found, then the specified Point is left unmodified and this DockingPort and the supplied Point are passed to getRegion(Component c, Point p)} for the current RegionChecker.

Specified by:
getRegion in interface DockingPort
Parameters:
location - the location within this DockingPort to examine for a docking region.
Returns:
the docking region within this DockingPort that contains the specified Point
See Also:
getRegionChecker(), getDockableAt(Point), Dockable.getComponent(), RegionChecker.getRegion(Component, Point)

getRegionChecker

public RegionChecker getRegionChecker()
Returns the RegionChecker currently used by this DockingPort. This method retrieves the DockingPortPropertySet instance for this DockingPort by calling getDockingProperties(). It then returns by invoking getRegionChecker() on the resolved DockingPortPropertySet.

Returns:
the RegionChecker currently used by this DockingPort.
See Also:
getDockingProperties(), DockingPortPropertySet.getRegionChecker()

getDockableAt

public Dockable getDockableAt(Point location)
Returns the direct child Dockable located at the specified Point. If location is null, or this DockingPort is empty, then a null reference is returned.

If this DockingPort contains a split layout, then any nested Dockables will be within a sub-DockingPort and not a direct child of this DockingPort. Therefore, if getDockedComponent() returns a JSplitPane, then this method will return a null reference.

If this DockingPort contains a tabbed layout, then the JTabbedPane returned by getDockedComponent() will be checked for a Dockable at the specified Point.

Parameters:
location - the location within the DockingPort to test for a Dockable.
Returns:
the direct child Dockable located at the specified Point.
See Also:
getDockedComponent(), DockingManager.getDockable(Component), Container.getComponentAt(int x, int y)

getComponent

public Component getComponent(String region)
Returns the Component currently docked within the specified region.

If this DockingPort has either a single child Dockable or a tabbed layout, then the supplied region must be CENTER_REGION or this method will return a null reference. If there is a single child Dockable, then this method will return the same Component as returned by getDockedComponent(). If there is a tabbed layout, then this method will return the Component in the currently selected tab.

If this DockingPort has a split layout, then a check for CENTER_REGION will return a null reference. For outer regions (NORTH_REGION, SOUTH_REGION, EAST_REGION, or WEST_REGION), the supplied region parameter must match the o>

add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and UNKNOWN_REGION.

If location is null, then UNKNOWN_REGION is returned.

This method gets the RegionChecker for this DockingPort by calling getRegionChecker(). It then attempts to locate the Dockable at the specified location by calling getDockableAt(Point location).

This method defers processing to getRegion(Component c, Point p) for the current RegionChecker. If a Dockable was found at the specified Point, then the location of the Point is translated to the coordinate system of the Component for the embedded Dockable and that Component and modified Point are passed into getRegion(Component c, Point p)} for the current RegionChecker. If no Dockable was found, then the specified Point is left unmodified and this DockingPort and the supplied Point are passed to getRegion(Component c, Point p)} for the current RegionChecker.

Specified by:
getRegion in interface DockingPort
Parameters:
location - the location within this DockingPort to examine for a docking region.
Returns:
the docking region within this DockingPort that contains the specified Point
See Also:
getRegionChecker(), getDockableAt(Point), Dockable.getComponent(), RegionChecker.getRegion(Component, Point)

getRegionChecker

public RegionChecker getRegionChecker()
Returns the RegionChecker currently used by this DockingPort. This method retrieves the DockingPortPropertySet instance for this DockingPort by calling getDockingProperties(). It then returns by invoking getRegionChecker() on the resolved DockingPortPropertySet.

Returns:
the RegionChecker currently used by this DockingPort.
See Also:
getDockingProperties(), DockingPortPropertySet.getRegionChecker()

getDockableAt

public Dockable getDockableAt(Point location)
Returns the direct child Dockable located at the specified Point. If location is null, or this DockingPort is empty, then a null reference is returned.

If this DockingPort contains a split layout, then any nested Dockables will be within a sub-DockingPort and not a direct child of this DockingPort. Therefore, if getDockedComponent() returns a JSplitPane, then this method will return a null reference.

If this DockingPort contains a tabbed layout, then the JTabbedPane returned by getDockedComponent() will be checked for a Dockable at the specified Point.

Parameters:
location - the location within the DockingPort to test for a Dockable.
Returns:
the direct child Dockable located at the specified Point.
See Also:
getDockedComponent(), DockingManager.getDockable(Component), Container.getComponentAt(int x, int y)

getComponent

public Component getComponent(String region)
Returns the Component currently docked within the specified region.

If this DockingPort has either a single child Dockable or a tabbed layout, then the supplied region must be CENTER_REGION or this method will return a null reference. If there is a single child Dockable, then this method will return the same Component as returned by getDockedComponent(). If there is a tabbed layout, then this method will return the Component in the currently selected tab.

If this DockingPort has a split layout, then a check for CENTER_REGION will return a null reference. For outer regions (NORTH_REGION, SOUTH_REGION, EAST_REGION, or WEST_REGION), the supplied region parameter must match the o>

add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and UNKNOWN_REGION.

If location is null, then UNKNOWN_REGION is returned.

This method gets the RegionChecker for this DockingPort by calling getRegionChecker(). It then attempts to locate the Dockable at the specified location by calling getDockableAt(Point location).

This method defers processing to getRegion(Component c, Point p) for the current RegionChecker. If a Dockable was found at the specified Point, then the location of the Point is translated to the coordinate system of the Component for the embedded Dockable and that Component and modified Point are passed into getRegion(Component c, Point p)} for the current RegionChecker. If no Dockable was found, then the specified Point is left unmodified and this DockingPort and the supplied Point are passed to getRegion(Component c, Point p)} for the current RegionChecker.

Specified by:
getRegion in interface DockingPort
Parameters:
location - the location within this DockingPort to examine for a docking region.
Returns:
the docking region within this DockingPort that contains the specified Point
See Also:
getRegionChecker(), getDockableAt(Point), Dockable.getComponent(), RegionChecker.getRegion(Component, Point)

getRegionChecker

public RegionChecker getRegionChecker()
Returns the RegionChecker currently used by this DockingPort. This method retrieves the DockingPortPropertySet instance for this DockingPort by calling getDockingProperties(). It then returns by invoking getRegionChecker() on the resolved DockingPortPropertySet.

Returns:
the RegionChecker currently used by this DockingPort.
See Also:
getDockingProperties(), DockingPortPropertySet.getRegionChecker()

getDockableAt

public Dockable getDockableAt(Point location)
Returns the direct child Dockable located at the specified Point. If location is null, or this DockingPort is empty, then a null reference is returned.

If this DockingPort contains a split layout, then any nested Dockables will be within a sub-DockingPort and not a direct child of this DockingPort. Therefore, if getDockedComponent() returns a JSplitPane, then this method will return a null reference.

If this DockingPort contains a tabbed layout, then the JTabbedPane returned by getDockedComponent() will be checked for a Dockable at the specified Point.

Parameters:
location - the location within the DockingPort to test for a Dockable.
Returns:
the direct child Dockable located at the specified Point.
See Also:
getDockedComponent(), DockingManager.getDockable(Component), Container.getComponentAt(int x, int y)

getComponent

public Component getComponent(String region)
Returns the Component currently docked within the specified region.

If this DockingPort has either a single child Dockable or a tabbed layout, then the supplied region must be CENTER_REGION or this method will return a null reference. If there is a single child Dockable, then this method will return the same Component as returned by getDockedComponent(). If there is a tabbed layout, then this method will return the Component in the currently selected tab.

If this DockingPort has a split layout, then a check for CENTER_REGION will return a null reference. For outer regions (NORTH_REGION, SOUTH_REGION, EAST_REGION, or WEST_REGION), the supplied region parameter must match the o>

add in class Container
Parameters:
comp - the component to be added

add

public Component add(Component comp,
                     int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to append the component to the end

add

public void add(Component comp,
                Object constraints)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this component

add

public void add(Component comp,
                Object constraints,
                int index)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
comp - the component to be added
constraints - an object expressing layout contraints for this
index - the position in the container's list at which to insert the component; -1 means insert at the end

add

public Component add(String name,
                     Component comp)
Overridden to set the currently docked component. Should not be called by application code.

Overrides:
add in class Container
Parameters:
name - the name of the Component to be added.
comp - the Component to add.

isDockingAllowed

public boolean isDockingAllowed(Component comp,
                                String region)
Returns true if docking is allowed for the specified Component within the supplied region, false otherwise. It is important to note that success of a docking operation relies on many factors and a return value of true from this method does not necessarily guarantee that a call to dock() will succeed. This method merely indicates that the current DockingPort does not have any outstanding reason to block a docking operation with respect to the specified Component and region.

If comp is null or region is invalid according to DockingManager.isValidDockingRegion(String region), then this method returns false.

If this DockingPort is not already the parent DockingPort for the specified Component, then this method returns true.

If this DockingPort is already the parent DockingPort for the specified Component, then a check is performed to see if there is a tabbed layout. Tabbed layouts may contain multiple Dockables, and thus the tab ordering may be rearranged, or shifted into a split layout. If comp is the only docked Component within this DockingPort, then this method returns false since the layout cannot be rearranged. Otherwise, this method returns true.

Specified by:
isDockingAllowed in interface DockingPort
Parameters:
comp - the Component whose docking availability is to be checked
region - the region to be checked for docking availability for the specified Component.
Returns:
true if docking is allowed for the specified Component within the supplied region, false otherwise.
See Also:
DockingPort.isDockingAllowed(Component, String), DockingManager.isValidDockingRegion(String), isParentDockingPort(Component)

getRegion

public String getRegion(Point location)
Returns the docking region within this DockingPort that contains the specified Point. Valid return values are those regions defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, CENTER_REGION, and