|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
bibliothek.gui.dock.station.OverpaintablePanel
bibliothek.gui.dock.station.SplitDockStation
public class SplitDockStation
This station shows all its children at once. The children are separated
by small gaps which can be moved by the user. It is possible to set
one child to fullscreen
, this child will
be shown above all other children. The user can double click on the title
of a child to change its fullscreen-mode.
The station tries to register a DockTitleFactory
with the
ID TITLE_ID
.
Nested Class Summary | |
---|---|
private class |
SplitDockStation.Content
The panel which will be the parent of all displayers |
private class |
SplitDockStation.DividerListener
This listener is added directly to the Component of this
SplitDockStation . |
static class |
SplitDockStation.Orientation
Orientation how two Dockables are aligned. |
private class |
SplitDockStation.VisibleListener
This listener is added to the parent of this station, and ensures that the visibility-state of the children of this station is always correct. |
Nested classes/interfaces inherited from class javax.swing.JLayeredPane |
---|
javax.swing.JLayeredPane.AccessibleJLayeredPane |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private SplitDockAccess |
access
Access to the private and protected methods for some friends of this station |
private boolean |
allowSideSnap
Whether the bounds of this station are slightly bigger than the station itself. |
private int |
borderSideSnapSize
Size of the border outside this station where a Dockable will still
be considered to be dropped onto this station. |
private CombinerWrapper |
combiner
Combiner to combine some Dockables |
private boolean |
continousDisplay
If true , the components are resized while the split is dragged |
private DockController |
controller
The controller to which this station is registered |
private DisplayerFactoryWrapper |
displayerFactory
A DisplayerFactory used to create DockableDisplayer for the children of this station |
private DisplayerCollection |
displayers
The set of displayers currently used by this station |
private SplitDockStation.DividerListener |
dividerListener
A listener to the mouse. |
private int |
dividerSize
Size of the gap between two children in pixel |
private java.util.List<DockableListener> |
dockableListeners
A list of DockableListener which will be invoked when something noticable happens |
private java.util.List<DockableDisplayer> |
dockables
The list of Dockables which are shown on this station |
protected DockStationListenerManager |
dockStationListeners
The list of all registered DockStationListeners . |
private boolean |
expandOnDoubleclick
Whether the user can double click on a child to expand it. |
private Dockable |
frontDockable
The Dockable which has the focus |
private ListeningDockAction |
fullScreenAction
An action that is added to all children. |
private DockableDisplayer |
fullScreenDockable
The Dockable which is currently in fullscreen-mode. |
private FullScreenClickableListener |
fullScreenListener
This listener decides on which children the user can click to set them into fullscreen-mode |
private StationPaintWrapper |
paint
A StationPaint to draw some markings onto this station |
private DockStation |
parent
The parent of this station |
private PutInfo |
putInfo
Information about the Dockable which is currently draged onto this station. |
private Root |
root
The root of the tree which determines the structure of this station |
private float |
sideSnapSize
Relative size of the border where a Dockable will be placed aside
another Dockable when dragging the new Dockable onto this station. |
private java.util.List<SplitDockListener> |
splitListeners
A list of SplitDockListener which will be invoked when something noticable happens |
private DockTheme |
theme
The theme of this station |
private DockTitleVersion |
title
The type of titles which are used for this station |
static java.lang.String |
TITLE_ID
The ID under which this station tries to register a DockTitleFactory |
private PropertyValue<javax.swing.Icon> |
titleIcon
Optional icon for this station |
private java.util.List<DockTitle> |
titles
the DockTitles which are binded to this dockable |
private PropertyValue<java.lang.String> |
titleText
Optional text for this station |
private DockableVisibilityManager |
visibility
The handler for events and listeners concerning the visibility of children |
private SplitDockStation.VisibleListener |
visibleListener
Listener registered to the parent. |
Fields inherited from class javax.swing.JLayeredPane |
---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
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 | |
---|---|
SplitDockStation()
Constructs a new SplitDockStation . |
Method Summary | ||
---|---|---|
boolean |
accept(Dockable child)
Tells whether this station accepts child as a new child,
or refuses child . |
|
boolean |
accept(DockStation station)
Tells whether station is an accepted parent for this
Dockable or not. |
|
boolean |
accept(DockStation base,
Dockable neighbour)
Tells whether base could be the parent of a combination
between this Dockable and neighbor . |
|
void |
addDockable(Dockable dockable)
Adds dockable to this station. |
|
private void |
addDockable(Dockable dockable,
boolean fire)
Adds dockable to this station and fires events
only if fire is true . |
|
void |
addDockableListener(DockableListener listener)
Adds a listener to this Dockable. |
|
void |
addDockStationListener(DockStationListener listener)
Adds a listener to this station. |
|
void |
addMouseInputListener(javax.swing.event.MouseInputListener listener)
Adds a MouseInputListener to the component of this Dockable. |
|
void |
addSplitDockStationListener(SplitDockListener listener)
Adds a listener to this station. |
|
protected Leaf |
addToList(Dockable dockable)
Adds dockable to the list of children, generates a
title and a Leaf for dockable , but does not
add the leaf to this station. |
|
Dockable |
asDockable()
Returns this if this is an instance of
Dockable . |
|
DockStation |
asDockStation()
Returns this if this is an instance of
DockStation . |
|
void |
bind(DockTitle title)
Called by clients which want to show a title of this Dockable. |
|
protected void |
calculateDivider(PutInfo putInfo,
Leaf origin)
Calculates the value a divider should have if the Dockable
of putInfo is added alongside of origin . |
|
protected PutInfo |
calculateSideSnap(int x,
int y,
Leaf leaf)
Calculates where to add a Dockable if the mouse is outside
this station. |
|
protected void |
callDockUiUpdateTheme()
Calls the method DockUI .DockUI.updateTheme(DockStation, DockFactory)
with this as the first argument, and an appropriate factory
as the second argument. |
|
boolean |
canCompare(DockStation station)
Tells whether this station knows a rule how to compare itself with station . |
|
boolean |
canDrag(Dockable dockable)
Tells whether dockable can be removed from this station or not.Note that the result of this method may not be respected every time, it's more a hint for the controller how to act. |
|
boolean |
canReplace(Dockable old,
Dockable next)
Tells whether its possible to replace the child old
with next where next is not a child of this station. |
|
void |
changed(Dockable dockable,
DockTitle title,
boolean active)
Called by the DockController of this station to indicate that
the active-state of title has been changed. |
|
int |
compare(DockStation station)
Compares this station with station . |
|
protected ListeningDockAction |
createFullScreenAction()
Creates an action which is added to all children
of this station. |
|
SplitDockTree |
createTree()
Gets the contents of this station as a SplitDockTree . |
|
void |
drag(Dockable dockable)
Removes a child from this station. |
|
void |
draw()
Informs this station that the information gathered by prepareDrop or
prepareMove should
be painted somehow onto this station.The station should use the StationPaint of its theme
to draw. |
|
void |
drop()
Adds the Dockable of the last run of
prepareDrop to this station. |
|
private void |
drop(boolean fire)
Drops the current putInfo . |
|
void |
drop(Dockable dockable)
Adds dockable to this station. |
|
boolean |
drop(Dockable dockable,
DockableProperty property)
Tries to add dockable to this station such that the location
given by property is matched. |
|
boolean |
drop(Dockable dockable,
SplitDockProperty property)
Tries to add Dockable such that the boundaries given
by property are full filled. |
|
private void |
drop(PutInfo putInfo,
boolean fire)
Adds the Dockable given by putInfo to this
station. |
|
protected void |
dropAside(SplitNode neighbor,
PutInfo.Put put,
Dockable dockable,
double divider,
boolean fire)
Adds dockable at the side put of
neighbor . |
|
protected boolean |
dropOver(Leaf leaf,
Dockable dockable)
Combines the Dockable of leaf and dockable
to a new child of this station. |
|
void |
dropTree(SplitDockTree tree)
Removes all children from this station and then adds the contents that are stored in tree . |
|
protected void |
fireFullScreenChanged(Dockable oldDockable,
Dockable newDockable)
Sends a message to all registered instances of SplitDockListener ,
that the Dockable in fullscreen-mode has changed. |
|
void |
forget()
Tells this station that a possible drop or move on this station was canceled. |
|
DockActionSource |
getActionOffers()
Gets a list of DockAction which should be triggerable if
this Dockable is visible. |
|
int |
getBorderSideSnapSize()
Gets the size of the border around the station. |
|
CombinerWrapper |
getCombiner()
Gets a Combiner to combine Dockables on
this station. |
|
java.awt.Component |
getComponent()
Gets the Component which represents this Dockable. |
|
DockController |
getController()
Gets the current controller, the argument of the last call of Dockable.setController(DockController) . |
|
DefaultDockActionSource |
getDirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect the child dockable . |
|
DisplayerFactoryWrapper |
getDisplayerFactory()
Gets a DisplayerFactory to create new DockableDisplayer
for this station. |
|
DisplayerCollection |
getDisplayers()
Gets the set of displayers that are currently
used by this station. |
|
int |
getDividerSize()
Gets the size of the divider-gap. |
|
Dockable |
getDockable(int index)
Gets the index'th child of this station. |
|
int |
getDockableCount()
Gets the number of children. |
|
DockableProperty |
getDockableProperty(Dockable dockable)
Gets precise information about the location of a child of this station. |
|
DockStation |
getDockParent()
Gets the current parent, which is the last argument of Dockable.setDockParent(DockStation) . |
|
DockTitle |
getDockTitle(DockTitleVersion version)
Invoked to get a graphical representation of a title for this Dockable. There are several requirements to the title and the caller: The owner of the title must be this Dockable.
The origin of the title must be version .
The title must not be binded
The result should be independent of the current state of this Dockable.
The method should not change any attribute of this Dockable
The client must call the Dockable.bind(DockTitle) -method of this Dockable
before using the title. |
|
java.lang.String |
getFactoryID()
Gets the unique name of the DockFactory which can read
and write elements of this type. |
|
Dockable |
getFrontDockable()
Gets the favorite child of this station. |
|
Dockable |
getFullScreen()
Gets the Dockable which is in fullscreen-mode and covers all
other children of this station. |
|
DockActionSource |
getIndirectActionOffers(Dockable dockable)
Gets a list of actions which should be available for the user and affect dockable . |
|
java.awt.Dimension |
getMinimumSize()
|
|
StationPaintWrapper |
getPaint()
Gets a StationPaint to paint markings on this station. |
|
protected Root |
getRoot()
Gets the Root of the tree which stores all locations and sizes
of the children of this station. |
|
float |
getSideSnapSize()
Gets the relative size of the invisible border of all children. |
|
java.awt.Rectangle |
getStationBounds()
Gets a rectangle in which all points of the station are. |
|
DockTheme |
getTheme()
Gets the current theme of this station. |
|
javax.swing.Icon |
getTitleIcon()
Gets the current icon of this Dockable. |
|
java.lang.String |
getTitleText()
Gest the current title-text of this Dockable. |
|
int |
indexOfDockable(Dockable dockable)
Gets the index of a child of this station. |
|
boolean |
isAllowSideSnap()
Tells whether the station can grab Dockables which are dragged near the station. |
|
boolean |
isContinousDisplay()
Tells whether the dockables are resized while the split is dragged, or not. |
|
boolean |
isExpandOnDoubleclick()
Tells whether a child expands to fullscreen when double clicked or not. |
|
boolean |
isFullScreen()
Tells whether a Dockable is currently shown in fullscreen-mode
on this station. |
|
|
isInOverrideZone(int x,
int y,
D invoker,
Dockable drop)
If the controller asks a station if a child could be dropped or moved, the controller assumes that no other station has interest in this event. |
|
boolean |
isStationVisible()
Tells whether this station is visible or not. |
|
boolean |
isVisible(Dockable dockable)
Tells whether the child dockable is visible or not. |
|
DockTitle[] |
listBindedTitles()
Gets a list of all DockTitles which are currently
binded to this Dockable. |
|
void |
move()
Moves a child of this station to a new location according to the information gathered by prepareMove . |
|
protected void |
paintOverlay(java.awt.Graphics g)
Paints the overlay over all components. |
|
boolean |
prepareDrop(int x,
int y,
int titleX,
int titleY,
Dockable dockable)
Prepares this station to get the new child dockable . |
|
boolean |
prepareMove(int x,
int y,
int titleX,
int titleY,
Dockable dockable)
Prepares the station that one of its children is moved from one location to another location. |
|
void |
read(java.util.Map<java.lang.Integer,Dockable> children,
boolean ignoreChildren,
java.io.DataInputStream in)
Reads an earlier saved layout of this station. |
|
void |
removeAllDockables()
Removes all children from this station. |
|
void |
removeDockable(Dockable dockable)
Removes dockable from this station. |
|
private void |
removeDockable(int index)
Removes the child with the specified index from this
station. |
|
private void |
removeDockable(int index,
boolean fire)
Removes the child with the specified index from this
station. |
|
void |
removeDockableListener(DockableListener listener)
Removes a listener from this Dockable. |
|
void |
removeDockStationListener(DockStationListener listener)
Removes a listener from this station. |
|
protected void |
removeFromList(Dockable dockable)
Removes dockable from the list of children of this station,
but does nothing more. |
|
private void |
removeFromList(int index)
Removes the child at index from this station, does
not fire any events. |
|
protected void |
removeLeaf(Leaf leaf)
Removes the specified leaf from the tree of this station,
but does not remove the associated DockableDisplayer . |
|
void |
removeMouseInputListener(javax.swing.event.MouseInputListener listener)
Removes a listener that was earlier added to this Dockable. |
|
void |
removeSplitDockStationListener(SplitDockListener listener)
Removes an earlier added listener. |
|
void |
replace(Dockable previous,
Dockable next)
Replaces the child old by next which is
not yet a child of this station. |
|
void |
setAllowSideSnap(boolean allowSideSnap)
Sets whether Dockables which are dragged near
the station are captured and added to this station. |
|
void |
setBorderSideSnapSize(int borderSideSnapSize)
There is an invisible border around the station. |
|
void |
setContinousDisplay(boolean continousDisplay)
Sets whether the dockables should be resized while the split is dragged, or not. |
|
void |
setController(DockController controller)
Sets the controller in whose realm this Dockable is. |
|
void |
setDividerSize(int dividerSize)
Sets the size of the divider-gap between the children of this station. |
|
void |
setDockParent(DockStation station)
Sets the parent property. |
|
void |
setExpandOnDoubleclick(boolean expandOnDoubleclick)
Sets whether a double click on a child or its title can expand the child to fullscreen or not. |
|
void |
setFrontDockable(Dockable dockable)
Sets the most important child. |
|
void |
setFullScreen(Dockable dockable)
Sets one of the children of this station as the one child which covers all other children. |
|
void |
setFullScreenAction(ListeningDockAction fullScreenAction)
Sets an action which allows to expand children. |
|
void |
setNextFullScreen()
Switches the child which is in fullscreen-mode. |
|
void |
setSideSnapSize(float sideSnapSize)
Every child has an invisible border whose size is determined by sideSnapSize . |
|
void |
setTitleIcon(javax.swing.Icon titleIcon)
Sets an icon that is shown in the titles of this Dockable . |
|
void |
setTitleText(java.lang.String titleText)
Sets the text of the title of this dockable. |
|
void |
unbind(DockTitle title)
Clients should call this method if a DockTitle is no longer
needed. |
|
void |
updateTheme()
Updates the DockTheme of this station. |
|
protected double |
validateDivider(double divider,
java.awt.Dimension minimumLeft,
java.awt.Dimension minimumRight,
SplitDockStation.Orientation orientation,
double width,
double height)
Tests whether the specified divider -value is legal or not. |
|
private double |
validateDivider(double divider,
Node node)
Tests whether the specified divider -value is legal or not. |
|
void |
write(java.util.Map<Dockable,java.lang.Integer> children,
java.io.DataOutputStream out)
Writes the layout of this station into out . |
Methods inherited from class bibliothek.gui.dock.station.OverpaintablePanel |
---|
doLayout, getContentPane, setContentPane |
Methods inherited from class javax.swing.JLayeredPane |
---|
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition |
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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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 java.lang.String TITLE_ID
DockTitleFactory
private DockStation parent
private SplitDockStation.VisibleListener visibleListener
private DockController controller
private DockTheme theme
private CombinerWrapper combiner
combine
some Dockables
private DockTitleVersion title
private java.util.List<DockableListener> dockableListeners
DockableListener
which will be invoked when something noticable happens
private java.util.List<SplitDockListener> splitListeners
SplitDockListener
which will be invoked when something noticable happens
private DockableVisibilityManager visibility
private java.util.List<DockTitle> titles
protected DockStationListenerManager dockStationListeners
DockStationListeners
.
This list can be used to send events to all listeners.
private PropertyValue<java.lang.String> titleText
private PropertyValue<javax.swing.Icon> titleIcon
private FullScreenClickableListener fullScreenListener
private boolean expandOnDoubleclick
true
.
private java.util.List<DockableDisplayer> dockables
Dockables
which are shown on this station
private Dockable frontDockable
Dockable
which has the focus
private DockableDisplayer fullScreenDockable
Dockable
which is currently in fullscreen-mode. This value might be null
private ListeningDockAction fullScreenAction
null
private int dividerSize
private float sideSnapSize
Dockable
will be placed aside
another Dockable when dragging the new Dockable onto this station. Should
be between 0 and 0.25f.
private int borderSideSnapSize
Dockable
will still
be considered to be dropped onto this station. Measured in pixel.
private boolean allowSideSnap
borderSideSnapSize
to grab Dockables "out of the sky".
The default is true
.
private SplitDockAccess access
private Root root
private PutInfo putInfo
Dockable
which is currently draged onto this station.
private StationPaintWrapper paint
StationPaint
to draw some markings onto this station
private DisplayerFactoryWrapper displayerFactory
DisplayerFactory
used to create DockableDisplayer
for the children of this station
private DisplayerCollection displayers
private SplitDockStation.DividerListener dividerListener
private boolean continousDisplay
true
, the components are resized while the split is dragged
Constructor Detail |
---|
public SplitDockStation()
SplitDockStation
.
Method Detail |
---|
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public DockTheme getTheme()
DockStation
null
,
but that means that the station is not fully initialized, and might not
work correct.
getTheme
in interface DockStation
null
.public void updateTheme()
DockStation
DockTheme
of this station. The new theme
has to be read from the controller
of
this station. If the controller is null
, this method
should return immediately.DockUI.updateTheme(DockStation, DockFactory)
to implement this method.
updateTheme
in interface DockStation
protected void callDockUiUpdateTheme() throws java.io.IOException
DockUI
.DockUI.updateTheme(DockStation, DockFactory)
with this
as the first argument, and an appropriate factory
as the second argument.
java.io.IOException
- if the DockUI throws an exceptionprotected ListeningDockAction createFullScreenAction()
action
which is added to all children
of this station. The action allows the user to expand a child to
fullscreen. The action is also added to subchildren, but the effect
does only affect direct children of this station.
null
if this feature should be
disabled, or the action is set later
public void setFullScreenAction(ListeningDockAction fullScreenAction)
action
which allows to expand children. This
method can only be invoked if there is not already set an action. It is
a condition that createFullScreenAction()
returns null
fullScreenAction
- the new action
java.lang.IllegalStateException
- if there is already an action presentpublic void setExpandOnDoubleclick(boolean expandOnDoubleclick)
expandOnDoubleclick
- true
if the double click should
have an effect, false
if double clicks should be ignored.public boolean isExpandOnDoubleclick()
true
if a double click has an effect, false
otherwisesetExpandOnDoubleclick(boolean)
public void setDockParent(DockStation station)
Dockable
station
.
setDockParent
in interface Dockable
station
- the parent, may be null
if this
Dockable is not visible at all.public DockStation getDockParent()
Dockable
Dockable.setDockParent(DockStation)
.
getDockParent
in interface Dockable
null
public void setController(DockController controller)
Dockable
null
means that this Dockable
is not managed by a controller.
setController
in interface Dockable
setController
in interface DockStation
controller
- the owner, may be null
public DockController getController()
Dockable
Dockable.setController(DockController)
.
getController
in interface Dockable
getController
in interface DockStation
null
DockStation.setController(DockController)
public void addDockableListener(DockableListener listener)
Dockable
addDockableListener
in interface Dockable
listener
- the new listenerpublic void removeDockableListener(DockableListener listener)
Dockable
removeDockableListener
in interface Dockable
listener
- the listener to removepublic void addMouseInputListener(javax.swing.event.MouseInputListener listener)
Dockable
MouseInputListener
to the component of this Dockable.
A Dockable has to decide by itself which Components
should be observer, but generally all free areas should be covered.
It's also possible just to ignore the listener, but that's not the
preferred behavior.
addMouseInputListener
in interface Dockable
listener
- the mouse listenerpublic void removeMouseInputListener(javax.swing.event.MouseInputListener listener)
Dockable
removeMouseInputListener
in interface Dockable
listener
- The listener to removepublic boolean accept(DockStation station)
Dockable
station
is an accepted parent for this
Dockable or not. The user is not able to drag a Dockable to a station
which is not accepted.
accept
in interface Dockable
station
- a possible parent
station
could be a parent or notpublic boolean accept(DockStation base, Dockable neighbour)
Dockable
base
could be the parent of a combination
between this Dockable and neighbor
. The user is not able
to make a combination between this Dockable and neighbor
if this method does not accept the operation.
accept
in interface Dockable
base
- the future parent of the combinationneighbour
- a Dockable whose parent will be the same parent as
the parent of this Dockable
true
if the combination is allowed, false
otherwisepublic java.awt.Component getComponent()
Dockable
Component
which represents this Dockable. Note that
the component should be a
focus cycle root
getComponent
in interface Dockable
public java.lang.String getTitleText()
Dockable
getTitleText
in interface Dockable
public void setTitleText(java.lang.String titleText)
titleText
- the text displayed in the titlepublic javax.swing.Icon getTitleIcon()
Dockable
getTitleIcon
in interface Dockable
null
public void setTitleIcon(javax.swing.Icon titleIcon)
titles
of this Dockable
.
titleIcon
- the icon or null
public void setSideSnapSize(float sideSnapSize)
sideSnapSize
.
If another Dockable
is dragged into that border, it is added as neighbor.
Otherwise it is merged with the present child.
sideSnapSize
- the relative size of the border, should be between
0 and 0.5f
java.lang.IllegalArgumentException
- if the size is less than 0public float getSideSnapSize()
setSideSnapSize(float)
public void setBorderSideSnapSize(int borderSideSnapSize)
Dockable
is
dragged inside this border, its considered to be on the station, but
will be dropped aside the station (like the whole station is a neighbor
of the Dockable).
borderSideSnapSize
- the size of the border in pixel
java.lang.IllegalArgumentException
- if the size is smaller than 0public int getBorderSideSnapSize()
setBorderSideSnapSize(int)
public void setDividerSize(int dividerSize)
dividerSize
- the size of the gap in pixel
java.lang.IllegalArgumentException
- if the size is less than 0.public int getDividerSize()
setDividerSize(int)
public void setContinousDisplay(boolean continousDisplay)
continousDisplay
- true
if the dockables should
be resizedpublic boolean isContinousDisplay()
true
if the dockables are resizedsetContinousDisplay(boolean)
public void setAllowSideSnap(boolean allowSideSnap)
Dockables
which are dragged near
the station are captured and added to this station.
allowSideSnap
- true
if the station can
snap Dockables which are near.setBorderSideSnapSize(int)
public boolean isAllowSideSnap()
true
if grabbing is allowedsetAllowSideSnap(boolean)
public DockTitle getDockTitle(DockTitleVersion version)
Dockable
owner
of the title must be this Dockable.origin
of the title must be version
.Dockable.bind(DockTitle)
-method of this Dockable
before using the title. Note that a client must not call the
bind-method of DockTitleDockable.unbind(DockTitle)
-method when he no
longer needs the title. Note that the client must not call the
unbind-method of the DockTitle
getDockTitle
in interface Dockable
version
- which title is required. If this Dockable does not have
a special rule for the given version, it can return the result of
DockTitleVersion.createDockable(Dockable)
.
null
if no title should be shown.
Note that not all clients can handle a null
-title, if in
doubt, return a title.public void changed(Dockable dockable, DockTitle title, boolean active)
DockStation
DockController
of this station to indicate that
the active-state of title
has been changed. This station
should call the method title.changed
with an appropriate event. The station may add some additional information
to this call.
changed
in interface DockStation
dockable
- the child whose title is changedtitle
- the changed titleactive
- the new state of the titlepublic void bind(DockTitle title)
Dockable
DockTitle.bind()
will be called automatically by the
controller.title
was binded. However, the method DockTitle.bind()
must not
be invoked by this method.title
must be returned by Dockable.listBindedTitles()
unless Dockable.unbind(DockTitle)
is called.
bind
in interface Dockable
title
- the title which will be show some things of this DockableDockable.unbind(DockTitle)
public void unbind(DockTitle title)
Dockable
DockTitle
is no longer
needed. The controller will call DockTitle.unbind()
at an appropriate
time.title
is no longer binded. However, this method must not call
DockTitle.unbind()
.title
must no longer be returned when calling Dockable.listBindedTitles()
unbind
in interface Dockable
title
- the title which will be no longer connected to this
DockableDockable.bind(DockTitle)
public DockTitle[] listBindedTitles()
Dockable
DockTitles
which are currently
binded to this Dockable. That are titles for which Dockable.bind(DockTitle)
was called, but not yet Dockable.unbind(DockTitle)
.
listBindedTitles
in interface Dockable
public DockActionSource getActionOffers()
Dockable
DockAction
which should be triggerable if
this Dockable is visible. The list can be modified by this Dockable
at every time, clients have to react on these changes by adding
a DockActionSourceListener
to the result.
getActionOffers
in interface Dockable
null
if no actions
are availablepublic DockStation asDockStation()
DockElement
this
if this
is an instance of
DockStation
. Otherwise null
is returned.
asDockStation
in interface DockElement
this
or null
public DefaultDockActionSource getDirectActionOffers(Dockable dockable)
DockStation
dockable
.
getDirectActionOffers
in interface DockStation
dockable
- a child of this station
dockable
, can be null
public DockActionSource getIndirectActionOffers(Dockable dockable)
DockStation
dockable
. The argument dockable
can be a child of this station, or a child of any station which is
below this station.
getIndirectActionOffers
in interface DockStation
dockable
- a child of this station or a child of another station
which is below this station
dockable
or null
public void addDockStationListener(DockStationListener listener)
DockStation
addDockStationListener
in interface DockStation
listener
- the listener to addpublic void removeDockStationListener(DockStationListener listener)
DockStation
removeDockStationListener
in interface DockStation
listener
- the listener to removepublic void addSplitDockStationListener(SplitDockListener listener)
SplitDockStation
are changed.
listener
- the new listenerpublic void removeSplitDockStationListener(SplitDockListener listener)
listener
- The listener to removepublic boolean isVisible(Dockable dockable)
DockStation
dockable
is visible or not. Visible
means that the component
of dockable
can be seen by the user. The result must be false
if
this method is not visible.
isVisible
in interface DockStation
dockable
- the child whose visibility-state is questioned
dockable
is visible or notDockStation.isStationVisible()
public boolean isStationVisible()
DockStation
JFrame
is not visible if the frame is minimized.
isStationVisible
in interface DockStation
public int getDockableCount()
DockStation
getDockableCount
in interface DockStation
public Dockable getDockable(int index)
DockStation
getDockable
in interface DockStation
index
- a value between 0 (incl.) and DockStation.getDockableCount()
(excl.).
public DockableProperty getDockableProperty(Dockable dockable)
DockStation
DockStation.drop(Dockable, DockableProperty)
.
getDockableProperty
in interface DockStation
dockable
- the child whose location is demanded
DockUtilities.getPropertyChain(DockStation, Dockable)
public Dockable getFrontDockable()
DockStation
null
indicates that there are no children
at all, or that there is no favorite child (all children are equal important).DockController
.DockController.setFocusedDockable(Dockable, boolean)
which will then call DockStation.setFrontDockable(Dockable)
. Note that the
DockController itself listens to the DockTitles, and maybe the station
doesn't need a logic to decide which child is important.
getFrontDockable
in interface DockStation
null
public void setFrontDockable(Dockable dockable)
DockStation
DockStation.getFrontDockable()
how stations can change
this property.
setFrontDockable
in interface DockStation
dockable
- the new favorite child, can be null
DockStation.getFrontDockable()
public boolean isFullScreen()
Dockable
is currently shown in fullscreen-mode
on this station. A true
result implies that
getFullScreen()
returns not null
.
true
if a child is fullscreen.public Dockable getFullScreen()
Dockable
which is in fullscreen-mode and covers all
other children of this station.
null
setFullScreen(Dockable)
,
isFullScreen()
public void setFullScreen(Dockable dockable)
dockable
- a child of this station or null
if
all children should be visible.isFullScreen()
public void setNextFullScreen()
public boolean accept(Dockable child)
DockStation
child
as a new child,
or refuses child
. The user will not be able to drop
a Dockable
onto this station if this method returns
false
.
accept
in interface DockStation
child
- a Dockable
which may become a child
true
if child
is acceptedpublic boolean prepareDrop(int x, int y, int titleX, int titleY, Dockable dockable)
DockStation
dockable
. The
station has to store a possible location of the child, and should draw
some indicators where the child will be put. The station can refuse
dockable
, in this case nothing has to be painted, and
this method returns false
.DockStation.accept(Dockable)
is false
.false
if this station is dockable,
and the mouse is in the override-zone
of the parent. However, that condition is just "good manners" and may
be broken.DockStation
(because the
child will be combined with another child), the method should use
the DockAcceptance
of its controller (see DockController.getAcceptance()
)
to ensure that the combination is valid.mouseX/mouseY
is the location
of the mouse, titleX/titleY
is the location of the dragged
title. The second point may be interesting if the title of a dropped
child should have the same coordinates as the image of the dragged title.dockable
is a child of this
station. In such a case prepareMove
is invoked.
prepareDrop
in interface DockStation
x
- the x-coordinate of the mouse on the screeny
- the y-coordinate of the mouse on the screentitleX
- the x-location of the dragged title or mouseX
if no
title is draggedtitleY
- the y-location of the dragged title or mouseY
if no
title is draggeddockable
- the element which will be dropped
true
if dockable
can be added at the
current location, false
otherwise.public void drop(Dockable dockable)
DockStation
dockable
to this station. The station can decide
by its own where to put dockable
.
drop
in interface DockStation
dockable
- a new childpublic boolean drop(Dockable dockable, DockableProperty property)
DockStation
dockable
to this station such that the location
given by property
is matched. If property
has a successor
and points to
another station, just call the drop
-method of this
child-station. Note that property
can be of any type and
contain invalid information.
drop
in interface DockStation
dockable
- the new childproperty
- the location of the child, may be invalid data
true
if property
could be read
and dockable
was dropped, false
otherwise.public boolean drop(Dockable dockable, SplitDockProperty property)
Dockable
such that the boundaries given
by property
are full filled.
dockable
- a new child of this stationproperty
- the preferred location of the child
true
if the child could be added, false
if no location could be foundpublic void drop()
DockStation
Dockable
of the last run of
prepareDrop
to this station.
This method is only called if the new child and this station accepted
each other, prepareDrop
returned true
and
the new child is not yet a child of this station.
drop
in interface DockStation
private void drop(boolean fire)
putInfo
.
fire
- true
if events should be fired,
false
otherwisedrop(PutInfo, boolean)
private void drop(PutInfo putInfo, boolean fire)
Dockable
given by putInfo
to this
station.
putInfo
- the location of the new childfire
- true
if events should be fired,
false
if the process should be silentprotected boolean dropOver(Leaf leaf, Dockable dockable)
Dockable
of leaf
and dockable
to a new child of this station. No checks whether the two elements accepts
each other nor if the station accepts the new child dockable
are performed.
leaf
- the leaf which will be combined with dockable
dockable
- a Dockable
which is dropped over leaf
true
if the operation was successful, false
otherwiseprotected void dropAside(SplitNode neighbor, PutInfo.Put put, Dockable dockable, double divider, boolean fire)
dockable
at the side put
of
neighbor
. The divider is set to the value of divider
,
and if fire
is activated, some events are fired. There are
no checks whether dockable
accepts this station or anything
else.
neighbor
- The node which will be the neighbor of dockable
put
- The side on which dockable
should be added in
respect to neighbor
.dockable
- the new child of this stationdivider
- the divider-location, a value between 0 and 1fire
- true
if the method is allowed to fire events,
false
otherwisepublic boolean prepareMove(int x, int y, int titleX, int titleY, Dockable dockable)
DockStation
prepareDrop
for detailed information about the behavior of this method. The only
difference between this method and prepareDrop
is, that
dockable
is a child of this station.
prepareMove
in interface DockStation
x
- the x-coordinate of the mouse on the screeny
- the y-coordinate of the mouse on the screentitleX
- the x-location of the dragged title or mouseX
if no
title is draggedtitleY
- the y-location of the dragged title or mouseY
if no
title is draggeddockable
- the element which will be moved
true
if dockable
can be added at the
current location, false
otherwise.public void move()
DockStation
prepareMove
.
move
in interface DockStation
protected void calculateDivider(PutInfo putInfo, Leaf origin)
Dockable
of putInfo
is added alongside of origin
.
putInfo
- the new child of the stationorigin
- a leaf of this station or null
protected PutInfo calculateSideSnap(int x, int y, Leaf leaf)
Dockable
if the mouse is outside
this station.
x
- The x-coordinate of the mousey
- The y-coordinate of the mouseleaf
- The leaf which was the old parent of the moved Dockable
or null
null
public void dropTree(SplitDockTree tree)
tree
.
tree
- the new set of children
SplitDropTreeException
- If the tree is not acceptable.public SplitDockTree createTree()
SplitDockTree
.
public void draw()
DockStation
prepareDrop
or
prepareMove
should
be painted somehow onto this station.StationPaint
of its theme
to draw.
draw
in interface DockStation
public void forget()
DockStation
prepareDrop
or prepareMove
DockStation.draw()
, than the station can throw away these markings too.
forget
in interface DockStation
public <D extends Dockable & DockStation> boolean isInOverrideZone(int x, int y, D invoker, Dockable drop)
DockStation
true
.true
.
isInOverrideZone
in interface DockStation
D
- the type of invoker
x
- the x-coordinate of the mouse on the screeny
- the y-coordinate of the mouse on the screeninvoker
- a child of this station which invoked the methoddrop
- a Dockable
which might become a child
true
if the location of the mouse is of special
interestpublic boolean canDrag(Dockable dockable)
DockStation
dockable
can be removed from this station or not.
canDrag
in interface DockStation
dockable
- a child of this station
true
if dockable
can be draggedpublic void drag(Dockable dockable)
DockStation
DockStation.canDrag(Dockable)
returned false
.
drag
in interface DockStation
dockable
- the child to removeprotected void fireFullScreenChanged(Dockable oldDockable, Dockable newDockable)
SplitDockListener
,
that the Dockable
in fullscreen-mode has changed.
oldDockable
- the old fullscreen-Dockable, can be null
newDockable
- the new fullscreen-Dockable, can be null
public java.awt.Rectangle getStationBounds()
DockStation
Dockable
into this area onto this station.
getStationBounds
in interface DockStation
public boolean canCompare(DockStation station)
DockStation
station
. See DockStation.compare(DockStation)
for more
details.
canCompare
in interface DockStation
station
- another station
true
if a call to compare
will not end in an exception and return another value than 0public int compare(DockStation station)
DockStation
station
. The comparison is needed
if the stations bounds
of the two station
have common points. On a drag-event, the controller needs a way to
decide which station is more important (and receives the opportunity
to get a new child first). The controller will use the method
compare
to do this. This method works like
Comparable.compareTo(Object)
.
compare
in interface DockStation
station
- another station
station
.public Dockable asDockable()
DockElement
this
if this
is an instance of
Dockable
. Otherwise null
is returned.
asDockable
in interface DockElement
this
or null
public StationPaintWrapper getPaint()
StationPaint
to paint markings on this station.
public DisplayerFactoryWrapper getDisplayerFactory()
DisplayerFactory
to create new DockableDisplayer
for this station.
public DisplayerCollection getDisplayers()
displayers
that are currently
used by this station.
public CombinerWrapper getCombiner()
Combiner
to combine Dockables
on
this station.
protected void paintOverlay(java.awt.Graphics g)
OverpaintablePanel
paintOverlay
in class OverpaintablePanel
g
- the graphics to usepublic void addDockable(Dockable dockable)
dockable
to this station.
dockable
- A Dockable
which must not be a child
of this station.private void addDockable(Dockable dockable, boolean fire)
dockable
to this station and fires events
only if fire
is true
.
dockable
- the new child of this stationfire
- true
if the method should fire
some events.public boolean canReplace(Dockable old, Dockable next)
DockStation
old
with next
where next is not a child of this station.
canReplace
in interface DockStation
old
- a child of this stationnext
- the replacement of next
.
true
if the replacement is possiblepublic void replace(Dockable previous, Dockable next)
DockStation
old
by next
which is
not yet a child of this station. This method should not be
called if canReplace
returned
false
.
replace
in interface DockStation
previous
- a childnext
- the replacement of next
protected Leaf addToList(Dockable dockable)
dockable
to the list of children, generates a
title and a Leaf
for dockable
, but does not
add the leaf to this station. The location of the leaf has be set by
the caller.
dockable
- the new child of this station.
Leaf
for dockable
public int indexOfDockable(Dockable dockable)
dockable
- the child which is searched
public void removeAllDockables()
public void removeDockable(Dockable dockable)
dockable
from this station. If
dockable
is not a child of this station, nothing happens.
dockable
- the child to removeprivate void removeDockable(int index)
index
from this
station.
index
- the index of the child to removeprivate void removeDockable(int index, boolean fire)
index
from this
station. Fires events if fire
is true
.
index
- the index of the child to removefire
- if true
, the method will fire some events.
Otherwise the method will run silent.protected void removeFromList(Dockable dockable)
dockable
from the list of children of this station,
but does nothing more.
dockable
- the child to removeprivate void removeFromList(int index)
index
from this station, does
not fire any events.
index
- the index of the child to removeprotected void removeLeaf(Leaf leaf)
leaf
from the tree of this station,
but does not remove the associated DockableDisplayer
.
leaf
- the Leaf
to removeprivate double validateDivider(double divider, Node node)
divider
-value is legal or not.
divider
- the value of a divider on a Node
node
- the Node
for which the test is performed
divider
protected double validateDivider(double divider, java.awt.Dimension minimumLeft, java.awt.Dimension minimumRight, SplitDockStation.Orientation orientation, double width, double height)
divider
-value is legal or not.
divider
- the value of a divider on a Node
minimumLeft
- the minimal number of pixels on the left or top
side of the dividerminimumRight
- the minimal number of pixels on the right or bottom
side of the dividerorientation
- the orientation of the dividerwidth
- the relative width of the base (in respect to the size of
this station)height
- the relative height of the base (in respect to the size of
this station)
divider
protected Root getRoot()
Root
of the tree which stores all locations and sizes
of the children of this station.
public java.lang.String getFactoryID()
DockElement
DockFactory
which can read
and write elements of this type.
getFactoryID
in interface DockElement
public void write(java.util.Map<Dockable,java.lang.Integer> children, java.io.DataOutputStream out) throws java.io.IOException
out
.
children
- the children of this station. Each child must have
a unique idout
- the stream in which to write
java.io.IOException
- if the stream throws an exceptionread(Map, boolean, DataInputStream)
public void read(java.util.Map<java.lang.Integer,Dockable> children, boolean ignoreChildren, java.io.DataInputStream in) throws java.io.IOException
children
- a mapping of ids and potential children of this stationignoreChildren
- true
if the children should not be changedin
- the source of information
java.io.IOException
- if the stream throws an exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |