JIDE 3.5.15

com.jidesoft.action
Class DefaultDockableBarManager

java.lang.Object
  extended by com.jidesoft.swing.AbstractLayoutPersistence
      extended by com.jidesoft.action.DefaultDockableBarManager
All Implemented Interfaces:
DockableBarManager, LayoutPersistence, RootPanePersistence, AWTEventListener, EventListener, SwingConstants

public class DefaultDockableBarManager
extends AbstractLayoutPersistence
implements DockableBarManager, AWTEventListener, SwingConstants

Default implementation of DockableBarManager. It is also the main interface that users need in order to access the features of DockableBar.


Nested Class Summary
protected  class DefaultDockableBarManager.DockableBarsSnapshot
           
protected  class DefaultDockableBarManager.FloaterKeyEventPostProcessor
           
 
Field Summary
 ComponentAdapter _componentListener
           
protected  boolean _glassPaneVisibility
           
protected  DefaultDockableBarManager.DockableBarsSnapshot _postDragSnapshot
           
protected  DefaultDockableBarManager.DockableBarsSnapshot _preDragSnapshot
           
protected  boolean _redispatchingKeyEventToFloaters
           
protected  EventListenerList listenerList
          A list of event listeners for this component.
static String PROPERTY_DOUBLE_CLICK_ACTION
           
static String PROPERTY_FLOATABLE
           
static String PROPERTY_HIDABLE
           
static String PROPERTY_HIDE_FLOATING_DOCKABLE_BARS_WHEN_DEACTIVATE
           
static String PROPERTY_INIT_BOUNDS
           
static String PROPERTY_INIT_STATE
           
static String PROPERTY_REARRANGABLE
           
static String PROPERTY_SHOW_CONTEXT_MENU
           
 
Fields inherited from class com.jidesoft.swing.AbstractLayoutPersistence
_layoutDirectory, _profileKey, _useFrameBounds, _useFrameBoundsSet, _useFrameState, _useFrameStateSet, _usePref, _version, DEFAULT_PROFILE_NAME, LAYOUT_COUNT_STRING, LAYOUT_POSTFIX, MAX_PREF_BYTE_ARRAY_LENGTH, PROPERTY_PROFILE_KEY, PROPERTY_USE_PREF, PROPERTY_VERSION, V2004, V2005_09
 
Fields inherited from interface com.jidesoft.action.DockableBarManager
CLIENT_PROPERTY_SUPPRESS_CONTEXT_MENU, CONTEXT_MENU_FLOATABLE, CONTEXT_MENU_HIDABLE, CONTEXT_MENU_REARRANGABLE, DOUBLE_CLICK_NONE, DOUBLE_CLICK_TO_FLOAT
 
Fields inherited from interface com.jidesoft.swing.LayoutPersistence
ATTRIBUTE_PERSISTENCE_NAME, NODE_LAYOUT_PERSISTENCE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
DefaultDockableBarManager(RootPaneContainer rootContainer, Container contentContainer)
          Constructor.
 
Method Summary
 void addDockableBar(DockableBar bar)
          Adds a dockable bar to this DockableBarManager.
 void addDockableBarsRearrangedListener(DockableBarsRearrangedListener l)
          Adds the specified listener to receive DockableBarsRearrangedEvents from this DockableBarManager.
 void beginDraggingDockableBar(JComponent f, int mouseX, int mouseY, double relativeX, double relativeY, boolean startInFloat)
          This method is normally called when the user has indicated that they will begin dragging a component around.
 void beginLoadLayoutData()
          Starts a process to add/remove dockable bar without showing on screen immediately.
 void beginResizingDockableBar(JComponent f, int direction)
          This methods is normally called when the user has indicated that they will begin resizing the dockable bar.
 void cancelDragging()
          Cancel the dragging.
protected  void checkBarKey(String key, String methodName)
           
protected  void checkForRearrangedDockableBars()
          Compare the pre- and post-drag snapshots to determine if a DockableBar changed rows, changed position within a row, or was resized.
 DockableBarContainer createDockableBarContainer()
          Creates the containers for DockableBars.
protected  DefaultDockableBarManager.DockableBarsSnapshot createDockableBarsSnapshot(JComponent possiblyMoved)
          Take a snapshot of the currently showing DockableBars.
 FloatingDockableBarContainer createFloatingDockableBarContainer(Window owner)
          Creates a window which contains the toolbar after it has been dragged out from its container
 void dispose()
          Removes all used resources.
 void dockDockableBar(DockableBar bar, int side, int row, boolean createNewRow, int start)
          Docks the dockable bar on the side and at the start.
 void dragDockableBar(JComponent f, int newX, int newY, int mouseModifiers)
          The user has moved the dockable bar.
 void endDraggingDockableBar()
          This method signals the end of the dragging session.
 void endResizingDockableBar(JComponent f)
          This method signals the end of the resize session.
 void eventDispatched(AWTEvent event)
           
protected  DockableBarState findComponentInSnapshot(Component component, DefaultDockableBarManager.DockableBarsSnapshot snapshot)
           
