public class ActionViewConverter extends Object
ActionViewConverter transforms DockActions into
views like buttons or menu-items.DockActions. In order to create a view for an
action, the ActionType of the DockAction must be known. The
ActionType tells how the action normally behaves. Some types are
already defined, for example the ActionType.BUTTON behaves like a
button: once the action is triggered, it does something, and later the action
can be triggered again. There are several DockActions which act like
a button, but their internal organization differs a lot.DockAction. A platform might be a popup-menu, or one of the
many DockTitles. Since some platforms need the same
visualization of DockActions (i.e. a popup-menu and a normal menu both need
menu-items), the platforms are grouped. Every group is identified by a
ViewTarget. There are already some ViewTargets defined, i.e. the
ViewTarget.TITLE is used for the group of DockTitles.ActionViewConverter must known how to create a view for all possible
pairs of ActionTypes and ViewTargets. In order to do so, he has a set
of ViewGenerators. Each ViewGenerator is used to handle
one pair of ActionType and ViewTarget.ActionViewConverter has three slots for each pair. There can be a
ViewGenerator in every slot. The slots have different priority and meaning.
Whenever a ViewGenerator for a pair is needed, the slots are searched for the
first non-null value with the highest priority. The meaning
of the three slots are:
DockTheme. This slot
is only used if the client-slot is empty.ActionTypes or new ViewTargets, he has
to provide the ViewGenerators for all new possible pairs. That includes pairs
where one partner is a predefined ActionType or ViewTarget.| Constructor and Description |
|---|
ActionViewConverter()
Creates a new ActionViewConverter
|
| Modifier and Type | Method and Description |
|---|---|
<A,D extends DockAction> |
createView(ActionType<D> type,
D action,
ViewTarget<A> target,
Dockable dockable)
Creates and sets up a new view.
|
<A> A |
createView(DockAction action,
ViewTarget<A> target,
Dockable dockable)
Creates and sets up a new view.
|
protected <A,D extends DockAction> |
getConverter(ActionType<D> action,
ViewTarget<? super A> target)
Searches a converter for the given
action and target. |
<A,D extends DockAction> |
putClient(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new
ViewGenerator to this ActionViewConverter. |
<A,D extends DockAction> |
putDefault(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new
ViewGenerator to this ActionViewConverter. |
<A,D extends DockAction> |
putTheme(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new
ViewGenerator to this ActionViewConverter. |
public ActionViewConverter()
public <A,D extends DockAction> void putClient(ActionType<D> action, ViewTarget<A> target, ViewGenerator<D,A> generator)
ViewGenerator to this ActionViewConverter. The
generator will have the high priority.A - the type of view created by the converterD - the type of action needed as input for the converteraction - the type of actions needed as inputtarget - the platform for which converter creates outputgenerator - the generator to store, may be nullpublic <A,D extends DockAction> void putTheme(ActionType<D> action, ViewTarget<A> target, ViewGenerator<D,A> generator)
ViewGenerator to this ActionViewConverter. The
generator will have the normal priority.A - the type of view created by the converterD - the type of action needed as input for the converteraction - the type of actions needed as inputtarget - the platform for which converter creates outputgenerator - the generator to store, may be nullpublic <A,D extends DockAction> void putDefault(ActionType<D> action, ViewTarget<A> target, ViewGenerator<D,A> generator)
ViewGenerator to this ActionViewConverter. The
generator will have the low priority.A - the type of view created by the converterD - the type of action needed as input for the converteraction - the type of actions needed as inputtarget - the platform for which converter creates outputgenerator - the generator to store, may be nullpublic <A> A createView(DockAction action, ViewTarget<A> target, Dockable dockable)
createView
of DockAction.A - the type of the viewaction - the action for which a view is createdtarget - the target platform, where the view will be showndockable - the Dockable for which the action is usednull if nothing should be shownIllegalArgumentException - if an unknown argument is usedpublic <A,D extends DockAction> A createView(ActionType<D> type, D action, ViewTarget<A> target, Dockable dockable)
A - the type of the viewD - the type of action to converttype - the type of actionaction - the action for which a view is createdtarget - the target platform, where the view will be showndockable - the Dockable for which the action is usednull if nothing should be shownIllegalArgumentException - if an unknown argument is usedprotected <A,D extends DockAction> ViewGenerator<D,A> getConverter(ActionType<D> action, ViewTarget<? super A> target)
action and target.A - the type that the converter will produceD - the type of action needed as inputaction - the action that will be transformedtarget - the target platformnull if no converter is foundCopyright © 2017 Docking Frames. All rights reserved.