Class AbstractDockable
- All Implemented Interfaces:
EventListener
,Dockable
,DockingListener
,DockingMonitor
Dockable
interface. This
class should be extended by any application that wishes to make use of the
Dockable
interface without the need for writing out an implementation
for every method that isn't explicitly used.- Author:
- Christopher Butler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.flexdock.docking.event.DockingListener
DockingListener.Stub
-
Field Summary
Fields inherited from interface org.flexdock.docking.Dockable
DOCKABLE_INDICATOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDockingListener
(DockingListener listener) Adds aDockingListener
to observe docking events for thisDockable
.void
Adds a PropertyChangeListener to the listener list.boolean
Provides the defaultDockable
implementation ofdock(Dockable dockable)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent)
.boolean
Provides the defaultDockable
implementation ofdock(Dockable dockable, String relativeRegion)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region)
.boolean
Provides the defaultDockable
implementation ofdock(Dockable dockable, String relativeRegion, float ratio)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion)
.void
No operation.void
No operation.void
dragStarted
(DockingEvent evt) No operation.void
dropStarted
(DockingEvent evt) No operation.getClientProperty
(Object key) Returns the value of the property with the specified key.abstract Component
Returns theComponent
used to back thisDockable
instance.Returns an array of allDockingListeners
added to thisDockable
.Returns theDockingPort
within which thisDockable
is currently docked.Returns aDockablePropertySet
instance associated with thisDockable
.Returns aList
ofComponents
used to initiate drag-to-dock operation.Returns aHashSet
ofComponents
used as frame drag sources when thisDockable
is floating in a non-decorated external dialog.Returns the persistent ID of thisDockable
instance provided when this object was instantiated.Returns theString
used for tab labels when thisDockable
is embedded within a tabbed layout.void
putClientProperty
(Object key, Object value) Adds an arbitrary key/value "client property" to thisDockable
.void
removeDockingListener
(DockingListener listener) Removes the specifiedDockingListener
from thisDockable
.void
Removes a PropertyChangeListener from the listener list.void
setTabText
(String tabText) Sets theString
to be used for tab labels when thisDockable
is embedded within a tabbed layout.void
No operation.void
No operation.
-
Constructor Details
-
AbstractDockable
Creates a newAbstractDockable
instance. This constructor is meant to be invoked by subclasses as it initializes theDockable's
persistent ID and drag sources.- Parameters:
id
- the persistent ID of the resultingDockable
- See Also:
-
-
Method Details
-
getComponent
Returns theComponent
used to back thisDockable
instance.- Specified by:
getComponent
in interfaceDockable
- Returns:
- the
Component
used to back thisDockable
instance. - See Also:
-
getDragSources
Returns aList
ofComponents
used to initiate drag-to-dock operation. By default, the returnedList
contains theComponent
returned bygetComponent()
.- Specified by:
getDragSources
in interfaceDockable
- Returns:
- a
List
ofComponents
used to initiate drag-to-dock operation. - See Also:
-
getPersistentId
Returns the persistent ID of thisDockable
instance provided when this object was instantiated.- Specified by:
getPersistentId
in interfaceDockable
- Returns:
- the persistent ID of this
Dockable
- See Also:
-
getFrameDragSources
Returns aHashSet
ofComponents
used as frame drag sources when thisDockable
is floating in a non-decorated external dialog. TheHashSet
returned by this method is initially empty. Because it is mutable, however, newComponents
may be added to it.- Specified by:
getFrameDragSources
in interfaceDockable
- Returns:
- a
HashSet
ofComponents
used as frame drag sources when thisDockable
is floating in a non-decorated external dialog. - See Also:
-
setTabText
Sets theString
to be used for tab labels when thisDockable
is embedded within a tabbed layout.null
values are discouraged, but not illegal.- Parameters:
tabText
- theString
to be used for tab labels when thisDockable
is embedded within a tabbed layout.
-
getTabText
Returns theString
used for tab labels when thisDockable
is embedded within a tabbed layout. It is possible for this method to return anull
reference.- Returns:
- tabText the
String
used for tab labels when thisDockable
is embedded within a tabbed layout.
-
dockingCanceled
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dockingCanceled
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
dockingComplete
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dockingComplete
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
dragStarted
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dragStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
dropStarted
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
dropStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
undockingComplete
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
undockingComplete
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
undockingStarted
No operation. Provided as a method stub to fulfull theDockingListener
interface contract.- Specified by:
undockingStarted
in interfaceDockingListener
- Parameters:
evt
- theDockingEvent
to respond to.- See Also:
-
addDockingListener
Adds aDockingListener
to observe docking events for thisDockable
.null
arguments are ignored.- Specified by:
addDockingListener
in interfaceDockingMonitor
- Parameters:
listener
- theDockingListener
to add to thisDockable
.- See Also:
-
getDockingListeners
Returns an array of allDockingListeners
added to thisDockable
. If there are no listeners present for thisDockable
, then a zero-length array is returned.- Specified by:
getDockingListeners
in interfaceDockingMonitor
- Returns:
- an array of all
DockingListeners
added to thisDockable
. - See Also:
-
removeDockingListener
Removes the specifiedDockingListener
from thisDockable
. If the specifiedDockingListener
isnull
, or the listener has not previously been added to thisDockable
, then noException
is thrown and no action is taken.- Specified by:
removeDockingListener
in interfaceDockingMonitor
- Parameters:
listener
- theDockingListener
to remove from thisDockable
- See Also:
-
getClientProperty
Returns the value of the property with the specified key. Only properties added withputClientProperty
will return a non-null
value. Ifkey
isnull
, anull
reference is returned.If the
Component
returned bygetComponent()
is an instance ofJComponent
, then this method will dispatch to thatJComponent's
getClientProperty(Object, Object)
method. Otherwise, thisDockable
will provide its own internal mapping of client properties.- Specified by:
getClientProperty
in interfaceDockable
- Parameters:
key
- the key that is being queried- Returns:
- the value of this property or
null
- See Also:
-
putClientProperty
Adds an arbitrary key/value "client property" to thisDockable
.null
values are allowed. Ifkey
isnull
, then no action is taken.If the
Component
returned bygetComponent()
is an instance ofJComponent
, then this method will dispatch to thatJComponent's
putClientProperty(Object, Object)
method. Otherwise, thisDockable
will provide its own internal mapping of client properties.- Specified by:
putClientProperty
in interfaceDockable
- Parameters:
key
- the new client property keyvalue
- the new client property value; ifnull
this method will remove the property- See Also:
-
getDockingProperties
Returns aDockablePropertySet
instance associated with thisDockable
. This method returns the default implementation supplied by the framework by invokinggetDockablePropertySet(Dockable dockable)
onorg.flexdock.docking.props.PropertyManager
and supplying an argument ofthis
.- Specified by:
getDockingProperties
in interfaceDockable
- Returns:
- the
DockablePropertySet
associated with thisDockable
. This method will not return anull
reference. - See Also:
-
getDockingPort
Returns theDockingPort
within which thisDockable
is currently docked. If not currently docked, this method will returnnull
.This method defers processing to
getDockingPort(Dockable dockable)
, passing an argument ofthis
. ThisDockingPort
returned is based upon theComponent
returned by thisDockable's
abstractgetComponent()
method.- Specified by:
getDockingPort
in interfaceDockable
- Returns:
- the
DockingPort
within which thisDockable
is currently docked. - See Also:
-
dock
Provides the defaultDockable
implementation ofdock(Dockable dockable)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent)
.'this'
is passed as theparent
parameter. -
dock
Provides the defaultDockable
implementation ofdock(Dockable dockable, String relativeRegion)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region)
.'this'
is passed as theparent
parameter. -
dock
Provides the defaultDockable
implementation ofdock(Dockable dockable, String relativeRegion, float ratio)
by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion)
.'this'
is passed as theparent
parameter.- Specified by:
dock
in interfaceDockable
- 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
Description copied from interface:Dockable
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.
- Specified by:
addPropertyChangeListener
in interfaceDockable
- Parameters:
listener
- the PropertyChangeListener to be added- See Also:
-
removePropertyChangeListener
Description copied from interface:Dockable
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.
- Specified by:
removePropertyChangeListener
in interfaceDockable
- Parameters:
listener
- the PropertyChangeListener to be removed- See Also:
-