|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.action.view.ActionViewConverter
public class ActionViewConverter
The ActionViewConverter
transforms DockActions
into
views like buttons or menu-items.
Every application has a set DockAction
s. 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 DockAction
s which act like
a button, but their internal organization differs a lot.
On the other hand, every application has a set of platforms which want to
display a DockAction
. A platform might be a popup-menu, or one of the
many DockTitle
s. Since some platforms need the same
visualization of DockAction
s (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 ViewTarget
s defined, i.e. the
ViewTarget.TITLE
is used for the group of DockTitle
s.
The ActionViewConverter
must known how to create a view for all possible
pairs of ActionType
s and ViewTarget
s. In order to do so, he has a set
of ViewGenerators
. Each ViewGenerator
is used to handle
one pair of ActionType
and ViewTarget
.
The 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.ActionType
s or new ViewTarget
s, he has
to provide the ViewGenerator
s for all new possible pairs. That includes pairs
where one partner is a predefined ActionType
or
Constructor Summary | |
---|---|
ActionViewConverter()
Creates a new ActionViewConverter |
Method Summary | ||
---|---|---|
|
createView(ActionType<D> type,
D action,
ViewTarget<A> target,
Dockable dockable)
Creates and sets up a new view. |
|
|
createView(DockAction action,
ViewTarget<A> target,
Dockable dockable)
Creates and sets up a new view. |
|
protected
|
getConverter(ActionType<D> action,
ViewTarget<? super A> target)
Searches a converter for the given action and target . |
|
|
putClient(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new ViewGenerator to this ActionViewConverter. |
|
|
putDefault(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new ViewGenerator to this ActionViewConverter. |
|
|
putTheme(ActionType<D> action,
ViewTarget<A> target,
ViewGenerator<D,A> generator)
Registers a new ViewGenerator to this ActionViewConverter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ActionViewConverter()
Method Detail |
---|
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 null
public <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 null
public <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 null
public <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 used
null
if nothing should be shown
IllegalArgumentException
- 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 used
null
if nothing should be shown
IllegalArgumentException
- 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 platform
null
if no converter is found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |