ilog.views.appframe.swing
Class IlvDockingBarArea

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 ilog.views.appframe.swing.IlvDockingBarArea
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class IlvDockingBarArea
extends JPanel

Defines panels that contain menu bars and dockable toolbars. Bars can be dynamically rearranged in the pane by drag-and-drop. They can be detached, dragged, and dropped in floating windows (they are undocked) or dropped in one of the four sides of the panel (they are docked).

Docking bar areas are composed of 5 subcontainers that are organized within the panel using a BorderLayout:

Settings

Docking bar areas are initialized from the settings with a settings element of type barConfigs. This element defines the properties of the bars that are contained within the docking bar area and a variable number of configurations that determine how those bars are arranged within this area.
Bar Properties
They are used to create and initialize the bars that are referred to within the bar configurations. A bar is created with the method createBar(java.lang.String, java.lang.String) using the name and the bar type specified within the settings and then initialized with other properties specified in the settings. Bar properties are defined in a settings element of type bars. This element contains one bar element for each bar of which the properties are to be defined. A bar element is defined with the attributes:

Bar Configurations
They define how bars are arranged in the docking bar area. The docking area is initialized with the configuration considered as the default one, the name of which equals one of these two values: "default" or "design". At runtime, it is possible to switch off bar configurations with the setConfiguration(java.lang.String) method.
A bar configuration is defined with a settings element of type config. It contains the positions of all the docked bars in a settings child element of type panes and the positions of all the floatable windows containing undocked bars in a settings child element of type floats.

A panes element contains 0 to 4 pane elements, each pane element providing the bar positions within a side panel. The orientation attribute determines which side panel the pane element provides the settings for. The value of this attribute is equal to one of the following values:

A pane element contains a variable number of position elements: one position element for each bar contained by the side panel. position elements are defined with the attributes:

The floats element contains float child elements, each float element defining the settings of one floating window that contains one undocked bar. A float element is defined with the following attributes:

Here is the schema for specifying the settings of a docking bar area:

<?xml version="1.0" encoding="UTF-8"?>
 <!ELEMENT barConfigs (config+, bars)>
 <!ATTLIST barConfigs
 name CDATA #IMPLIED
 >
 <!ELEMENT config (panes, floats?)>
 <!ATTLIST config
           name CDATA #REQUIRED
 >
 <!ELEMENT panes (pane+)>
 <!ELEMENT pane (position*)>
 <!ATTLIST pane
           orientation (bottom | left | right | top) #REQUIRED
 >
 <!ELEMENT position EMPTY>
 <!ATTLIST position
          name CDATA #REQUIRED
          visible (true | false) "true"
          lastVisible (true | false)
          row #IMPLIED
          height CDATA #IMPLIED
          width CDATA #IMPLIED
          x CDATA #IMPLIED
          y CDATA #IMPLIED
 >
 <!ELEMENT floats (float*)>
 <!ELEMENT float EMPTY>
 <!ATTLIST float
          name CDATA #REQUIRED
          visible (false | true) "true"
          x CDATA #REQUIRED
          y CDATA #REQUIRED
 >
 <!ELEMENT bars (bar+)>
 <!ELEMENT bar EMPTY>
 <!ATTLIST bar
          barType (menu | toolbar) "toolbar"
          dockable (false | true) "true"
          extensible (false | true) "false"
          name CDATA #REQUIRED
          title CDATA #REQUIRED
 >

Extension of Bar Configurations
When extending an application, it may be necessary to add new bars to the bar configurations of the application. You can do this without redefining a complete set of bar configurations, by defining bar configuration extensions in the settings. They are defined within setting elements of type barConfigsExtension. Here is the XML format of these setting elements:
<barConfigExtension>

Here is the schema for defining bar configuration extensions within XML settings:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT barConfigExtension (actions, bars)>
<!ATTLIST barConfigExtension
          name CDATA #IMPLIED
>
<!ELEMENT actions (dock, undock, show, hide)*>
<!ELEMENT dock EMPTY>
<!ATTLIST dock
          name CDATA #REQUIRED
          orientation (bottom | left | right | top) #REQUIRED
>
<!ELEMENT undock EMPTY>
<!ATTLIST undock
          name CDATA #REQUIRED
          x CDATA #REQUIRED
          y CDATA #REQUIRED
>
<!ELEMENT hide EMPTY>
<!ATTLIST hide
          name CDATA #REQUIRED
>
<!ELEMENT show EMPTY>
<!ATTLIST show
          name CDATA #REQUIRED
>
<!ELEMENT bars (bar+)>
<!ELEMENT bar EMPTY>
<!ATTLIST bar
          barType (menu | toolbar) "toolbar"
          dockable (false | true) "true"
          extensible (false | true) "false"
          name CDATA #REQUIRED
          title CDATA #REQUIRED
    javaClass CDATA #IMPLIED
>

See Also:
Serialized Form