protected  void fireDockableBarsRearranged(DockableBarsRearrangedEvent event)
          Fires a DockableBarsRearrangedEvent.
 void floatDockableBar(DockableBar bar, Rectangle bounds)
          Float the dockable bar.
 List<String> getAllDockableBarNames()
          Gets a list of all dockable bars.
 Collection<DockableBar> getAllDockableBars()
          Getss a collection of all dockable bars.
 JPopupMenu getContextMenu()
          Gets the default context menu for DockableBarManager.
 DockableBar getDockableBar(String key)
          Gets the dockable bar using key.
 DockableBarContainer getDockableBarContainer(int side)
          Gets the dockable bar container by side.
 DockableBarContext getDockableBarContextOf(String key)
          Gets dock context of a dockable bar specified by key.
 DockableBarFactory getDockableBarFactory()
          Gets the dockable bar factory.
 DockableBarPopupMenuCustomizer getDockableBarPopupMenuCustomizer()
          Gets the popup menu customizer.
 DockableBarsRearrangedListener[] getDockableBarsRearrangedListeners()
          Returns an array of all the DockableBarsRearrangedListeners added to this DockableBarManager with addDockableBarsRearrangedListener.
 int getDoubleClickAction()
          Gets the action when user double clicks on the title bar of a dockable bar.
 Rectangle getInitBounds()
          Gets initial bounds of the main frame.
 int getInitState()
          Gets initial state of the main frame.
 MainContainer getMainContainer()
          Gets the main container.
 RootPaneContainer getRootPaneContainer()
          Gets root pane container.
protected  DockableBarStateTransition getTransition(DockableBarState preState)
          Find the nature of the transition of a moved Component.
protected  boolean hackIsFrameVisible(FloatingDockableBarContainer floatingContainer)
          There is a bug that prevents setVisible() from working properly in a specific situation.
protected  void hackSetFrameVisible(FloatingDockableBarContainer floatingContainer, boolean show)
          There is a bug that prevents setVisible() from working properly in a specific situation.
 void hideDockableBar(String key)
          Sets the dockable bar invisible using the key of that dockable bar.
 boolean isFloatable()
          Return true if floating is allowed for dockable bars.
 boolean isHidable()
          Return true if hidden is allowed for dockable bars.
 boolean isHideFloatingDockableBarsWhenDeactivate()
          Checks if the floating dockable bars should be hidden automatically when the main frame is deactivated.
 boolean isLoadDataSuccessful()
          Did the loadLayoutFrom(InputStream in) method load successfully from the input stream (false indicates that it called resetToDefault to load the layout.) This method can be called immediately after the loadLayoutFrom(InputStream in) call to determine if a specific LayoutPersistence was forced to call resetToDefault.
protected  boolean isOwnedFloatingDockableBar(Window aWindow)
          Is the specified window one of our floatingFrames?
protected  boolean isOwnedWindow(Window aWindow)
          Is the specified window's ancestor is root pane container?
 boolean isPreserveAvailableProperty()
           
 boolean isRearrangable()
          If the dockable bars can be rearranged.
 boolean isShowContextMenu()
          Checks if the context menu should be shown.
 boolean isShowInitial()
          A client may specify that the docking layout is to be initialized without showing the window.
 boolean isUseGlassPaneEnabled()
          Checks if we will use glass pane to change cursor.
 void loadInitialLayout(Document layoutDocument)
          Load initial layout from an initial layout file designed by Visual Designer.
 boolean loadLayoutFrom(Document document)
          Load layout data from an Node that specified as node parameter.
 boolean loadLayoutFrom(InputStream in)
          Load layout data from an InputStream that specified as in parameter.
 void pauseDragDockableBar()
          Pause the dragging session of a dockable bar.
protected  void processKeyBindingForComponentInFloatingDockable(KeyEvent e, JComponent comp)
           
protected  void processKeyBindingForFloatingDockableWindow(KeyEvent e, JWindow dockableWindow)
           
protected  void processKeyBindingsForContainerInFloatingDockable(KeyEvent e, Container container)
           
protected  boolean redispatchKeyEventToFloatingContainers(KeyEvent e)
          Give the floating windows a crack at a KeyEvent that has gone unconsumed in the main window.
 void removeAllDockableBars()
          Removes all dockable bars from this DockingManager.
 void removeDockableBar(String name)
          Removes a dockable bar from this DockableBarManager.
 void removeDockableBar(String key, boolean keepPreviousState)
          Removes a dockable bar from this DockableBarManager.
 void removeDockableBarsRearrangedListener(DockableBarsRearrangedListener l)
          Removes the specified DockableBarsRearrangedListener so that it no longer receives DockableBarsRearrangedEvents from this DockableBarManager.
 void removeExtraContexts()
          Removes extra DockableBarContexts that is saved in cache but the corresponding dockable bars are not in DockableBarManager anymore.
 void removeFromHiddenDockableBars(String key)
          Remove it from hidden dockable bar list.
 void resetToDefault()
          Resets layout of frames to initial values.
 void resizingDockableBar(JComponent f, int newX, int newY, int newWidth, int newHeight, int deltaX, int deltaY)
          The user has resized the component.
 void saveLayoutTo(Document document)
          Save layout data to a Document that specified as document parameter.
 void saveLayoutTo(OutputStream out)
          Save layout data to an OutputStream that specified as out parameter.
 void setDockableBarAvailable(String key)
          Sets available the dockable bar.
 void setDockableBarFactory(DockableBarFactory dockableBarFactory)
          Sets the dockable bar factory.
 void setDockableBarPopupMenuCustomizer(DockableBarPopupMenuCustomizer customizerDockableBar)
          Sets the popup customizerDockableBar.
 void setDockableBarUnavailable(String key)
          Sets unavailable the dockable bar.
 void setDoubleClickAction(int doubleClickAction)
          Sets the action when user double clicks on the title bar of a dockable bar.
 void setFloatable(boolean floatable)
          Enable or disable floating of dockable bars.
 void setFloatingDockableBarsVisible(boolean show)
          Sets all floating dockable bar visible or invisible.
 void setHidable(boolean hidable)
          Enable or disable dockable bars from being hidden.
 void setHideFloatingDockableBarsWhenDeactivate(boolean hideFloatingDockableBarsWhenDeactivate)
          Sets if the floating dockable bars should be hidden automatically when the main frame is deactivated.
 void setInitBounds(Rectangle initBounds)
          Sets the initial bounds of the main frame.
 void setInitState(int initState)
          Sets the initial state of the main frame.
 void setPreserveAvailableProperty(boolean preserveAvailableProperty)
           
 void setRearrangable(boolean rearrangeable)
          Enable or disable the rearrangement of dockable bars.
 void setShowContextMenu(boolean showContextMenu)
          Sets the flag to show context menu or not.
 void setShowInitial(boolean value)
          A client may specify that the docking layout is to be initialized without showing the window.
 void setUseGlassPaneEnabled(boolean useGlassPaneEnabled)
          Enables us to use glass pane to for cursor change purpose.
 void showContextMenu(MouseEvent e, Component component)
          Show context menu of dockable bar or dockable bar container.
 void showDockableBar(String key)
          Sets the dockable bar visible using the key of that dockable bar.
 void showInitial()
          A client may specify that the docking layout is to be initialized without showing the window.
