org.flexdock.docking
public interface Dockable extends DockingListener, DockingMonitor
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
.DockingListener.Stub
Modifier and Type | Field and Description |
---|---|
static String |
DOCKABLE_INDICATOR
A constant property key to signify that a component is dockable.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
|
boolean |
dock(Dockable dockable)
Implements the semantics for docking an external
Dockable to this
Dockable and returns a boolean indicating whether or not
the docking operation was successful. |
boolean |
dock(Dockable dockable,
String relativeRegion)
Implements the semantics for docking an external
Dockable to the
specified region of this Dockable and returns a boolean
indicating whether or not the docking operation was successful. |
boolean |
dock(Dockable dockable,
String relativeRegion,
float ratio)
Implements the semantics for docking an external
Dockable to the
specified region of this Dockable with the specified layout
ratio, returning a boolean indicating whether or not the docking
operation was successful. |
Object |
getClientProperty(Object key)
Returns the value of the property with the specified key.
|
Component |
getComponent()
Returns the Component that is to be dragged and docked.
|
DockingPort |
getDockingPort()
Returns the DockingPort within which this Dockable is currently docked.
|
DockablePropertySet |
getDockingProperties()
Returns a
DockablePropertySet instance associated with this
Dockable . |
List |
getDragSources()
Returns a
List of the Components that are event sources
for drag operations. |
Set |
getFrameDragSources()
Returns a
Set of the Components that are used as frame
drag sources. |
String |
getPersistentId()
Returns a
String 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 this
Dockable . |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.
|
dockingCanceled, dockingComplete, dragStarted, dropStarted, undockingComplete, undockingStarted
addDockingListener, getDockingListeners, removeDockingListener
static final String DOCKABLE_INDICATOR
Object getClientProperty(Object key)
putClientProperty
will return a non-null
value.key
- the key that is being queriednull
JComponent.getClientProperty(java.lang.Object)
Component getComponent()
getDragSources()
.
The framework performs indexing on the underlying Component
.
Consequently, this method may not return a null
reference.
DockingPort getDockingPort()
null
if the
dockable is not currently docked (i.e. in the middle of a drag
operation).List getDragSources()
List
of the Components
that are event sources
for drag operations. The list may or may not include the Component
returned by getComponent()
.Set getFrameDragSources()
Set
of the Components
that are used as frame
drag sources. When a Dockable
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 by
getDragSources()
, the "frame reposition" behavior will supercede
any "drag-to-dock" behavior while the Dockable is in a floating state.String getPersistentId()
String
identifier that is unique within a JVM instance,
but persistent across JVM instances. This is used for configuration
mangement, allowing the JVM to recognize a Dockable
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 other Dockable
instances, but it should also be consistent from JVM to JVM so that the
association between a Dockable
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.
void putClientProperty(Object key, Object value)
Dockable
.
null
values are allowed.key
- the new client property key.value
- the new client property value; if null
this
method will remove the property.JComponent.putClientProperty(java.lang.Object,
java.lang.Object)
DockablePropertySet getDockingProperties()
DockablePropertySet
instance associated with this
Dockable
. Developers implementing the Dockable
interface
may or may not choose to provide their own DockablePropertySet
implementation for use with this method. A default implementation is
supplied by the framework and most Dockable
implementations,
including all implementations provided by the framework, will return the
default DockablePropertySet
via a call to
org.flexdock.docking.props.PropertyManager
. Developers are
encouraged to take advantage of this by calling
PropertyManager.getDockablePropertySet(this)
.DockablePropertySet
associated with this
Dockable
This method may not return a null
reference.DockablePropertySet
,
PropertyManager.getDockablePropertySet(Dockable)
boolean dock(Dockable dockable)
Dockable
to this
Dockable
and returns a boolean
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);
dockable
- the Dockable
to dock relative to this Dockable
true
if the docking operation was successful;
false
otherwise.dock(Dockable, String)
,
dock(Dockable, String, float)
,
DockingManager.dock(Dockable, Dockable)
boolean dock(Dockable dockable, String relativeRegion)
Dockable
to the
specified region of this Dockable
and returns a boolean
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 sibling
Dockable
. 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);
dockable
- the Dockable
to dock relative to this Dockable
relativeRegion
- the docking region into which to dock the specified
Dockable
true
if the docking operation was successful;
false
otherwise.dock(Dockable, String, float)
,
DockingManager.dock(Dockable, Dockable, String)
boolean dock(Dockable dockable, String relativeRegion, float ratio)
Dockable
to the
specified region of this Dockable
with the specified layout
ratio, returning a boolean
indicating whether or not the docking
operation was successful. If the docking operation results in a split
layout, this method should use the specified ratio
to determine
the amount of available space to allot to the new sibling
Dockable
.
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);
dockable
- the Dockable
to dock relative to this Dockable
relativeRegion
- the docking region into which to dock the specified
Dockable
ratio
- the proportion of available space in the resulting layout to
allot to the new sibling Dockable
.true
if the docking operation was successful;
false
otherwise.DockingManager.dock(Dockable, Dockable, String, float)
void addPropertyChangeListener(PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
listener
- the PropertyChangeListener to be addedremovePropertyChangeListener(PropertyChangeListener)
void removePropertyChangeListener(PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)