Nested Class Summary
static interface IlvDockingBarArea.DockingBarInfo
          Provides docking information for a bar managed by a docking bar area.
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String MENU_TYPE
          Specifies bars of type menu bar.
static String TOOLBAR_TYPE
          Specifies bars of type toolbar.
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IlvDockingBarArea()
          Constructs a new IlvDockingBarArea instance.
 
Method Summary
 void addNotify()
          Notifies this component that it now has a parent component.
 JComponent createBar(String name, String type)
          Creates a new bar component with the specified name and the specified type.
 IlvDockingBarArea.DockingBarInfo dock(String name, int side)
          Docks the bar with the specified name to the specified side of the panel.
 IlvApplication getApplication()
          Returns the application of the docking bar area.
 JComponent getBar(String name)
          Returns the bar with the specified name.
 JComponent[] getBarComponents()
          Returns the bars that are managed by this docking bar area.
 IlvComponentVisibilityActionHandler getBarVisibilityActionHandler(String name, String command)
          Returns an action handler that associates the visibility of the name bar with the action with the specified command key.
 Container getClientContainer()
          Returns the container to add user components to.
 String getConfiguration()
          Returns the name of the current bar configuration.
 IlvDockingBarArea.DockingBarInfo getDockingInfo(String name)
          Returns docking information for the bar with the specified name.
 String getUIClassID()
          Returns the name of the L&F class that renders this component.
 boolean isBarDockable(String name)
          Determines whether the bar with the specified name is dockable.
 boolean isBarExtensible(String name)
          Determines whether the bar with the specified name is extensible.
 boolean isBarVisible(String name)
          Determines whether the bar with the specified name is visible.
 void registerBar(String name, JComponent bar, boolean dockable, boolean extensible, String title)
          Registers a new bar within this docking bar area.
 void setApplication(IlvApplication application)
          Sets the application of the docking bar area.
 IlvDockingBarArea.DockingBarInfo setBarVisible(String name, boolean visible)
          Shows or hides the bar with the specified name depending on the value of the visible parameter.
 void setClientContainer(Container container)
          Sets the client container of this docking area.
 void setConfiguration(String name)
          Sets the current configuration of bars to the configuration defined in the settings with the specified name.
 IlvDockingBarArea.DockingBarInfo undock(String name, Point location)
          Undocks the bar with the specified name.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MENU_TYPE

public static final String MENU_TYPE
Specifies bars of type menu bar.

See Also:
createBar(java.lang.String, java.lang.String), TOOLBAR_TYPE, Constant Field Values

TOOLBAR_TYPE

public static final String TOOLBAR_TYPE
Specifies bars of type toolbar.

See Also:
createBar(java.lang.String, java.lang.String), MENU_TYPE, Constant Field Values
Constructor Detail

IlvDockingBarArea

public IlvDockingBarArea()
Constructs a new IlvDockingBarArea instance.

Method Detail

getUIClassID

public String getUIClassID()
Returns the name of the L&F class that renders this component.

Overrides:
getUIClassID in class JPanel
Returns:
the string "ToolBarUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

getClientContainer

public Container getClientContainer()
Returns the container to add user components to. Typically, this container may contain a docking pane area (see IlvDockingArea) or a MDI client (see IlvDesktopPane or IlvMDITabbedPane).

See Also:
setClientContainer(java.awt.Container)

setClientContainer

public void setClientContainer(Container container)
Sets the client container of this docking area.

Parameters:
container - The new client container.
See Also:
getClientContainer()

getApplication

public IlvApplication getApplication()
Returns the application of the docking bar area.

Returns:
The application.
See Also:
setApplication(ilog.views.appframe.IlvApplication)

setApplication

public void setApplication(IlvApplication application)
Sets the application of the docking bar area.

Parameters:
application - The new application of the docking bar area.
See Also:
getApplication()

setConfiguration

public void setConfiguration(String name)
Sets the current configuration of bars to the configuration defined in the settings with the specified name.

See Also:
getConfiguration()

getConfiguration

public String getConfiguration()
Returns the name of the current bar configuration.

See Also:
setConfiguration(java.lang.String)

getBar

public JComponent getBar(String name)
Returns the bar with the specified name.


createBar

public JComponent createBar(String name,
                            String type)
Creates a new bar component with the specified name and the specified type.

Parameters:
name - The name of the bar to create.
type - Specifies the logical type of component to create. Here are the default processed types:.

getDockingInfo

public IlvDockingBarArea.DockingBarInfo getDockingInfo(String name)
Returns docking information for the bar with the specified name.

Returns:
The docking information or null if the name does not correspond to the name of a bar managed by this docking bar area.

registerBar

public void registerBar(String name,
                        JComponent bar,
                        boolean dockable,
                        boolean extensible,
                        String title)
Registers a new bar within this docking bar area.