protected  void sortDockableBarRowItems(List row)
           
 void switchRootPaneContainer(RootPaneContainer rootContainer)
          Change the root pane container.
 void toggleState(DockableBar bar)
          Toggle the dockable bar's state.
 void toggleState(String key)
          Toggle the dockable bar's state.
 void updateComponentTreeUI()
          Since there are several top level container in DockableBarManager, this method will call updateComponentTreeUI to all of them to make sure everything changes after reset look and feel.
 
Methods inherited from class com.jidesoft.swing.AbstractLayoutPersistence
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getAvailableLayouts, getLayoutDirectory, getLayoutPersistenceName, getLayoutRawData, getLoadCallback, getProfileKey, getPropertyChangeListeners, getPropertyChangeListeners, getSaveCallback, getVersion, getXmlEncoding, isLast, isLayoutAvailable, isLayoutDataVersionValid, isLoadingLayoutData, isNeedFormatCheck, isUsePref, isVersionCompatible, isXmlFormat, loadInitialLayout, loadInitialLayout, loadLayoutData, loadLayoutDataFrom, loadLayoutDataFromFile, removeLayout, removePropertyChangeListener, removePropertyChangeListener, saveLayoutData, saveLayoutDataAs, saveLayoutDataToFile, setLast, setLayoutDirectory, setLayoutPersistenceName, setLayoutRawData, setLoadCallback, setLoadingLayoutData, setNeedFormatCheck, setProfileKey, setSaveCallback, setUseFrameBounds, setUseFrameState, setUsePref, setVersion, setXmlEncoding, setXmlFormat, shouldUseFrameBounds, shouldUseFrameState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.swing.LayoutPersistence
getAvailableLayouts, getLayoutDirectory, getLayoutPersistenceName, getLayoutRawData, getLoadCallback, getSaveCallback, getVersion, getXmlEncoding, isLast, isLayoutAvailable, isLayoutDataVersionValid, isNeedFormatCheck, isXmlFormat, loadInitialLayout, loadInitialLayout, loadLayoutData, loadLayoutDataFrom, loadLayoutDataFromFile, removeLayout, saveLayoutData, saveLayoutDataAs, saveLayoutDataToFile, setLast, setLayoutDirectory, setLayoutPersistenceName, setLayoutRawData, setLoadCallback, setNeedFormatCheck, setProfileKey, setSaveCallback, setUseFrameBounds, setUseFrameState, setUsePref, setVersion, setXmlEncoding, setXmlFormat
 

Field Detail

_componentListener

public ComponentAdapter _componentListener

_preDragSnapshot

protected DefaultDockableBarManager.DockableBarsSnapshot _preDragSnapshot

_postDragSnapshot

protected DefaultDockableBarManager.DockableBarsSnapshot _postDragSnapshot

listenerList

protected EventListenerList listenerList
A list of event listeners for this component.


_redispatchingKeyEventToFloaters

protected boolean _redispatchingKeyEventToFloaters

PROPERTY_INIT_BOUNDS

public static final String PROPERTY_INIT_BOUNDS
See Also:
Constant Field Values

PROPERTY_INIT_STATE

public static final String PROPERTY_INIT_STATE
See Also:
Constant Field Values

PROPERTY_HIDABLE

public static final String PROPERTY_HIDABLE
See Also:
Constant Field Values

PROPERTY_FLOATABLE

public static final String PROPERTY_FLOATABLE
See Also:
Constant Field Values

PROPERTY_REARRANGABLE

public static final String PROPERTY_REARRANGABLE
See Also:
Constant Field Values

PROPERTY_HIDE_FLOATING_DOCKABLE_BARS_WHEN_DEACTIVATE

public static final String PROPERTY_HIDE_FLOATING_DOCKABLE_BARS_WHEN_DEACTIVATE
See Also:
Constant Field Values

PROPERTY_SHOW_CONTEXT_MENU

public static final String PROPERTY_SHOW_CONTEXT_MENU
See Also:
Constant Field Values

PROPERTY_DOUBLE_CLICK_ACTION

public static final String PROPERTY_DOUBLE_CLICK_ACTION
See Also:
Constant Field Values

_glassPaneVisibility

protected boolean _glassPaneVisibility
Constructor Detail

DefaultDockableBarManager

public DefaultDockableBarManager(RootPaneContainer rootContainer,
                                 Container contentContainer)
