|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.core.kivi.AbstractCombination
public abstract class AbstractCombination
Abstract base implementation for combinations. It implements many methods of ICombination and adds much extra convenience for Combination developers.
In the ICombination
the developer has to implement
ITriggerListener.getTriggerStates()
and ICombination#trigger(ITriggerState)
. In this
abstract implementation both methods are implemented such that developer instead implements
execute()
where the abstract implementation uses reflection to find out (1) which are
the trigger classes that the combination listens to (by the execute parameters) and (2) what are
other current ITriggerState
s. Such way the execute method has direct access to all states
that it requires.
Additionally, a static method getParameters()
can be added to specify combination
parameters that should be visible in the preference page. The return value must be an array
of CombinationParameter
s. Warning: Do not publish the same parameter in the
preferences of two different combinations, since that can lead to undesired behavior. However,
the value of one parameter may be accessed from multiple combinations.
Field Summary | |
---|---|
protected static int |
FIFTH
index constant for the fifth trigger state parameter. |
protected static int |
FIRST
index constant for the first trigger state parameter. |
protected static int |
FOURTH
index constant for the fourth trigger state parameter. |
protected static int |
SECOND
index constant for the second trigger state parameter. |
protected static int |
SEVENTH
index constant for the seventh trigger state parameter. |
protected static int |
SIXTH
index constant for the sixth trigger state parameter. |
protected static int |
THIRD
index constant for the third trigger state parameter. |
Constructor Summary | |
---|---|
AbstractCombination()
|
Method Summary | |
---|---|
protected void |
enableEffectRecording()
Activate recording of old effects. |
List<IEffect> |
getEffects()
Get the list of effects that are ready to be executed after the last triggering of an ITriggerState . |
Class<? extends ITriggerState>[] |
getTriggerStates()
Get the array of trigger state classes this combination listens to. |
void |
handle(ITriggerState triggerState)
Handle one specific trigger state that just changed. |
boolean |
isActive()
Check whether this combination is active. |
protected ITriggerState |
latestState()
Convenience method to obtain the trigger state that actually caused the execute method to be invoked. |
protected int |
latestStateIndex()
Convenience method to obtain the index of the trigger state that actually caused the execute method to be invoked. |
protected void |
schedule(IEffect effect)
Schedule an effect for execution, performs merging against all other effects scheduled during this execution before actually executing the effect. |
protected void |
schedule(IEffectCompound compoundEffect)
Schedule a compound effect for execution, performs merging against all other effects scheduled during this execution before actually executing the effect. |
void |
setActive(boolean a)
Change the active status of this combination. |
String |
toString()
|
void |
undo()
Attempt to undo all active effects, for example when shutting down view management or when disabling this combination. |
protected void |
undoRecordedEffects()
Explicit call to enable undoing all old effects since the last call of this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int FIRST
protected static final int SECOND
protected static final int THIRD
protected static final int FOURTH
protected static final int FIFTH
protected static final int SIXTH
protected static final int SEVENTH
Constructor Detail |
---|
public AbstractCombination()
Method Detail |
---|
public final void handle(ITriggerState triggerState)
handle
in interface ITriggerListener
triggerState
- the trigger state responsible for the triggeringpublic List<IEffect> getEffects()
ITriggerState
.
getEffects
in interface ICombination
protected final void schedule(IEffect effect)
effect
- the effect to scheduleprotected final void schedule(IEffectCompound compoundEffect)
compoundEffect
- the compound effect to scheduleprotected final void enableEffectRecording()
protected final void undoRecordedEffects()
public final Class<? extends ITriggerState>[] getTriggerStates()
ITriggerState
classes this combination listens to.
Read all methods called "execute" and get all parameters that they have. Return an array of
these parameters. Can be overridden when the default mechanism of registering triggers by
implementing execute(ConcreteTrigger) is not wanted.
Will throw the unchecked IllegalArgumentException
if there are execute methods with
overlapping parameters found. In such case KIVi cannot decide in which order it should
execute such methods. So this case is currently not supported.
getTriggerStates
in interface ITriggerListener
protected final ITriggerState latestState()
protected final int latestStateIndex()
switch
statement to implement different
behavior depending on the latest trigger state. The result corresponds to the index in the
order of parameters as given in the execute method header. Caution: The meaning of
the returned indices may change when more parameters are added to the execute method, or
when their order is modified.
public void undo()
undo
in interface ICombination
public final boolean isActive()
isActive
in interface ICombination
public final void setActive(boolean a)
setActive
in interface ICombination
a
- new active statuspublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |