|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.javadocking.dock.LineDock
public class LineDock
This is a dock that can contain zero, one or multiple dockables. The dockables are organized in a line.
Information on using line docks is in How to Use Laef Docks in The Sanaware Developer Guide.
It is a leaf dock. It cannot contain other docks.
When it contains no dockable it is empty. It is never full.
A dockable can be docked in this dock if:
horizontalDockingMode
or verticalDockingMode
as possible docking mode.horizontalDockingMode
or verticalDockingMode
as possible docking mode.
The size of all the child dockables is the same when the grid
property
is set to true, otherwise the size of the different child dockables will be according to the
preferred size of their content component.
The Position
for dockables docked in this dock are one-dimensional.
The first position value of a child dockable is between 0 and the number of child dockables minus 1,
it is the position in the line.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
ORIENTATION_HORIZONTAL
The value for the orientation when the dock is a horizontal line. |
static int |
ORIENTATION_VERTICAL
The value for the orientation when the dock is a vertical line. |
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 | |
---|---|
LineDock()
Constructs a horizontal line dock. |
|
LineDock(int orientation,
boolean grid)
Constructs a line dock with the given orientation. |
|
LineDock(int orientation,
boolean grid,
int horizontalDockingMode,
int verticalDockingMode)
Constructs a line dock with the given orientation. |
Method Summary | |
---|---|
boolean |
addDockable(Dockable dockableToAdd,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset)
Adds a dockable to this dock. |
void |
addDockable(Dockable dockable,
Position position)
Adds the given dockable to this dock at the given position. |
void |
addDockingListener(DockingListener listener)
Adds a listener for DockingEvent s of this dock. |
protected boolean |
canAddDockableWithPriority(Dockable dockable,
java.awt.Point relativeLocation)
Determines if the given dockable can be added to this dock with priority, if the mouse is released at the given position. |
boolean |
canRemoveDockable(Dockable dockable)
Determines if the specified dockable can be removed from this dock. |
protected boolean |
checkDockingModes(Dockable dockable)
Checks the docking modes of the dockable. |
boolean |
containsDockable(Dockable dockable)
Determines if the given dockable is docked in this dock. |
Dockable |
getDockable(int index)
Gets the dockable with the specified index, that is docked in this dock. |
int |
getDockableCount()
Gets the number of dockables that are docked in this dock. |
Position |
getDockablePosition(Dockable dockable)
Gets the position where the dockable is docked in this dock. |
int |
getDockPriority(Dockable dockable,
java.awt.Point relativeLocation)
Determines if the dockable can be added. |
boolean |
getGrid()
Returns whether the content components of the dockables have the same size in this dock. |
int |
getHorizontalDockingMode()
Gets the docking mode for a dockable that is docked in this line dock, if the line dock has a horizontal orientation (ORIENTATION_HORIZONTAL). |
int |
getOrientation()
Gets the orientation of the line dock. |
CompositeDock |
getParentDock()
Gets the parent dock of this dock. |
boolean |
getRealSizeRectangle()
Gets how docking rectangles have to be painted. |
int |
getVerticalDockingMode()
Gets the docking mode for a dockable that is docked in this line dock, if the line dock has a vertical orientation (ORIENTATION_VERTICAL). |
boolean |
isAddCompositeDockables()
Determines if composite dockables may be added to this dock, when it is not empty. |
boolean |
isEmpty()
Determines if this dock doesn't have any dockables docked in it, or doesn't have any child docks docked in it. |
boolean |
isFull()
Determines if any more dockables can be added to this dock. |
void |
loadProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map newChildDocks,
java.util.Map dockablesMap,
java.awt.Window owner)
Loads the properties for this dock. |
boolean |
moveDockable(Dockable dockableToMove,
java.awt.Point relativeLocation)
Moves a dockable to a new position in this dock. |
boolean |
removeDockable(Dockable dockable)
Removes the specified dockable from this dock. |
void |
removeDockingListener(DockingListener listener)
Removes a listener for docking events of this dock. |
int |
retrieveDockingRectangle(Dockable dockable,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset,
java.awt.Rectangle rectangle)
Sets the given rectangle to the position and size of the graphical content component of the dockable, when it will be docked in this dock. |
void |
saveProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map childDockIds)
Saves the properties of this dock in the given properties object. |
void |
setAddCompositeDockables(boolean addCompositeDockables)
Sets if composite dockables may be added to this dock, when it is not empty. |
void |
setGrid(boolean newGrid)
Sets whether the content components of the dockables should have the same size in this dock. |
void |
setHorizontalDockingMode(int horizontalDockingMode)
Sets the docking mode for a dockable that is docked in this line dock, if the line dock has a horizontal orientation (ORIENTATION_HORIZONTAL). |
void |
setOrientation(int newOrientation)
Sets the orientation of the line dock. |
void |
setParentDock(CompositeDock parentDock)
Sets the specified dock as new parent dock of this dock. |
void |
setRealSizeRectangle(boolean realSizeRectangle)
Sets how docking rectangles have to be painted. |
void |
setVerticalDockingMode(int verticalDockingMode)
Sets the docking mode for a dockable that is docked in this line dock, if the line dock has a vertical orientation (ORIENTATION_VERTICAL). |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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 |
---|
public static final int ORIENTATION_HORIZONTAL
public static final int ORIENTATION_VERTICAL
Constructor Detail |
---|
public LineDock()
public LineDock(int orientation, boolean grid)
orientation
- The orientation for the line dock.grid
- True when the dockables will have the same size, false otherwise.public LineDock(int orientation, boolean grid, int horizontalDockingMode, int verticalDockingMode)
orientation
- The orientation for the line dock.grid
- True when the dockables will have the same size, false otherwise.horizontalDockingMode
- The docking mode for a dockable that is docked in this line dock,
if the line dock has a horizontal orientation (ORIENTATION_HORIZONTAL).verticalDockingMode
- The docking mode for a dockable that is docked in this line dock,
if the line dock has a horizontal orientation (ORIENTATION_VERTICAL).Method Detail |
---|
public int getDockPriority(Dockable dockable, java.awt.Point relativeLocation)
Determines if the dockable can be added.
A dockable can be docked in this dock if:
checkDockingModes(Dockable)
returns true for the dockable.checkDockingModes(Dockable)
returns true for the composite dockable.
getDockPriority
in interface Dock
dockable
- The dockable that will be added.relativeLocation
- The location where the dockable will be added.
public int retrieveDockingRectangle(Dockable dockable, java.awt.Point relativeLocation, java.awt.Point dockableOffset, java.awt.Rectangle rectangle)
Dock
Sets the given rectangle to the position and size of the graphical content component of the dockable, when it will be docked in this dock.
Determines if the dockable can be added to this dock. If the dockable cannot be added,
it returns Priority.CANNOT_DOCK
and the given rectangle is not changed.
retrieveDockingRectangle
in interface Dock
dockable
- The dockable that will be added.relativeLocation
- The location where the dockable will be added.dockableOffset
- The mouse location where the dragging started, relatively to the previous dock of the dockable.rectangle
- This rectangle will be set to the location and size of the graphical component of the dockable
when it will be docked in this dock. The rectangle is relative to this dock.
Priority.CANNOT_DOCK
is returned, otherwise a positive integer.public boolean addDockable(Dockable dockableToAdd, java.awt.Point relativeLocation, java.awt.Point dockableOffset)
Dock
Adds a dockable to this dock.
First it determines if the dockable can be added with Dock.getDockPriority(Dockable, Point)
.
If this method returns CANNOT_DOCK, the dockable is not added.
addDockable
in interface Dock
dockableToAdd
- The dockable that will be added.relativeLocation
- The location where the dockable will be added.dockableOffset
- The mouse location where the dragging started, relatively to the previous dock of the dockable.
public boolean canRemoveDockable(Dockable dockable)
LeafDock
canRemoveDockable
in interface LeafDock
dockable
- The dockable that will be removed.
public boolean removeDockable(Dockable dockable)
LeafDock
removeDockable
in interface LeafDock
dockable
- The dockable that will be removed.
public boolean isEmpty()
Dock
isEmpty
in interface Dock
public boolean isFull()
Dock
isFull
in interface Dock
public CompositeDock getParentDock()
Dock
getParentDock
in interface Dock
public void setParentDock(CompositeDock parentDock)
Dock
setParentDock
in interface Dock
parentDock
- The parent dock of this dock.public void saveProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map childDockIds)
Dock
Saves the properties of this dock in the given properties object.
The property names for this dock should start with the given prefix.
saveProperties
in interface Dock
prefix
- The prefix for the property names.properties
- The properties object to which the properties should be added.childDockIds
- A mapping between the child docks that are already saved and the keys that are used for the save.
Dock
).public void loadProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map newChildDocks, java.util.Map dockablesMap, java.awt.Window owner) throws java.io.IOException
Dock
Loads the properties for this dock. The properties can be found in the given properties object. The property names for this dock start with the given prefix.
The dockables that should be docked in this dock are added to this dock. They can be found in the given dockables mapping. The docks that should be docked inside this dock are added to this dock. They can be found in the given childDocks mapping.
This method should be called after the empty constructor to create the content of the dock. Don't call this method for a dock that already has a content.
loadProperties
in interface Dock
prefix
- The prefix of the names of the properties that have been intended for this dock.properties
- The properties object that contains the properties for this dock. It can contain also
properties for other objects, but they will have another prefix.newChildDocks
- A mapping between the dock keys of the child docks that are already loaded and the docks.
Dock
).dockablesMap
- A mapping that contains the available dockables.
Dockable
).owner
- The owner window of the dock in the dock model (DockModel
).
java.io.IOException
- If an error occures while decoding the properties.public void addDockingListener(DockingListener listener)
Dock
DockingEvent
s of this dock.
The listener will be informed before and after
adding, moving or removing dockables or child docks from this dock.
addDockingListener
in interface Dock
listener
- A docking listener that will be notified when a dockable or child dock is added, moved, or removed.public void removeDockingListener(DockingListener listener)
Dock
removeDockingListener
in interface Dock
listener
- The docking listener to remove.public int getDockableCount()
LeafDock
getDockableCount
in interface LeafDock
public Dockable getDockable(int index) throws java.lang.IndexOutOfBoundsException
LeafDock
getDockable
in interface LeafDock
index
- The index of the dockable
java.lang.IndexOutOfBoundsException
- If the index is out of range (index < 0 || index >= getDockableCount()).public boolean containsDockable(Dockable dockable)
LeafDock
containsDockable
in interface LeafDock
dockable
- The dockable.
public boolean moveDockable(Dockable dockableToMove, java.awt.Point relativeLocation)
LeafDock
moveDockable
in interface LeafDock
dockableToMove
- The dockable that will be moved.relativeLocation
- The location to which the dockable will be moved, relatively to the dock.
public Position getDockablePosition(Dockable dockable) throws java.lang.IllegalArgumentException
LeafDock
getDockablePosition
in interface LeafDock
dockable
- The dockable that is docked in this dock.
java.lang.IllegalArgumentException
- If the given dockable is not docked in this dock.public void addDockable(Dockable dockable, Position position)
LeafDock
Adds the given dockable to this dock at the given position.
If there is already a dockable at the given position, or if the position is invalid, then the dockable is added at another position.
addDockable
in interface LeafDock
dockable
- The dockable to add to this dock.position
- The position of the dockable.public int getOrientation()
Gets the orientation of the line dock.
This can be ORIENTATION_HORIZONTAL or ORIENTATION_VERTICAL. The default is ORIENTATION_HORIZONTAL.
public void setOrientation(int newOrientation)
Sets the orientation of the line dock.
This can be ORIENTATION_HORIZONTAL or ORIENTATION_VERTICAL.
newOrientation
- The orientation of the line dock.public boolean getGrid()
public void setGrid(boolean newGrid)
newGrid
- True when the content components of the dockables have the same size in the dock,
false when their size is computed with the preferred sizes of their components.public boolean isAddCompositeDockables()
public void setAddCompositeDockables(boolean addCompositeDockables)
addCompositeDockables
- True if composite dockables may be added to this dock,
when it is not empty. False otherwise.protected boolean checkDockingModes(Dockable dockable)
Checks the docking modes of the dockable. True is returned if we have a horizontal dock orientation
(ORIENTATION_HORIZONTAL) and if the dockable has horizontalDockingMode
as possible docking mode.
True is also returned if we have a vertical dock orientation
(ORIENTATION_VERTICAL) and if the dockable has verticalDockingMode
as possible docking mode.
dockable
- The dockable to add.
horizontalDockingMode
as possible docking mode.verticalDockingMode
as possible docking mode.
Otherwise false is returned.protected boolean canAddDockableWithPriority(Dockable dockable, java.awt.Point relativeLocation)
dockable
- The dockable that may be added to this dock.relativeLocation
- The location of the mouse relative to this dock.
public int getHorizontalDockingMode()
public void setHorizontalDockingMode(int horizontalDockingMode)
horizontalDockingMode
- The docking mode for a dockable that is docked in this line dock,
if the line dock has a horizontal orientation (ORIENTATION_HORIZONTAL).public int getVerticalDockingMode()
public void setVerticalDockingMode(int verticalDockingMode)
verticalDockingMode
- The docking mode for a dockable that is docked in this line dock,
if the line dock has a vertical orientation (ORIENTATION_VERTICAL).public boolean getRealSizeRectangle()
Gets how docking rectangles have to be painted.
The default value is true
.
retrieveDockingRectangle(Dockable, Point, Point, Rectangle)
sets a rectangle
with the real size of the dockable component. This can be even a rectangle outside this dock.
When false, the rectangle will be a rectangle of the grid.setRealSizeRectangle(boolean)
public void setRealSizeRectangle(boolean realSizeRectangle)
Sets how docking rectangles have to be painted.
For tool bars and minimize bars it should be true
,
for regular line docks it should be false
.
The default value is true
.
realSizeRectangle
- When true, retrieveDockingRectangle(Dockable, Point, Point, Rectangle)
sets a rectangle
with the real size of the dockable component. This can be even a rectangle outside this dock.
When false, the rectangle will be a rectangle of the grid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |