public class DefaultActionOffer extends java.lang.Object implements ActionOffer
DockActionSources
.
This ActionOffer tries to sort the sources by their LocationHint
,
and uses the Origin
if the
Hint
does not carry enough information.Constructor and Description |
---|
DefaultActionOffer()
Creates a new DefaultActionOffer.
|
DefaultActionOffer(LocationHint.Origin... origins)
Creates a new DefaultActionOffer.
|
Modifier and Type | Method and Description |
---|---|
DockActionSource |
getSource(Dockable dockable,
DockActionSource source,
DockActionSource[] guards,
DockActionSource parent,
DockActionSource[] parents)
|
boolean |
interested(Dockable dockable)
Tells whether this
ActionOffer wants to collect the
actions for the dockable , or if this ActionOffer
is not interested in the Dockable . |
boolean |
isSeparators()
Gets whether there are separators between groups.
|
void |
setHints(LocationHint.Hint[] hints)
Sets the preferred order of sources according to their hint.
|
void |
setOrigins(LocationHint.Origin[] origins)
Sets the preferred order of sources according to their origin.
|
void |
setSeparators(boolean separators)
Whether there shall be separators between groups.
|
public DefaultActionOffer()
public DefaultActionOffer(LocationHint.Origin... origins)
origin
is
used if several sources have the same preferred location hint.origins
- The order of the sources
with
equal location hintpublic void setOrigins(LocationHint.Origin[] origins)
origins
- the preferred orderpublic void setHints(LocationHint.Hint[] hints)
hints
- the preferred orderpublic void setSeparators(boolean separators)
separators
- true
if separators will be insertedpublic boolean isSeparators()
true
if separators are insertedpublic boolean interested(Dockable dockable)
ActionOffer
ActionOffer
wants to collect the
actions for the dockable
, or if this ActionOffer
is not interested in the Dockable
.interested
in interface ActionOffer
dockable
- The Dockable
to testtrue
if this ActionOffer should tell which
actions
will be associated with the dockable
,
false
otherwise.public DockActionSource getSource(Dockable dockable, DockActionSource source, DockActionSource[] guards, DockActionSource parent, DockActionSource[] parents)
ActionOffer
source
of actions
for the given Dockable
. The ActionOffer is free how to use the
actions that are created by other parts of the system, but it is a good
idea to use all of them. Note that each argument, and each element in
an array, can be null
.getSource
in interface ActionOffer
dockable
- The Dockable
for which the the source
has to be created. An invocation of interested
should return true
, otherwise the behavior of this method
is not specified.source
- the DockActionSource derived from dockableguards
- a list of DockActionSources derived from ActionGuards
parent
- the DockActionSource derived from the parent of dockable
parents
- a list of DockActionSources derived from all parents of dockable