Constructor. DockingManager must work with a RootPaneContainer. Once RootPaneContainer is initialized, user needs to call getWorkspace() to get the workspace area, then add a JDesktopPane (for MDI) or a DocumentPane (for TDI, part of JIDE Components) to it.,
Note: It will automatically set BorderLayout to ContentPane. User can call getContentPane().add(comp, BorderLayout.NORTH) with NORTH, SOUTH, EAST or WEST as parameter, but never add a component to CENTER.

Parameters:
rootContainer - the root pane container
contentContainer - the container where the dockable bars will be added. This container should be empty.
Method Detail

switchRootPaneContainer

public void switchRootPaneContainer(RootPaneContainer rootContainer)
Description copied from interface: DockableBarManager
Change the root pane container. The root pane container is set as a parameter in constructor of DockableBarManager. However if the content container is moved to another root pane container, you need to call this method to let DockableBarManager know the change.

We suggest you call saveLayout to a known location before calling this method, then call loadLayout to load the saved layout back after calling to switchRootPaneContainer to make sure dockable dockable bars are laid out correctly in the new root pane container.

Specified by:
switchRootPaneContainer in interface DockableBarManager

setFloatingDockableBarsVisible

public void setFloatingDockableBarsVisible(boolean show)
Description copied from interface: DockableBarManager
Sets all floating dockable bar visible or invisible.

Specified by:
setFloatingDockableBarsVisible in interface DockableBarManager

hackSetFrameVisible

protected void hackSetFrameVisible(FloatingDockableBarContainer floatingContainer,
                                   boolean show)
There is a bug that prevents setVisible() from working properly in a specific situation. If there is a floatingContainer, a menu is open, and a menu is then selected in a different window, a race condition occurs where the two windows repeatedly activate and deactivate opposite each other.

Until that bug can be resolved, hide the floatingContainer by moving it far offscreen.

Parameters:
floatingContainer - the floating container
show - visible or invisible

hackIsFrameVisible

protected boolean hackIsFrameVisible(FloatingDockableBarContainer floatingContainer)
There is a bug that prevents setVisible() from working properly in a specific situation. If there is a floatingContainer, a menu is open, and a menu is then selected in a different window, a race condition occurs where the two windows repeatedly activate and deactivate opposite each other.

Until that bug can be resolved, a floatingContainer is hidden by moving it far offscreen. So it is "visible" if it not far offscreen.

Parameters:
floatingContainer - the floating container
Returns:
Is it visible?

isOwnedFloatingDockableBar

protected boolean isOwnedFloatingDockableBar(Window aWindow)
Is the specified window one of our floatingFrames?

Parameters:
aWindow - the window
Returns:
Is it?

isOwnedWindow

protected boolean isOwnedWindow(Window aWindow)
Is the specified window's ancestor is root pane container?

Parameters:
aWindow - the window
Returns:
Is it?

eventDispatched

public void eventDispatched(AWTEvent event)
Specified by:
eventDispatched in interface AWTEventListener

resetToDefault

public void resetToDefault()
Resets layout of frames to initial values.
This method is Swing thread-safe.

Specified by:
resetToDefault in interface LayoutPersistence

addDockableBar

public void addDockableBar(DockableBar bar)
Adds a dockable bar to this DockableBarManager.
This method is Swing thread-safe.

Specified by:
addDockableBar in interface DockableBarManager
Parameters:
bar - the dockable bar to be added

removeAllDockableBars

public void removeAllDockableBars()
Removes all dockable bars from this DockingManager.
This method is Swing thread-safe.

Specified by:
removeAllDockableBars in interface DockableBarManager

removeExtraContexts

public void removeExtraContexts()
Description copied from interface: DockableBarManager
Removes extra DockableBarContexts that is saved in cache but the corresponding dockable bars are not in DockableBarManager anymore.

Specified by:
removeExtraContexts in interface DockableBarManager

removeDockableBar

public void removeDockableBar(String name)
Removes a dockable bar from this DockableBarManager.
This method is Swing thread-safe.

Specified by:
removeDockableBar in interface DockableBarManager
Parameters:
name - name of dockable bar to be removed

removeDockableBar

public void removeDockableBar(String key,
                              boolean keepPreviousState)
Removes a dockable bar from this DockableBarManager. This method has an option to keep previous state. In most cases, you don't want to keep the previous states when removing dockable bar. That's what removeDockableBar(String) does. However if you just remove the dockable bar and will add it back later, you can keep the state so that when the dockable bar is added back, it has the exact same state as before.
This method is Swing thread-safe.

Parameters:
key - the key of the dockable bar.
keepPreviousState - if previous state should be kept for future use

showDockableBar

public void showDockableBar(String key)
Sets the dockable bar visible using the key of that dockable bar.
This method is Swing thread-safe.

Specified by:
showDockableBar in interface DockableBarManager
Parameters:
key - the key of the dockable bar to be shown

getDockableBar

public DockableBar getDockableBar(String key)
Gets the dockable bar using key.

Specified by:
getDockableBar in interface DockableBarManager
Parameters:
key - the dockable bar key
Returns:
the dockable bar which has the key.

hideDockableBar

public void hideDockableBar(String key)
Sets the dockable bar invisible using the key of that dockable bar.
This method is Swing thread-safe.

Specified by:
hideDockableBar in interface DockableBarManager
Parameters:
key - the key of the dockable bar to be hidden

dockDockableBar

public void dockDockableBar(DockableBar bar,
                            int side,
                            int row,
                            boolean createNewRow,
                            int start)
Docks the dockable bar on the side and at the start.
This method is Swing thread-safe.

