de.cau.cs.kieler.viewmanagement
Class ACombination

java.lang.Object
  extended by de.cau.cs.kieler.viewmanagement.ACombination
All Implemented Interfaces:
ITriggerListener, EventListener
Direct Known Subclasses:
ActiveStateHighlightCombination, CollapseLayoutCombination, KSBasECombination, ManualLayoutCombination, SelectionCollapseCombination, SelectionExpandCombination, SelectionFilterCombination, SelectionHighlightCombination, SelectionLayoutCombination, SelectionShapeHighlightCombination, SelectionTextualRepresentationCombination, SelectionUnFilterCombination, SelectionZoomAndScrollToCombination, SelectionZoomCombination

public abstract class ACombination
extends Object
implements ITriggerListener

Abstract definition of a combination. The combination connects triggers and effects and is itself a triggerlistener. Triggers will call its notifyTrigger() to inform a listening combination about a new event. The combination will then receive a TriggerEventObject with information. A combination has two main methods, evaluate() and execute(). evaluate() should determine whether or not the combination should be executed. Here e.g. a number of triggers could be connected or other conditions considered before executing. execute will be called if evaluate returns true. execute() is the place where the desired effects should be initialized, set up and finally executed themselves.

Rating red

Constructor Summary
ACombination()
           
 
Method Summary
abstract  boolean evaluate(TriggerEventObject triggerEvent)
          Abstract method to evaluate certain conditions chosen by the developer that should delay or trigger the execution of the combination.
abstract  void execute()
          Abstract method to execute the combination.
 void finalize()
          Finalizes the combination, removes it as listener from its triggers.
 EditPart getEditPart(EObject eObject)
          Find an GEF EditPart that corresponds to an semantic model EObject.
static EditPart getRootEPAsParent()
          Helper method for translateToEditPart to get a parent element from which to start the search
protected abstract  List<ATrigger> getTriggers()
          Abstract method that returns the triggers that are of importance for this combination.
 void initialize()
          Initializes the combination and registers it as listener to the triggers of interest.
 boolean isActive()
           
 void notifyTrigger(TriggerEventObject triggerEvent)
          This is called whenever a trigger the combination is listening to has a new event
protected  void resetHashedEditParts()
          Reset hashed edit parts.
 void setActive(boolean active)
          Sets the status of the combination
 EditPart translateToEditPart(String elementURIFragment, EditPart parent)
          Deprecated. with this method, adressing of transitions is not possible. Adressing should be done with EObjects. Use getEditPart(EObject eObject) instead.
 void undoEffects()
          Removes the last effect when shutting down the View Management, if needed.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACombination

public ACombination()
Method Detail

evaluate

public abstract boolean evaluate(TriggerEventObject triggerEvent)
Abstract method to evaluate certain conditions chosen by the developer that should delay or trigger the execution of the combination.

Parameters:
triggerEvent - delivered by a trigger, contains necessary information for the combination
Returns:
true if combination should be executed, false otherwise.

execute

public abstract void execute()
Abstract method to execute the combination. Creation of desired effects and their setup is to be done here.


getTriggers

protected abstract List<ATrigger> getTriggers()
Abstract method that returns the triggers that are of importance for this combination. Will be used when initializing or finalizing the combination and then register it as listeners to the triggers returned in the list.

Returns:
List of triggers to be observed

undoEffects

public void undoEffects()
Removes the last effect when shutting down the View Management, if needed. In that case, it should be overridden.


isActive

public final boolean isActive()
Returns:
Status of the combination, active or not

setActive

public final void setActive(boolean active)
Sets the status of the combination

Parameters:
active - new status

initialize

public final void initialize()
Initializes the combination and registers it as listener to the triggers of interest.


finalize

public final void finalize()
Finalizes the combination, removes it as listener from its triggers.

Overrides:
finalize in class Object

resetHashedEditParts

protected void resetHashedEditParts()
Reset hashed edit parts. This is when reusing combination for e.g., a different editor. (added by cmot) This method is needed if you want to use the visualization effect for different editors (after another). Reset of EditPartCache is necessary. (cmot, 09.11.09) Added a reset of the second cache. (cmot, 10.11.09)


notifyTrigger

public final void notifyTrigger(TriggerEventObject triggerEvent)
This is called whenever a trigger the combination is listening to has a new event

Specified by:
notifyTrigger in interface ITriggerListener
Parameters:
triggerEvent - the object to be delivered

getRootEPAsParent

public static final EditPart getRootEPAsParent()
Helper method for translateToEditPart to get a parent element from which to start the search

Returns:
rootEP, result of the search

translateToEditPart

public final EditPart translateToEditPart(String elementURIFragment,
                                          EditPart parent)
Deprecated. with this method, adressing of transitions is not possible. Adressing should be done with EObjects. Use getEditPart(EObject eObject) instead.

Translation method to convert the elementURIFragment to EditPart. Called by a combination to convert a value given by a trigger to give it to a trigger. A Hashmap is used to cache search results for later use. Note: This addressing method is discouraged and should not be used anymore. Use EObjects and their addressing methods instead.

Parameters:
elementURIFragment - given e.g. by a trigger
parent - element from which to start the search. Can be specified if known in order to speed up the search, but may be null. Then it'll be replaced by the rootEditPart by calling getRootEPAsParent
Returns:
the result of the search, in case of success the corresponding EditPart, otherwise null

getEditPart

public final EditPart getEditPart(EObject eObject)
Find an GEF EditPart that corresponds to an semantic model EObject. A Hashmap is used to cache already found objects for better performance. EObjects are used to address objects that are exchanged between the plugins of the View Management as well as other plugins. EObjects provide the ability for semantical addressing of other objects such as children of an object or similar cases.

Parameters:
eObject - the semantic object
Returns:
the corresponding EditPart