public class StationChildrenActionSource extends AbstractDockActionSource
DockActionSource
is a wrapper around a Dockable
or a DockStation
and adds one DockAction
for each child of the station to itself. Subclasses may implement
a filter to show more or less actions.Modifier and Type | Class and Description |
---|---|
protected class |
StationChildrenActionSource.FocusAction
An action that can transfer the focus
|
listeners
Constructor and Description |
---|
StationChildrenActionSource(Dockable dockable,
LocationHint hint)
Creates a new action source.
|
Modifier and Type | Method and Description |
---|---|
void |
addDockActionSourceListener(DockActionSourceListener listener)
Adds a listener to this source.
|
protected DockAction |
createActionFor(Dockable dockable)
Creates the
DockAction which is shown for dockable . |
Dockable |
getDockable()
Gets the dockable or station which is managed by this source.
|
DockAction |
getDockAction(int index)
Gets the index'th
DockAction of this source. |
int |
getDockActionCount()
Gets the number of
DockActions which are
provided by this source. |
LocationHint |
getLocationHint()
Gets a hint where to put this source in relation to other sources.
|
Iterator<DockAction> |
iterator() |
void |
removeDockActionSourceListener(DockActionSourceListener listener)
Removes an earlier added listener.
|
protected boolean |
shouldShow(Dockable dockable)
Tells which children to show and which not.
|
protected void |
sort(List<Dockable> dockables)
Puts an order in the dockables, telling which items to show when.
|
fireAdded, fireRemoved, hasListeners, indexOf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public StationChildrenActionSource(Dockable dockable, LocationHint hint)
dockable
- the dockable or station whose children to show, not null
hint
- the preferred location of this DockActionSource
, may be null
public Dockable getDockable()
null
public LocationHint getLocationHint()
DockActionSource
ActionOffer
can choose to ignore these hints, or interpret
them in an unexpected way.public DockAction getDockAction(int index)
DockActionSource
DockAction
of this source.index
- The index of the actionpublic int getDockActionCount()
DockActionSource
DockActions
which are
provided by this source.DockActions
public Iterator<DockAction> iterator()
public void addDockActionSourceListener(DockActionSourceListener listener)
DockActionSource
DockActionSourceListener
should
be informed whenever some DockActions
are added or
removed from this source.addDockActionSourceListener
in interface DockActionSource
addDockActionSourceListener
in class AbstractDockActionSource
listener
- The listenerpublic void removeDockActionSourceListener(DockActionSourceListener listener)
DockActionSource
removeDockActionSourceListener
in interface DockActionSource
removeDockActionSourceListener
in class AbstractDockActionSource
listener
- The listener to removeDockActionSource.addDockActionSourceListener(DockActionSourceListener)
protected DockAction createActionFor(Dockable dockable)
DockAction
which is shown for dockable
. The
default behavior is to create a ButtonDockAction
which can be pressed
and will transfer the focus to dockable
.dockable
- the item for which an action is requirednull
protected void sort(List<Dockable> dockables)
DockStation
s
and Dockable
s). Subclasses may also modify the list by adding or removing items,
although a filter is better implemented by overriding shouldShow(Dockable)
dockables
- the array to orderprotected boolean shouldShow(Dockable dockable)
true
for
any direct child or true
if the monitored dockable is no station at all.dockable
- the child to checktrue
if there should be a button, false
otherwise