Specified by:
dockDockableBar in interface DockableBarManager
Parameters:
bar - the dockable bar to be docked
side - four possible sides
row - the row index
createNewRow - true to create a new row at the specified row index. Otherwise uses the existing row.
start - the starting position, in pixels.
Throws:
IllegalArgumentException - if side is not a valid value.

floatDockableBar

public void floatDockableBar(DockableBar bar,
                             Rectangle bounds)
Float the dockable bar.
This method is Swing thread-safe.

Specified by:
floatDockableBar in interface DockableBarManager
Parameters:
bar - the dockable bar to be floated
bounds - the bounds of the float dockable bar

beginDraggingDockableBar

public void beginDraggingDockableBar(JComponent f,
                                     int mouseX,
                                     int mouseY,
                                     double relativeX,
                                     double relativeY,
                                     boolean startInFloat)
This method is normally called when the user has indicated that they will begin dragging a component around. This method should be called prior to any dragDockableBar() calls to allow the DockableBarManager to prepare any necessary state. Normally f will be a DockableBar.

Specified by:
beginDraggingDockableBar in interface DockableBarManager
Parameters:
f - the component
mouseX - the x value of mouse point
mouseY - the y value of mouse point
relativeX - relative x value
relativeY - relative y value
startInFloat - if the dragging starts from a floated state

createDockableBarsSnapshot

protected DefaultDockableBarManager.DockableBarsSnapshot createDockableBarsSnapshot(JComponent possiblyMoved)
Take a snapshot of the currently showing DockableBars.

Parameters:
possiblyMoved - the component (should be a DockableBar) which is being moved
Returns:
the snapshot of the currently showing DockableBars

sortDockableBarRowItems

protected void sortDockableBarRowItems(List row)

pauseDragDockableBar

public void pauseDragDockableBar()
Description copied from interface: DockableBarManager
Pause the dragging session of a dockable bar. It simply hide any indication of it's being dragging. dragDockableBar will automatically resume the dragging session.

Specified by:
pauseDragDockableBar in interface DockableBarManager

cancelDragging

public void cancelDragging()
Cancel the dragging.
This method is Swing thread-safe.


dragDockableBar

public void dragDockableBar(JComponent f,
                            int newX,
                            int newY,
                            int mouseModifiers)
The user has moved the dockable bar. Calls to this method will be preceded by calls to beginDraggingDockableBar(). Normally f will be a DockableBar.

Specified by:
dragDockableBar in interface DockableBarManager
Parameters:
f - the component
newX - new X
newY - new Y
mouseModifiers - the mouse modifiers

endDraggingDockableBar

public void endDraggingDockableBar()
This method signals the end of the dragging session. Any state maintained by the DockableBarManager can be removed here. Normally f will be a DockableBar.

Specified by:
endDraggingDockableBar in interface DockableBarManager

checkForRearrangedDockableBars

protected void checkForRearrangedDockableBars()
Compare the pre- and post-drag snapshots to determine if a DockableBar changed rows, changed position within a row, or was resized. If so, fire an event.


addDockableBarsRearrangedListener

public void addDockableBarsRearrangedListener(DockableBarsRearrangedListener l)
Adds the specified listener to receive DockableBarsRearrangedEvents from this DockableBarManager.

Specified by:
addDockableBarsRearrangedListener in interface DockableBarManager
Parameters:
l - the DockableBarsRearrangedListener

removeDockableBarsRearrangedListener

public void removeDockableBarsRearrangedListener(DockableBarsRearrangedListener l)
Removes the specified DockableBarsRearrangedListener so that it no longer receives DockableBarsRearrangedEvents from this DockableBarManager.

Specified by:
removeDockableBarsRearrangedListener in interface DockableBarManager
Parameters:
l - the DockableBarsRearrangedListener

getDockableBarsRearrangedListeners

public DockableBarsRearrangedListener[] getDockableBarsRearrangedListeners()
Returns an array of all the DockableBarsRearrangedListeners added to this DockableBarManager with addDockableBarsRearrangedListener.

Specified by:
getDockableBarsRearrangedListeners in interface DockableBarManager
Returns:
all of the DockableBarsRearrangedListeners added or an empty array if no listeners have been added
Since:
1.4
See Also:
addDockableBarsRearrangedListener(com.jidesoft.action.event.DockableBarsRearrangedListener)

fireDockableBarsRearranged

protected void fireDockableBarsRearranged(DockableBarsRearrangedEvent event)
Fires a DockableBarsRearrangedEvent.

Parameters:
event - the event being fired

findComponentInSnapshot

protected DockableBarState findComponentInSnapshot(Component component,
                                                   DefaultDockableBarManager.DockableBarsSnapshot snapshot)

getTransition

protected DockableBarStateTransition getTransition(DockableBarState preState)
Find the nature of the transition of a moved Component.

Parameters:
preState - the original DockableBar state data
Returns:
the state transition, including ID and pre- and post-data

beginResizingDockableBar

public void beginResizingDockableBar(JComponent f,
                                     int direction)
This methods is normally called when the user has indicated that they will begin resizing the dockable bar. This method should be called prior to any resizeDockableBar() calls to allow the DockableBarManager to prepare any necessary state. Normally f will be a DockableBar.

Specified by:
beginResizingDockableBar in interface DockableBarManager
Parameters:
f - the component
direction - the resize direction

resizingDockableBar

public void resizingDockableBar(JComponent f,
                                int newX,
                                int newY,
                                int newWidth,
                                int newHeight,
                                int deltaX,
                                int deltaY)
