Class AbstractDockable
- java.lang.Object
-
- org.flexdock.docking.defaults.AbstractDockable
-
- All Implemented Interfaces:
java.util.EventListener,Dockable,DockingListener,DockingMonitor
public abstract class AbstractDockable extends java.lang.Object implements Dockable
Provides a default implementation of theDockableinterface. This class should be extended by any application that wishes to make use of theDockableinterface 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 Constructor Description AbstractDockable(java.lang.String id)Creates a newAbstractDockableinstance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddDockingListener(DockingListener listener)Adds aDockingListenerto observe docking events for thisDockable.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list.booleandock(Dockable dockable)Provides the defaultDockableimplementation ofdock(Dockable dockable)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent).booleandock(Dockable dockable, java.lang.String relativeRegion)Provides the defaultDockableimplementation ofdock(Dockable dockable, String relativeRegion)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region).booleandock(Dockable dockable, java.lang.String relativeRegion, float ratio)Provides the defaultDockableimplementation ofdock(Dockable dockable, String relativeRegion, float ratio)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion).voiddockingCanceled(DockingEvent evt)No operation.voiddockingComplete(DockingEvent evt)No operation.voiddragStarted(DockingEvent evt)No operation.voiddropStarted(DockingEvent evt)No operation.java.lang.ObjectgetClientProperty(java.lang.Object key)Returns the value of the property with the specified key.abstract java.awt.ComponentgetComponent()Returns theComponentused to back thisDockableinstance.DockingListener[]getDockingListeners()Returns an array of allDockingListenersadded to thisDockable.DockingPortgetDockingPort()Returns theDockingPortwithin which thisDockableis currently docked.DockablePropertySetgetDockingProperties()Returns aDockablePropertySetinstance associated with thisDockable.java.util.ListgetDragSources()Returns aListofComponentsused to initiate drag-to-dock operation.java.util.SetgetFrameDragSources()Returns aHashSetofComponentsused as frame drag sources when thisDockableis floating in a non-decorated external dialog.java.lang.StringgetPersistentId()Returns the persistent ID of thisDockableinstance provided when this object was instantiated.java.lang.StringgetTabText()Returns theStringused for tab labels when thisDockableis embedded within a tabbed layout.voidputClientProperty(java.lang.Object key, java.lang.Object value)Adds an arbitrary key/value "client property" to thisDockable.voidremoveDockingListener(DockingListener listener)Removes the specifiedDockingListenerfrom thisDockable.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list.voidsetTabText(java.lang.String tabText)Sets theStringto be used for tab labels when thisDockableis embedded within a tabbed layout.voidundockingComplete(DockingEvent evt)No operation.voidundockingStarted(DockingEvent evt)No operation.
-
-
-
Constructor Detail
-
AbstractDockable
public AbstractDockable(java.lang.String id)
Creates a newAbstractDockableinstance. This constructor is meant to be invoked by subclasses as it initializes theDockable'spersistent ID and drag sources.- Parameters:
id- the persistent ID of the resultingDockable- See Also:
Dockable.getPersistentId()
-
-
Method Detail
-
getComponent
public abstract java.awt.Component getComponent()
Returns theComponentused to back thisDockableinstance.- Specified by:
getComponentin interfaceDockable- Returns:
- the
Componentused to back thisDockableinstance. - See Also:
Dockable.getComponent()
-
getDragSources
public java.util.List getDragSources()
Returns aListofComponentsused to initiate drag-to-dock operation. By default, the returnedListcontains theComponentreturned bygetComponent().- Specified by:
getDragSourcesin interfaceDockable- Returns:
- a
ListofComponentsused to initiate drag-to-dock operation. - See Also:
Dockable.getDragSources(),getComponent()
-
getPersistentId
public java.lang.String getPersistentId()
Returns the persistent ID of thisDockableinstance provided when this object was instantiated.- Specified by:
getPersistentIdin interfaceDockable- Returns:
- the persistent ID of this
Dockable - See Also:
Dockable.getPersistentId(),AbstractDockable(String)
-
getFrameDragSources
public java.util.Set getFrameDragSources()
Returns aHashSetofComponentsused as frame drag sources when thisDockableis floating in a non-decorated external dialog. TheHashSetreturned by this method is initially empty. Because it is mutable, however, newComponentsmay be added to it.- Specified by:
getFrameDragSourcesin interfaceDockable- Returns:
- a
HashSetofComponentsused as frame drag sources when thisDockableis floating in a non-decorated external dialog. - See Also:
Dockable.getFrameDragSources()
-
setTabText
public void setTabText(java.lang.String tabText)
Sets theStringto be used for tab labels when thisDockableis embedded within a tabbed layout.nullvalues are discouraged, but not illegal.- Parameters:
tabText- theStringto be used for tab labels when thisDockableis embedded within a tabbed layout.
-
getTabText
public java.lang.String getTabText()
Returns theStringused for tab labels when thisDockableis embedded within a tabbed layout. It is possible for this method to return anullreference.- Returns:
- tabText the
Stringused for tab labels when thisDockableis embedded within a tabbed layout.
-
dockingCanceled
public void dockingCanceled(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
dockingCanceledin interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.dockingCanceled(DockingEvent)
-
dockingComplete
public void dockingComplete(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
dockingCompletein interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.dockingComplete(DockingEvent)
-
dragStarted
public void dragStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
dragStartedin interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.dragStarted(DockingEvent)
-
dropStarted
public void dropStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
dropStartedin interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.dropStarted(DockingEvent)
-
undockingComplete
public void undockingComplete(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
undockingCompletein interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.undockingComplete(DockingEvent)
-
undockingStarted
public void undockingStarted(DockingEvent evt)
No operation. Provided as a method stub to fulfull theDockingListenerinterface contract.- Specified by:
undockingStartedin interfaceDockingListener- Parameters:
evt- theDockingEventto respond to.- See Also:
DockingListener.undockingStarted(DockingEvent)
-
addDockingListener
public void addDockingListener(DockingListener listener)
Adds aDockingListenerto observe docking events for thisDockable.nullarguments are ignored.- Specified by:
addDockingListenerin interfaceDockingMonitor- Parameters:
listener- theDockingListenerto add to thisDockable.- See Also:
getDockingListeners(),removeDockingListener(DockingListener)
-
getDockingListeners
public DockingListener[] getDockingListeners()
Returns an array of allDockingListenersadded to thisDockable. If there are no listeners present for thisDockable, then a zero-length array is returned.- Specified by:
getDockingListenersin interfaceDockingMonitor- Returns:
- an array of all
DockingListenersadded to thisDockable. - See Also:
addDockingListener(DockingListener),removeDockingListener(DockingListener)
-
removeDockingListener
public void removeDockingListener(DockingListener listener)
Removes the specifiedDockingListenerfrom thisDockable. If the specifiedDockingListenerisnull, or the listener has not previously been added to thisDockable, then noExceptionis thrown and no action is taken.- Specified by:
removeDockingListenerin interfaceDockingMonitor- Parameters:
listener- theDockingListenerto remove from thisDockable- See Also:
addDockingListener(DockingListener),getDockingListeners()
-
getClientProperty
public java.lang.Object getClientProperty(java.lang.Object key)
Returns the value of the property with the specified key. Only properties added withputClientPropertywill return a non-nullvalue. Ifkeyisnull, anullreference is returned.If the
Componentreturned bygetComponent()is an instance ofJComponent, then this method will dispatch to thatJComponent'sgetClientProperty(Object, Object)method. Otherwise, thisDockablewill provide its own internal mapping of client properties.- Specified by:
getClientPropertyin interfaceDockable- Parameters:
key- the key that is being queried- Returns:
- the value of this property or
null - See Also:
Dockable.getClientProperty(Object),JComponent.getClientProperty(java.lang.Object)
-
putClientProperty
public void putClientProperty(java.lang.Object key, java.lang.Object value)Adds an arbitrary key/value "client property" to thisDockable.nullvalues are allowed. Ifkeyisnull, then no action is taken.If the
Componentreturned bygetComponent()is an instance ofJComponent, then this method will dispatch to thatJComponent'sputClientProperty(Object, Object)method. Otherwise, thisDockablewill provide its own internal mapping of client properties.- Specified by:
putClientPropertyin interfaceDockable- Parameters:
key- the new client property keyvalue- the new client property value; ifnullthis method will remove the property- See Also:
Dockable.putClientProperty(Object, Object),JComponent.putClientProperty(java.lang.Object, java.lang.Object)
-
getDockingProperties
public DockablePropertySet getDockingProperties()
Returns aDockablePropertySetinstance associated with thisDockable. This method returns the default implementation supplied by the framework by invokinggetDockablePropertySet(Dockable dockable)onorg.flexdock.docking.props.PropertyManagerand supplying an argument ofthis.- Specified by:
getDockingPropertiesin interfaceDockable- Returns:
- the
DockablePropertySetassociated with thisDockable. This method will not return anullreference. - See Also:
DockablePropertySet,Dockable.getDockingProperties(),PropertyManager.getDockablePropertySet(Dockable)
-
getDockingPort
public DockingPort getDockingPort()
Returns theDockingPortwithin which thisDockableis currently docked. If not currently docked, this method will returnnull.This method defers processing to
getDockingPort(Dockable dockable), passing an argument ofthis. ThisDockingPortreturned is based upon theComponentreturned by thisDockable'sabstractgetComponent()method.- Specified by:
getDockingPortin interfaceDockable- Returns:
- the
DockingPortwithin which thisDockableis currently docked. - See Also:
Dockable.getDockingPort(),DockingManager.getDockingPort(Dockable)
-
dock
public boolean dock(Dockable dockable)
Provides the defaultDockableimplementation ofdock(Dockable dockable)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent).'this'is passed as theparentparameter.- Specified by:
dockin interfaceDockable- Parameters:
dockable- theDockableto dock relative to thisDockable- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
Dockable.dock(Dockable),DockingManager.dock(Dockable, Dockable)
-
dock
public boolean dock(Dockable dockable, java.lang.String relativeRegion)
Provides the defaultDockableimplementation ofdock(Dockable dockable, String relativeRegion)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region).'this'is passed as theparentparameter.- Specified by:
dockin interfaceDockable- Parameters:
dockable- theDockableto dock relative to thisDockablerelativeRegion- the docking region into which to dock the specifiedDockable- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
Dockable.dock(Dockable, String),DockingManager.dock(Dockable, Dockable, String)
-
dock
public boolean dock(Dockable dockable, java.lang.String relativeRegion, float ratio)
Provides the defaultDockableimplementation ofdock(Dockable dockable, String relativeRegion, float ratio)by calling and returningDockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion).'this'is passed as theparentparameter.- Specified by:
dockin interfaceDockable- Parameters:
dockable- theDockableto dock relative to thisDockablerelativeRegion- the docking region into which to dock the specifiedDockableratio- the proportion of available space in the resulting layout to allot to the new siblingDockable.- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
DockingManager.dock(Dockable, Dockable, String, float)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:DockableAdds 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:
addPropertyChangeListenerin interfaceDockable- Parameters:
listener- the PropertyChangeListener to be added- See Also:
Dockable.removePropertyChangeListener(PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:DockableRemoves 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:
removePropertyChangeListenerin interfaceDockable- Parameters:
listener- the PropertyChangeListener to be removed- See Also:
Dockable.addPropertyChangeListener(java.beans.PropertyChangeListener)
-
-