|
||||||||||
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.
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 . |
protected ITriggerState |
getTriggerState()
Convenience method to obtain the ITriggerState that actually caused the execute method to be invoked. |
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 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 undo 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 |
Constructor Detail |
---|
public AbstractCombination()
Method Detail |
---|
public 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 void schedule(IEffect effect)
effect
- the effect to scheduleprotected void schedule(IEffectCompound compoundEffect)
compoundEffect
- the compound effect to scheduleprotected void enableEffectRecording()
protected void undoRecordedEffects()
public 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 ITriggerState getTriggerState()
public void undo()
undo
in interface ICombination
public boolean isActive()
isActive
in interface ICombination
public 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 |