The user has resized the component. Calls to this method will be preceded by calls to beginResizingDockableBar(). Normally f will be a DockableBar.

Specified by:
resizingDockableBar in interface DockableBarManager
Parameters:
f - the component
newX - new X
newY - new Y
newWidth - new width
newHeight - new height

endResizingDockableBar

public void endResizingDockableBar(JComponent f)
This method signals the end of the resize session. Any state maintained by the DockableBarManager can be removed here. Normally f will be a DockableBar.

Specified by:
endResizingDockableBar in interface DockableBarManager
Parameters:
f - the component

getRootPaneContainer

public RootPaneContainer getRootPaneContainer()
Description copied from interface: DockableBarManager
Gets root pane container. Root pane container is the JFrame, JWindow, JDialog or JApplet where this manager is installed to.

Specified by:
getRootPaneContainer in interface DockableBarManager
Specified by:
getRootPaneContainer in interface RootPanePersistence
Returns:
root pane container

getMainContainer

public MainContainer getMainContainer()
Gets the main container. Main container is the container that contains all docked window within the main frame. It doesn't include side bars, doesn't include toolbar or menu bar.

Specified by:
getMainContainer in interface DockableBarManager
Returns:
main container

isLoadDataSuccessful

public boolean isLoadDataSuccessful()
Did the loadLayoutFrom(InputStream in) method load successfully from the input stream (false indicates that it called resetToDefault to load the layout.) This method can be called immediately after the loadLayoutFrom(InputStream in) call to determine if a specific LayoutPersistence was forced to call resetToDefault.

Specified by:
isLoadDataSuccessful in interface LayoutPersistence
Returns:
boolean did it load successfully from the input stream (false indicates that it called resetToDefault to load the layout.)

beginLoadLayoutData

public void beginLoadLayoutData()
Starts a process to add/remove dockable bar without showing on screen immediately. Any call to loadLayoutDataXxx methods or resetToDefault() will mark the process.

Specified by:
beginLoadLayoutData in interface LayoutPersistence

loadLayoutFrom

public boolean loadLayoutFrom(Document document)
Description copied from interface: LayoutPersistence
Load layout data from an Node that specified as node parameter. If any exception happens during the read, it will call resetLayout() to use default layout.

Specified by:
loadLayoutFrom in interface LayoutPersistence
Parameters:
document - the Document where the layout data will be read from
Returns:
boolean true if load successfully. Otherwise false.

loadLayoutFrom

public boolean loadLayoutFrom(InputStream in)
Load layout data from an InputStream that specified as in parameter. If any exception happens during the read, it will call resetLayout() to use default layout.


If you use this method to load an InputStream you get from layout file that saved saveLayoutDataAsFile, please call convertStream first.

Specified by:
loadLayoutFrom in interface LayoutPersistence
Parameters:
in - the InputStream where the layout data will be read from.
Returns:
boolean did it load successfully from the input stream (false indicates that it called resetToDefault to load the layout.)

setShowInitial

public void setShowInitial(boolean value)
Description copied from interface: DockableBarManager
A client may specify that the docking layout is to be initialized without showing the window. In this case, the client is responsible for calling showInitial() the first time the window is to be shown.

Default is true, show the window at the end of initial layout.

Specified by:
setShowInitial in interface DockableBarManager

isShowInitial

public boolean isShowInitial()
Description copied from interface: DockableBarManager
A client may specify that the docking layout is to be initialized without showing the window. In this case, the client is responsible for calling showInitial() the first time the window is to be shown.

Specified by:
isShowInitial in interface DockableBarManager

showInitial

public void showInitial()
Description copied from interface: DockableBarManager
A client may specify that the docking layout is to be initialized without showing the window. In this case, the client is responsible for calling showInitial() the first time the window is to be shown.

Specified by:
showInitial in interface DockableBarManager

saveLayoutTo

public void saveLayoutTo(Document document)
                  throws ParserConfigurationException
Description copied from interface: LayoutPersistence
Save layout data to a Document that specified as document parameter.

Specified by:
saveLayoutTo in interface LayoutPersistence
Parameters:
document - the Document where the layout data will be written to
Throws:
ParserConfigurationException - if any parser exception happens when writing to the document.

saveLayoutTo

public void saveLayoutTo(OutputStream out)
                  throws IOException
Save layout data to an OutputStream that specified as out parameter.

Specified by:
saveLayoutTo in interface LayoutPersistence
Parameters:
out - the OutputStream where the layout data will be written to.
Throws:
IOException

toggleState

public void toggleState(String key)
Toggle the dockable bar's state. If it's docked, change to floating mode; if it's floating, change to docked mode.

Specified by:
toggleState in interface DockableBarManager
Parameters:
key - the key of the dockable bar to be toggle state.

toggleState

public void toggleState(DockableBar bar)
Description copied from interface: DockableBarManager
Toggle the dockable bar's state. If it's docked, change to floating mode; if it's floating, change to docked mode.

Specified by:
toggleState in interface DockableBarManager
Parameters:
bar - the dockable bar to toggle state

removeFromHiddenDockableBars

public void removeFromHiddenDockableBars(String key)
Remove it from hidden dockable bar list.

Specified by:
removeFromHiddenDockableBars in interface DockableBarManager
Parameters:
key - the key of the dockable bar

isRearrangable

public boolean isRearrangable()
If the dockable bars can be rearranged.

Specified by:
isRearrangable in interface DockableBarManager
Returns:
Return true if the dockable bars can be rearranged by user.

setRearrangable

public void setRearrangable(boolean rearrangeable)
Enable or disable the rearrangement of dockable bars. It will enable or disable all dockable bar.

