📄 dockablecomponentwrapper.java
字号:
* {@code Dockable}. {@code null} arguments are ignored.
*
* @param listener
* the {@code DockingListener} to add to this {@code Dockable}.
* @see #getDockingListeners()
* @see #removeDockingListener(DockingListener)
*/
public void addDockingListener(DockingListener listener) {
if (listener != null)
dockingListeners.add(listener);
}
/**
* Returns an array of all {@code DockingListeners} added to this
* {@code Dockable}. If there are no listeners present for this
* {@code Dockable}, then a zero-length array is returned.
*
* @return an array of all {@code DockingListeners} added to this
* {@code Dockable}.
* @see #addDockingListener(DockingListener)
* @see #removeDockingListener(DockingListener)
*/
public DockingListener[] getDockingListeners() {
return (DockingListener[]) dockingListeners
.toArray(new DockingListener[0]);
}
/**
* Removes the specified {@code DockingListener} from this {@code Dockable}.
* If the specified {@code DockingListener} is {@code null}, or the
* listener has not previously been added to this {@code Dockable}, then no
* {@code Exception} is thrown and no action is taken.
*
* @param listener
* the {@code DockingListener} to remove from this
* {@code Dockable}
* @see #addDockingListener(DockingListener)
* @see #getDockingListeners()
*/
public void removeDockingListener(DockingListener listener) {
if (listener != null)
dockingListeners.remove(listener);
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#dockingCanceled(DockingEvent)
*/
public void dockingCanceled(DockingEvent evt) {
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#dockingComplete(DockingEvent)
*/
public void dockingComplete(DockingEvent evt) {
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#undockingComplete(DockingEvent)
*/
public void undockingComplete(DockingEvent evt) {
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#undockingStarted(DockingEvent)
*/
public void undockingStarted(DockingEvent evt) {
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#dragStarted(DockingEvent)
*/
public void dragStarted(DockingEvent evt) {
}
/**
* No operation. Provided as a method stub to fulfull the
* {@code DockingListener} interface contract.
*
* @param evt
* the {@code DockingEvent} to respond to.
* @see DockingListener#dropStarted(DockingEvent)
*/
public void dropStarted(DockingEvent evt) {
}
/**
* Returns the value of the property with the specified key. Only properties
* added with {@code putClientProperty} will return a non-{@code null}
* value. If {@code key} is {@code null}, a {@code null} reference is
* returned.
* <p>
* If the {@code Component} returned by {@code getComponent()} is an
* instance of {@code JComponent}, then this method will dispatch to that
* {@code JComponent's} {@code getClientProperty(Object, Object)} method.
* Otherwise, this {@code DockableComponentWrapper} will provide its own
* internal mapping of client properties.
*
* @param key
* the key that is being queried
* @return the value of this property or {@code null}
* @see Dockable#getClientProperty(Object)
* @see javax.swing.JComponent#getClientProperty(java.lang.Object)
*/
public Object getClientProperty(Object key) {
if (key == null)
return null;
Component c = getComponent();
if (c instanceof JComponent)
return ((JComponent) c).getClientProperty(key);
return getInternalClientProperties().get(key);
}
/**
* Adds an arbitrary key/value "client property" to this {@code Dockable}.
* {@code null} values are allowed. If {@code key} is {@code null}, then no
* action is taken.
* <p>
* If the {@code Component} returned by {@code getComponent()} is an
* instance of {@code JComponent}, then this method will dispatch to that
* {@code JComponent's} {@code putClientProperty(Object, Object)} method.
* Otherwise, this {@code DockableComponentWrapper} will provide its own
* internal mapping of client properties.
*
* @param key
* the new client property key
* @param value
* the new client property value; if {@code null} this method
* will remove the property
* @see Dockable#putClientProperty(Object, Object)
* @see javax.swing.JComponent#putClientProperty(java.lang.Object,
* java.lang.Object)
*/
public void putClientProperty(Object key, Object value) {
if (key == null)
return;
Component c = getComponent();
if (c instanceof JComponent) {
SwingUtility.putClientProperty(c, key, value);
} else {
Utilities.put(getInternalClientProperties(), key, value);
}
}
/**
* Returns a {@code DockablePropertySet} instance associated with this
* {@code Dockable}. This method returns the default implementation
* supplied by the framework by invoking
* {@code getDockablePropertySet(Dockable dockable)} on
* {@code org.flexdock.docking.props.PropertyManager} and supplying an
* argument of {@code this}.
*
* @return the {@code DockablePropertySet} associated with this
* {@code Dockable}. This method will not return a {@code null}
* reference.
* @see Dockable#getDockingProperties()
* @see org.flexdock.docking.props.PropertyManager#getDockablePropertySet(Dockable)
*/
public DockablePropertySet getDockingProperties() {
return PropertyManager.getDockablePropertySet(this);
}
/**
* Returns the {@code DockingPort} within which this {@code Dockable} is
* currently docked. If not currently docked, this method will return
* {@code null}.
* <p>
* This method defers processing to
* {@code getDockingPort(Dockable dockable)}, passing an argument of
* {@code this}.
*
* @return the {@code DockingPort} within which this {@code Dockable} is
* currently docked.
* @see Dockable#getDockingPort()
* @see DockingManager#getDockingPort(Dockable)
*/
public DockingPort getDockingPort() {
return DockingManager.getDockingPort(this);
}
/**
* Provides the default {@code Dockable} implementation of
* {@code dock(Dockable dockable)} by calling and returning
* {@code DockingManager.dock(Dockable dockable, Dockable parent)}.
* {@code 'this'} is passed as the {@code parent} parameter.
*
* @param dockable
* the {@code Dockable} to dock relative to this {@code Dockable}
* @return {@code true} if the docking operation was successful;
* {@code false} otherwise.
* @see Dockable#dock(Dockable)
* @see DockingManager#dock(Dockable, Dockable)
*/
public boolean dock(Dockable dockable) {
return DockingManager.dock(dockable, this);
}
/**
* Provides the default {@code Dockable} implementation of
* {@code dock(Dockable dockable, String relativeRegion)} by calling and
* returning
* {@code DockingManager.dock(Dockable dockable, Dockable parent, String region)}.
* {@code 'this'} is passed as the {@code parent} parameter.
*
* @param dockable
* the {@code Dockable} to dock relative to this {@code Dockable}
* @param relativeRegion
* the docking region into which to dock the specified
* {@code Dockable}
* @return {@code true} if the docking operation was successful;
* {@code false} otherwise.
* @see Dockable#dock(Dockable, String)
* @see DockingManager#dock(Dockable, Dockable, String)
*/
public boolean dock(Dockable dockable, String relativeRegion) {
return DockingManager.dock(dockable, this, relativeRegion);
}
/**
* Provides the default {@code Dockable} implementation of
* {@code dock(Dockable dockable, String relativeRegion, float ratio)} by
* calling and returning
* {@code DockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion)}.
* {@code 'this'} is passed as the {@code parent} parameter.
*
* @param dockable
* the {@code Dockable} to dock relative to this {@code Dockable}
* @param relativeRegion
* the docking region into which to dock the specified
* {@code Dockable}
* @param ratio
* the proportion of available space in the resulting layout to
* allot to the new sibling {@code Dockable}.
* @return {@code true} if the docking operation was successful;
* {@code false} otherwise.
* @see DockingManager#dock(Dockable, Dockable, String, float)
*/
public boolean dock(Dockable dockable, String relativeRegion, float ratio) {
return DockingManager.dock(dockable, this, relativeRegion, ratio);
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
getDockingProperties().addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
getDockingProperties().removePropertyChangeListener(listener);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -