public class MultiDockActionSource extends AbstractDockActionSource
DockActionSource
that combines various sources in one source.
This source behaves like a list of DockActionSources
.listeners
Constructor and Description |
---|
MultiDockActionSource(DockActionSource... sources)
Constructs a new source.
|
MultiDockActionSource(LocationHint hint,
DockActionSource... sources)
Constructs a new source.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DockAction... actions)
Adds several actions to this source.
|
void |
add(DockActionSource source)
Adds a source as child of this source.
|
void |
addDockActionSourceListener(DockActionSourceListener listener)
Adds a listener to this source.
|
void |
addSeparator()
Adds a separator at the end of the current list of actions
|
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. |
protected int |
getDockActionCountUntil(int index,
boolean allowUpdate)
Counts how many
DockActions are provided by the
source-children with index 0 (incl) to index (excl). |
LocationHint |
getLocationHint()
Gets a hint where to put this source in relation to other sources.
|
protected int |
getSource(DockAction action)
Gets the index of the child-source which contains
action . |
boolean |
isSeparateSources()
Tells whether there is a separator between sources or not
|
java.util.Iterator<DockAction> |
iterator() |
void |
remove(DockActionSource source)
Removes
source from this MultiDockActionSource . |
void |
removeAll()
Removes all children of this source.
|
void |
removeDockActionSourceListener(DockActionSourceListener listener)
Removes an earlier added listener.
|
void |
setHint(LocationHint hint)
Sets the location-hint of this source.
|
void |
setSeparateSources(boolean separateSources)
Sets whether there are separators between the children of this
source or not.
|
fireAdded, fireRemoved, hasListeners, indexOf
public MultiDockActionSource(DockActionSource... sources)
sources
are added as children
of this source.sources
- The children of this sourcepublic MultiDockActionSource(LocationHint hint, DockActionSource... sources)
sources
are added as children
of this source.hint
- the preferred location of this sourcesources
- The children of this sourcepublic java.util.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)
public LocationHint getLocationHint()
DockActionSource
ActionOffer
can choose to ignore these hints, or interpret
them in an unexpected way.public void setHint(LocationHint hint)
hint
- the hint that tells an ActionOffer
where to
put this source.public void addSeparator()
public boolean isSeparateSources()
true
if there is a separatorpublic void setSeparateSources(boolean separateSources)
separateSources
- true
if children should be separatedpublic void add(DockActionSource source)
DockActions
of source
will be presented as actions of this source.source
- the new childpublic void remove(DockActionSource source)
source
from this MultiDockActionSource
.source
- the child to removepublic void removeAll()
public void add(DockAction... actions)
actions
- the new actionspublic int getDockActionCount()
DockActionSource
DockActions
which are
provided by this source.DockActions
protected int getSource(DockAction action)
action
.action
- the action for which is searchedprotected int getDockActionCountUntil(int index, boolean allowUpdate)
DockActions
are provided by the
source-children with index 0 (incl) to index
(excl).index
- the index of the first source that should not be countedallowUpdate
- whether the updateSeparators()
can be called
by this method or notindex
child-sources.public DockAction getDockAction(int index)
DockActionSource
DockAction
of this source.index
- The index of the action