Parameters:
name - The name of the bar.
bar - The bar component being inserted into the docking bar area.
dockable - Determines whether the bar is dockable. If true, the bar can be docked/undocked; otherwise, the bar will not move from its future docking position.
extensible - If true, the bar will fit the bounds of a full side panel row. Otherwise, the size of the bar depends on the preferred size of the bar and on the size constraints when the bar shares a side panel row with other bars.
title - The title of the floating window containing the bar when it is undocked. The title should be a key to a string resource.

dock

public IlvDockingBarArea.DockingBarInfo dock(String name,
                                             int side)
Docks the bar with the specified name to the specified side of the panel. If the bar was previously invisible, it is set visible. If the bar was undocked, the floating window that contained the bar is hidden.

Parameters:
name - The name of the bar to dock. The name must correspond to the name of a bar managed by the docking bar area. If no bar has been declared with this name in the settings of the docking bar area (see the description of the <bar> settings element), the method registerBar(java.lang.String, javax.swing.JComponent, boolean, boolean, java.lang.String) must be called to register the new bar in the docking bar area.
side - The side of the panel to dock the bar in. It must have one of the following values:
Returns:
The docking info of the bar or null if the name does not correspond to the name of a bar managed by this docking bar area.
See Also:
undock(java.lang.String, java.awt.Point)

undock

public IlvDockingBarArea.DockingBarInfo undock(String name,
                                               Point location)
Undocks the bar with the specified name. If the bar was previously invisible, it is set visible. If the bar was already undocked, the method does nothing.

Parameters:
name - The name of the bar to undock. The name must correspond to the name of a bar managed by the docking bar area. If no bar has been declared with this name in the settings of the docking bar area (see the description of the <bar> settings element), the method registerBar(java.lang.String, javax.swing.JComponent, boolean, boolean, java.lang.String) must be called to register the new bar in the docking bar area.
location - The new location of the floating window that contains the bar. If this parameter is null, the floatable window will be moved to its last location before it was hidden or to the location as defined in the settings for the current bar configuration.
Returns:
The docking information of the bar or null if the name does not correspond to the name of a bar managed by this docking bar area.
See Also:
dock(java.lang.String, int)

setBarVisible

public IlvDockingBarArea.DockingBarInfo setBarVisible(String name,
                                                      boolean visible)
Shows or hides the bar with the specified name depending on the value of the visible parameter.
If the bar has previously been visible before it was hidden, it appears in the same docking state (docked/undocked) that it was in the last time it was visible. Otherwise, the bar appears in the docking state as specified in the settings of the docking area.

Parameters:
name - The name of the bar to change the visibility state of. The name must correspond to the name of a bar managed by the docking bar area. If no bar has been declared with this name in the settings of the docking bar area (see the description of the <bar> settings element), the method registerBar(java.lang.String, javax.swing.JComponent, boolean, boolean, java.lang.String) must be called to register the new bar in the docking bar area.
visible - If true, the bar is shown; otherwise, the bar is hidden.
Returns:
The docking information of the bar or null if the name does not correspond to the name of a bar managed by this docking bar area.
See Also:
isBarVisible(java.lang.String)

isBarVisible

public boolean isBarVisible(String name)
Determines whether the bar with the specified name is visible.

Parameters:
name - The name of the bar. The name must correspond to the name of a bar managed by the docking bar area. If no bar has been declared with this name in the settings of the docking bar area (see the description of the <bar> settings element), the method registerBar(java.lang.String, javax.swing.JComponent, boolean, boolean, java.lang.String) must be called to register the new bar in the docking bar area.
Returns:
true if the bar is visible; false otherwise.
See Also:
setBarVisible(java.lang.String, boolean)

isBarExtensible

public boolean isBarExtensible(String name)
Determines whether the bar with the specified name is extensible. If the bar is extensible, it fits the bounds of a full side panel row when it is docked. No bars can share the same side panel row.

Returns:
true if the bar is extensible; false otherwise.

getBarVisibilityActionHandler

public IlvComponentVisibilityActionHandler getBarVisibilityActionHandler(String name,
                                                                         String command)
Returns an action handler that associates the visibility of the name bar with the action with the specified command key. The action is checked when the bar is visible and unchecked when the bar is invisible. When activating the specified action, for example, by pressing a button associated with the action, the visibility of the bar is toggled. If the bar was visible, it becomes invisible and vice-versa.

The action handler returned by the method must be added to the application using the IlvApplication.addActionHandler(ilog.views.appframe.event.ActionHandler) method to have the state of the specified action updated according to the visibility of the bar.

Returns:
The action handler.

isBarDockable

public boolean isBarDockable(String name)
Determines whether the bar with the specified name is dockable. If the bar is dockable, it can be dragged from one docking position to another. Otherwise, it is not possible to drag-and-drop the bar.

Returns:
true if the bar is dockable; false otherwise.

addNotify

public void addNotify()
Notifies this component that it now has a parent component. When this method is invoked, the chain of parent components is set up with KeyboardAction event listeners.

Overrides:
addNotify in class JComponent
See Also:
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)

getBarComponents

public JComponent[] getBarComponents()
Returns the bars that are managed by this docking bar area.

Returns:
An array of bar components.