public class IlvDockingBarArea extends JPanel
Docking bar areas are composed of 5
subcontainers that are
organized within the panel using a BorderLayout
:
getClientContainer()
.
By default, this container is empty and can be set any kind of component.
Typically, this container may contain a docking pane area
(see IlvDockingArea
) or a MDI client
(see IlvDesktopPane
or
IlvMDITabbedPane
).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:
name
: Provides the name of the bar this element defines
the properties of.title
: Specifies a title for the bar. This title is
the title of the window that contains the bar when it is undocked. It should
be a key to a string resource.barType
: Specifies whether the bar is a menu bar or a
toolbar. The value of the attribute equals "toolbar"
if the
bar is a toolbar and equals "menu"
if the bar is a menu bar.
If this attribute is not set, the value "toolbar"
is used.
This attribute is not used if the attribute javaClass
is
defined for this element.extensible
: Determines whether the bar can share the same
row in a side panel with other bars. If the value of this attribute is
equal to "true"
the bar cannot be on the same row as
another bar. If the attribute is not set or is equal to "false"
,
the bar can be on the same row as another toolbar. If the bar is a menu,
this attribute is not read, the menu is automatically set extensible.dockable
: Determines whether the bar can be docked and undocked.
If the value of the attribute is equal to "true"
the bar can
be docked/undocked. If the value is equal to "false"
, the bar
cannot be docked/undocked. If the bar is a menu, this attribute is not
read and the menu bar is not dockable. If the bar is not a menu bar and
the attribute is not set, the bar is set dockable.javaClass
: Specifies the class of the bar. If this attribute
is not set, an IlvMenuBar
instance will be
created if the specified bar type is a menu or an
IlvToolBar
instance will be created otherwise."default"
or "design"
.
At runtime, it is possible to switch off bar configurations with the
setConfiguration(java.lang.String)
method.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:
"top"
if the panel is the side panel on the top of the
docking bar area."left"
if the panel is the side panel on the left of the
docking bar area."right"
if the panel is the side panel on the right of the
docking bar area."bottom"
if the panel is the side panel on the bottom of the
docking bar area.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:name
: the name of the bar this element provides the position
for. This name should refer to the name of a bar
element
described in the Bar Properties section.visible
: determines whether the bar is visible. If the
value of the attribute is equal to "true"
or if the
attribute is not set, the bar will be visible; otherwise, the bar is not visible.lastVisible
: this attribute is read only if the value of the
visible
attribute of the <pane>
and
<float>
elements corresponding to this pane is false
.
If the value of the attribute is true
, the bar corresponding
to this pane position will be docked to this position the next time it is shown;
otherwise, the bar will be undocked to the floating position
indicated by the <float>
element corresponding to the
bar.row
: provides the index of the row the bar is inserted in
within the bar side panel. The index starts from "0"
for
the first row of the side panel. The first row is x
, y
, width
, and
height
: Provide the bounds of the bar within the
bar panel. These attributes are read only if a row attribute is
specified. If not specified, the bar will be added to a new row that becomes
the last row of the panel.
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:
name
: The name of the bar contained by the floating window.
This name refers to the name of a bar
element
described in the Bar Properties section.visible
: Determines whether the floating window is visible.
If the value of the attribute is equal to "true"
or if the
attribute is not set, the window will be visible; otherwise, the window is not visible.lastVisible
: This attribute is read only if the value of the
visible
attribute of the <pane>
and
<float>
elements corresponding to this pane is false
.
If the value of the attribute is true
, the bar corresponding
to this pane position will be undocked to this position the next time it
is shown; otherwise, the bar is docked to the bar position
indicated by the <pane>
element corresponding to the
bar.x
and y
: Specify the absolute coordinates of the
floating windows.
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>
config
attribute of a barConfigExtension
determines whether the extension applies to a specific bar configuration or
to all the bar configurations that have been defined. If this attribute
is set, its value must reference the name of an existing bar configuration.
Otherwise, the bar extension applies to all the bar configurations.
name
attribute provides the name of the bar to dock and the orientation
attribute specifies on which side of the docking area the bar should be added.
The value of the side
attribute must have one of the four values
"left"
, "top
, "right"
, or
"bottom"
to dock the bar on the left, top, right,
or bottom side respectively of the docking area panel.name
attribute
provides the name of the bar to undock and the x
and
y
attributes provide the location of the floating window
containing the undocked bar.name
attribute
provides the name of the bar to hide.name
attribute
provides the name of the bar to show.
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 >
Modifier and Type | Class and Description |
---|---|
static interface |
IlvDockingBarArea.DockingBarInfo
Provides docking information for a bar managed by a docking bar area.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
MENU_TYPE
Specifies bars of type menu bar.
|
static String |
TOOLBAR_TYPE
Specifies bars of type toolbar.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvDockingBarArea()
Constructs a new
IlvDockingBarArea instance. |
Modifier and Type | Method and Description |
---|---|
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 . |
getAccessibleContext, getUI, paramString, setUI, updateUI
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, 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
public static final String MENU_TYPE
public static final String TOOLBAR_TYPE
public IlvDockingBarArea()
IlvDockingBarArea
instance.public String getUIClassID()
getUIClassID
in class JPanel
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public Container getClientContainer()
IlvDockingArea
) or a MDI client
(see IlvDesktopPane
or
IlvMDITabbedPane
).setClientContainer(java.awt.Container)
public void setClientContainer(Container container)
container
- The new client container.getClientContainer()
public IlvApplication getApplication()
setApplication(ilog.views.appframe.IlvApplication)
public void setApplication(IlvApplication application)
application
- The new application of the docking bar area.getApplication()
public void setConfiguration(String name)
name
.getConfiguration()
public String getConfiguration()
setConfiguration(java.lang.String)
public JComponent getBar(String name)
name
.public JComponent createBar(String name, String type)
name
- The name of the bar to create.type
- Specifies the logical type of component to create. Here are
the default processed types:TOOLBAR_TYPE
:IlvToolBar
instance.MENU_TYPE
:IlvMenuBar
instance.public IlvDockingBarArea.DockingBarInfo getDockingInfo(String name)
null
if the
name does not correspond to the name of a bar managed by this docking
bar area.public void registerBar(String name, JComponent bar, boolean dockable, boolean extensible, String title)
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.public IlvDockingBarArea.DockingBarInfo dock(String name, int side)
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.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:null
if the
name does not correspond to the name of a bar managed by this docking
bar area.undock(java.lang.String, java.awt.Point)
public IlvDockingBarArea.DockingBarInfo undock(String name, Point location)
name
. If the bar was
previously invisible, it is set visible. If the bar was already undocked,
the method does nothing.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.null
if the
name does not correspond to the name of a bar managed by this docking
bar area.dock(java.lang.String, int)
public IlvDockingBarArea.DockingBarInfo setBarVisible(String name, boolean visible)
name
depending on
the value of the visible
parameter.
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.null
if the
name does not correspond to the name of a bar managed by this docking
bar area.isBarVisible(java.lang.String)
public boolean isBarVisible(String name)
name
is visible.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.true
if the bar is visible; false
otherwise.setBarVisible(java.lang.String, boolean)
public boolean isBarExtensible(String name)
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.true
if the bar is extensible; false
otherwise.public IlvComponentVisibilityActionHandler getBarVisibilityActionHandler(String name, String command)
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.
public boolean isBarDockable(String name)
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.true
if the bar is dockable; false
otherwise.public void addNotify()
public JComponent[] getBarComponents()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.