Interface Dockable
- All Superinterfaces:
DockingListener
,DockingMonitor
,EventListener
- All Known Implementing Classes:
AbstractDockable
,DockableComponentWrapper
,View
DockingManager
and DockingPort
for dealing with dockable
components in a drag-n-drop fashion. A Dockable
is the child
component that is docked into a DockingPort
.- Author:
- Christopher Butler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.flexdock.docking.event.DockingListener
DockingListener.Stub
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
A constant property key to signify that a component is dockable. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a PropertyChangeListener to the listener list.boolean
Implements the semantics for docking an externalDockable
to thisDockable
and returns aboolean
indicating whether or not the docking operation was successful.boolean
Implements the semantics for docking an externalDockable
to the specified region of thisDockable
and returns aboolean
indicating whether or not the docking operation was successful.boolean
Implements the semantics for docking an externalDockable
to the specified region of thisDockable
with the specified layout ratio, returning aboolean
indicating whether or not the docking operation was successful.getClientProperty
(Object key) Returns the value of the property with the specified key.Returns the Component that is to be dragged and docked.Returns the DockingPort within which this Dockable is currently docked.Returns aDockablePropertySet
instance associated with thisDockable
.Returns aList
of theComponents
that are event sources for drag operations.Returns aSet
of theComponents
that are used as frame drag sources.Returns aString
identifier that is unique within a JVM instance, but persistent across JVM instances.void
putClientProperty
(Object key, Object value) Adds an arbitrary key/value "client property" to thisDockable
.void
Removes a PropertyChangeListener from the listener list.Methods inherited from interface org.flexdock.docking.event.DockingListener
dockingCanceled, dockingComplete, dragStarted, dropStarted, undockingComplete, undockingStarted
Methods inherited from interface org.flexdock.docking.event.DockingMonitor
addDockingListener, getDockingListeners, removeDockingListener
-
Field Details
-
DOCKABLE_INDICATOR
A constant property key to signify that a component is dockable.- See Also:
-
-
Method Details
-
getClientProperty
Returns the value of the property with the specified key. Only properties added withputClientProperty
will return a non-null
value.- Parameters:
key
- the key that is being queried- Returns:
- the value of this property or
null
- See Also:
-
getComponent
Component getComponent()Returns the Component that is to be dragged and docked. This may or may not be included in the list returned bygetDragSources()
.The framework performs indexing on the underlying
Component
. Consequently, this method may not return anull
reference.- Returns:
- the component wrapped by this dockable.
-
getDockingPort
DockingPort getDockingPort()Returns the DockingPort within which this Dockable is currently docked. If not currently docked, this method will return null.- Returns:
- the docking port this dockable resides in, or
null
if the dockable is not currently docked (i.e. in the middle of a drag operation).
-
getDragSources
List getDragSources()Returns aList
of theComponents
that are event sources for drag operations. The list may or may not include the Component returned bygetComponent()
.- Returns:
- a list containing the components that may be used to drag this dockable.
-
getFrameDragSources
Set getFrameDragSources()Returns aSet
of theComponents
that are used as frame drag sources. When aDockable
is floated into an external frame, that frame may or may not have a titlebar for repositioning. The Components returned by this method will be setup with appropriate event listeners such that dragging them will serve to reposition the containing frame as if they were the frame titlebar. If a Component exists in both the Set returned by this method and the List returned bygetDragSources()
, the "frame reposition" behavior will supercede any "drag-to-dock" behavior while the Dockable is in a floating state.- Returns:
- a set containing the components that may be used to drag the frame this dockable resides in, if the dockable is floating.
-
getPersistentId
String getPersistentId()Returns aString
identifier that is unique within a JVM instance, but persistent across JVM instances. This is used for configuration mangement, allowing the JVM to recognize aDockable
instance within an application instance, persist the ID, and recall it in later application instances. The ID should be unique within an appliation instance so that there are no collisions with otherDockable
instances, but it should also be consistent from JVM to JVM so that the association between aDockable
instance and its ID can be remembered from session to session.The framework performs indexing on the persistent ID. Consequently, this method may not return a
null
reference.- Returns:
- the persistence id for this dockable. This id ensures that only one copy of a given dockable will exist.
-
putClientProperty
Adds an arbitrary key/value "client property" to thisDockable
.null
values are allowed.- Parameters:
key
- the new client property key.value
- the new client property value; ifnull
this method will remove the property.- See Also:
-
getDockingProperties
DockablePropertySet getDockingProperties()Returns aDockablePropertySet
instance associated with thisDockable
. Developers implementing theDockable
interface may or may not choose to provide their ownDockablePropertySet
implementation for use with this method. A default implementation is supplied by the framework and mostDockable
implementations, including all implementations provided by the framework, will return the defaultDockablePropertySet
via a call toorg.flexdock.docking.props.PropertyManager
. Developers are encouraged to take advantage of this by callingPropertyManager.getDockablePropertySet(this)
.- Returns:
- the
DockablePropertySet
associated with thisDockable
This method may not return anull
reference. - See Also:
-
dock
Implements the semantics for docking an externalDockable
to thisDockable
and returns aboolean
indicating whether or not the docking operation was successful.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent)
. While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this);
- Parameters:
dockable
- theDockable
to dock relative to thisDockable
- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Implements the semantics for docking an externalDockable
to the specified region of thisDockable
and returns aboolean
indicating whether or not the docking operation was successful. If the docking operation results in a split layout, this method should determine an appropriate ratio of available space to allot to the new siblingDockable
.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent, String region)
. While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this, relativeRegion);
- Parameters:
dockable
- theDockable
to dock relative to thisDockable
relativeRegion
- the docking region into which to dock the specifiedDockable
- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Implements the semantics for docking an externalDockable
to the specified region of thisDockable
with the specified layout ratio, returning aboolean
indicating whether or not the docking operation was successful. If the docking operation results in a split layout, this method should use the specifiedratio
to determine the amount of available space to allot to the new siblingDockable
.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion)
. While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this, relativeRegion, ratio);
- Parameters:
dockable
- theDockable
to dock relative to thisDockable
relativeRegion
- the docking region into which to dock the specifiedDockable
ratio
- the proportion of available space in the resulting layout to allot to the new siblingDockable
.- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class. Note that if this Dockable is inheriting a bound property, then no event will be fired in response to a change in the inherited property.If listener is null, no exception is thrown and no action is performed.
- Parameters:
listener
- the PropertyChangeListener to be added- See Also:
-
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.If listener is null, no exception is thrown and no action is performed.
- Parameters:
listener
- the PropertyChangeListener to be removed- See Also:
-