Specified by:
setRearrangable in interface DockableBarManager
Parameters:
rearrangeable - true if the dockable bars can be rearranged by user.

isFloatable

public boolean isFloatable()
Return true if floating is allowed for dockable bars.

Specified by:
isFloatable in interface DockableBarManager
Returns:
true if floating is allowed

setFloatable

public void setFloatable(boolean floatable)
Enable or disable floating of dockable bars.

Specified by:
setFloatable in interface DockableBarManager
Parameters:
floatable - the flag

isHidable

public boolean isHidable()
Return true if hidden is allowed for dockable bars.

Specified by:
isHidable in interface DockableBarManager
Returns:
true if hidden is allowed

setHidable

public void setHidable(boolean hidable)
Enable or disable dockable bars from being hidden.

Specified by:
setHidable in interface DockableBarManager
Parameters:
hidable - the flag

updateComponentTreeUI

public void updateComponentTreeUI()
Since there are several top level container in DockableBarManager, this method will call updateComponentTreeUI to all of them to make sure everything changes after reset look and feel.

Specified by:
updateComponentTreeUI in interface DockableBarManager

getAllDockableBars

public Collection<DockableBar> getAllDockableBars()
Getss a collection of all dockable bars.

Specified by:
getAllDockableBars in interface DockableBarManager
Returns:
the collection of all dockable bars.
See Also:
DockableBarManager.getAllDockableBarNames()

getAllDockableBarNames

public List<String> getAllDockableBarNames()
Gets a list of all dockable bars. It's clone of the list maintained by the DockableBarManager.

Specified by:
getAllDockableBarNames in interface DockableBarManager
Returns:
the list of all dockable bars

getInitBounds

public Rectangle getInitBounds()
Gets initial bounds of the main frame. If init bounds is never set before, it will return the smaller one screen size and {0, 0, 1024, 768)

Specified by:
getInitBounds in interface DockableBarManager
Returns:
initial bounds

setInitBounds

public void setInitBounds(Rectangle initBounds)
Sets the initial bounds of the main frame.

Specified by:
setInitBounds in interface DockableBarManager
Parameters:
initBounds - the initial bounds

getInitState

public int getInitState()
Gets initial state of the main frame. State could be the states that are specified in Frame.getExtendedState(). If user never sets the init state before, it will return Frame.NORMAL if the init bounds is less than screen size. If init bounds is larger than screen size, it will return Frame.MAXIMIZED_BOTH (under JDK 1.4 and above only) .

Specified by:
getInitState in interface DockableBarManager
Returns:
the initial state

setInitState

public void setInitState(int initState)
Sets the initial state of the main frame. State can be the states that are specified in Frame.getExtendedState().

Specified by:
setInitState in interface DockableBarManager
Parameters:
initState - the initial state
See Also:
Frame.setExtendedState(int), Frame.getExtendedState()

getDockableBarContextOf

public DockableBarContext getDockableBarContextOf(String key)
Gets dock context of a dockable bar specified by key. If it has dock context, return the context; or else, return null.

Specified by:
getDockableBarContextOf in interface DockableBarManager
Parameters:
key - the dockable bar key
Returns:
If it has dock context, return the context; or else, return null

getDockableBarPopupMenuCustomizer

public DockableBarPopupMenuCustomizer getDockableBarPopupMenuCustomizer()
Gets the popup menu customizer.

Specified by:
getDockableBarPopupMenuCustomizer in interface DockableBarManager
Returns:
popup menu customizer
See Also:
DockableBarManager.setDockableBarPopupMenuCustomizer(DockableBarPopupMenuCustomizer)

setDockableBarPopupMenuCustomizer

public void setDockableBarPopupMenuCustomizer(DockableBarPopupMenuCustomizer customizerDockableBar)
Sets the popup customizerDockableBar.

The menu passed in the the customizePopupMenu already have some menu items. You can remove all of them to add your own, or you can remove some of them. All existing menu items have a unique names. Here are the names - "DockableBar.rearrangeable", "DockableBar.hidable", "DockableBar.floatable" and the key of each dockable bar which are used to show or hide the corresponding dockable bar. There are also constants beginning with CONTEXT_MENU_xxx defined on DockableBarManager. The names should be very obvious to what the menu item do. So instead of using absolute menu item index, it'd better to use the name to look up a particular menu item.

Specified by:
setDockableBarPopupMenuCustomizer in interface DockableBarManager
Parameters:
customizerDockableBar -
See Also:
DockableBarManager.getDockableBarPopupMenuCustomizer()

dispose

public void dispose()
Removes all used resources.

Specified by:
dispose in interface DockableBarManager

isHideFloatingDockableBarsWhenDeactivate

public boolean isHideFloatingDockableBarsWhenDeactivate()
Description copied from interface: DockableBarManager
Checks if the floating dockable bars should be hidden automatically when the main frame is deactivated.

Specified by:
isHideFloatingDockableBarsWhenDeactivate in interface DockableBarManager
Returns:
true if the floating dockable bars are hidden automatically when the main frame is deactivated.

setHideFloatingDockableBarsWhenDeactivate

public void setHideFloatingDockableBarsWhenDeactivate(boolean hideFloatingDockableBarsWhenDeactivate)
Description copied from interface: DockableBarManager
Sets if the floating dockable bars should be hidden automatically when the main frame is deactivated.

Specified by:
setHideFloatingDockableBarsWhenDeactivate in interface DockableBarManager

getDockableBarContainer

public DockableBarContainer getDockableBarContainer(int side)
Description copied from interface: DockableBarManager
Gets the dockable bar container by side.

Specified by:
getDockableBarContainer in interface DockableBarManager
Returns:
dockable bar container

createDockableBarContainer

public DockableBarContainer createDockableBarContainer()
Description copied from interface: DockableBarManager
Creates the containers for DockableBars.

Specified by:
createDockableBarContainer in interface DockableBarManager
Returns:
the DockableBarContainer.

showContextMenu

public void showContextMenu(MouseEvent e,
                            Component component)
Description copied from interface: DockableBarManager
Show context menu of dockable bar or dockable bar container.

Specified by:
showContextMenu in interface DockableBarManager
Parameters:
e - source of the event
component - dockable bar or dockable bar container

getContextMenu

public JPopupMenu getContextMenu()
Description copied from interface: DockableBarManager
Gets the default context menu for DockableBarManager. The menu has menu items to show/hide any dockable bar and changes options such as rearrangeable, hidable and floatable.

Specified by:
getContextMenu in interface DockableBarManager
Returns:
the default context menu.

createFloatingDockableBarContainer

public FloatingDockableBarContainer createFloatingDockableBarContainer(Window owner)
Creates a window which contains the toolbar after it has been dragged out from its container

Specified by:
createFloatingDockableBarContainer in interface DockableBarManager
Parameters:
owner - the owner of the FloatingDockableBarContainer.
Returns:
a FloatingDockableBarContainer object, containing the toolbar.

isShowContextMenu

public boolean isShowContextMenu()
Checks if the context menu should be shown.

Specified by:
isShowContextMenu in interface DockableBarManager
Returns:
true if context menu will be shown. Otherwise false.

setShowContextMenu

public void setShowContextMenu(boolean showContextMenu)
Sets the flag to show context menu or not.

Specified by:
setShowContextMenu in interface DockableBarManager
Parameters:
showContextMenu - the flag

redispatchKeyEventToFloatingContainers

protected boolean redispatchKeyEventToFloatingContainers(KeyEvent e)
Give the floating windows a crack at a KeyEvent that has gone unconsumed in the main window.

Parameters:
e - the KeyEvent
Returns:
boolean true if the event is consumed

processKeyBindingForFloatingDockableWindow

protected void processKeyBindingForFloatingDockableWindow(KeyEvent e,
                                                          JWindow dockableWindow)

processKeyBindingsForContainerInFloatingDockable

protected void processKeyBindingsForContainerInFloatingDockable(KeyEvent e,
                                                                Container container)

processKeyBindingForComponentInFloatingDockable

protected void processKeyBindingForComponentInFloatingDockable(KeyEvent e,
                                                               JComponent comp)

getDockableBarFactory

public DockableBarFactory getDockableBarFactory()
Description copied from interface: DockableBarManager
Gets the dockable bar factory. The factory is used in loadInitialLayout() method. If the dockable bar exists in initial layout but not added to DockingManager, the factory will be used to create the dockable bar.

Specified by:
getDockableBarFactory in interface DockableBarManager
Returns:
the dockable bar factory.

setDockableBarFactory

public void setDockableBarFactory(DockableBarFactory dockableBarFactory)
Description copied from interface: DockableBarManager
Sets the dockable bar factory.

Specified by:
setDockableBarFactory in interface DockableBarManager

loadInitialLayout

public void loadInitialLayout(Document layoutDocument)
Description copied from interface: LayoutPersistence
Load initial layout from an initial layout file designed by Visual Designer. To use this method, you need to load the initial layout into Document which represents XML document.

Specified by:
loadInitialLayout in interface LayoutPersistence
Parameters:
layoutDocument - the Document contains an initial layout.

isUseGlassPaneEnabled

public boolean isUseGlassPaneEnabled()
Checks if we will use glass pane to change cursor.

Specified by:
isUseGlassPaneEnabled in interface DockableBarManager
Returns:
true or false.

setUseGlassPaneEnabled

public void setUseGlassPaneEnabled(boolean useGlassPaneEnabled)
Enables us to use glass pane to for cursor change purpose.

Specified by:
setUseGlassPaneEnabled in interface DockableBarManager
Parameters:
useGlassPaneEnabled - the flag

setDockableBarAvailable

public void setDockableBarAvailable(String key)
Sets available the dockable bar.

Specified by:
setDockableBarAvailable in interface DockableBarManager
Parameters:
key - The key of the dockable bar.

setDockableBarUnavailable

public void setDockableBarUnavailable(String key)
Sets unavailable the dockable bar.

Specified by:
setDockableBarUnavailable in interface DockableBarManager
Parameters:
key - The key of the dockable bar.

isPreserveAvailableProperty

public boolean isPreserveAvailableProperty()

setPreserveAvailableProperty

public void setPreserveAvailableProperty(boolean preserveAvailableProperty)

checkBarKey

protected void checkBarKey(String key,
                           String methodName)

getDoubleClickAction

public int getDoubleClickAction()
Gets the action when user double clicks on the title bar of a dockable bar. It could be either DOUBLE_CLICK_TO_FLOAT by default or DOUBLE_CLICK_NONE if you don't want to have any action associated with double click.

Specified by:
getDoubleClickAction in interface DockableBarManager
Returns:
the action of double click on title bar.

setDoubleClickAction

public void setDoubleClickAction(int doubleClickAction)
Sets the action when user double clicks on the title bar of a dockable bar.

Specified by:
setDoubleClickAction in interface DockableBarManager
Parameters:
doubleClickAction - either DOUBLE_CLICK_TO_FLOAT or DOUBLE_CLICK_NONE.

JIDE 3.5.15