de.cau.cs.kieler.core.model.gmf.effects
Class FocusContextEffect

java.lang.Object
  extended by de.cau.cs.kieler.core.model.gmf.effects.FocusContextEffect
All Implemented Interfaces:
IEffectCompound

public class FocusContextEffect
extends Object
implements IEffectCompound

A FocusContextEffect implements the Focus & Context behavior for graphical models for their diagrams in the KIELER View Management. After creating the effect, it allows to add semantical EObjects to the focus. These elements will be shown with most detail. Other objects will form the context and will be shown with the least detail. Currently full detail means that all compartments of the element are expanded while less detail means that all compartments get collapsed.

In the future this could be extended to also support multiple levels of focus and/or context and even different ways of reducing the level of detail. This could include complete hiding of elements (i.e. use only a subset of elements as the context to reduce overall size of a model) or to hide text labels, e.g. at connections or nodes.

Next to an object added to the focus it can be specified how many containment levels of this particular object should be added to the focus, e.g. none, all (i.e. adding the complete children hierarchy of this object) or a specific level.

In opposite to the children hierarchy the parent hierarchy is always added completely for one element. Therefore for one element, all of its ancestors will be added to the focus. Only after the whole focus has been set, this transitive focus gets calculated and the context will be set as its complement.

This class implements IEffectCompound as it is composed out of many CompartmentCollapseExpandEffects and in future may also contain other effects. While an IEffectCompound itself is no IEffect, it can be asked for a list of the primitive effects by getPrimitiveEffects(). An AbstractCombination is able to schedule an IEffectCompound just like it can schedule an IEffect. However, this is just some convenience function to schedule all primitive effects successively.

Rating red

Constructor Summary
FocusContextEffect(IWorkbenchPart editor)
          Construct a FocusContextEffect at a given diagram (Editor or View).
 
Method Summary
 void addFocus(Collection<EObject> focusedObjects, boolean addDescendants)
          Add multiple elements to the focus.
 void addFocus(Collection<EObject> focusedObjects, int childrenLevel)
          Add multiple elements to the focus.
 void addFocus(EObject focusedObject, boolean addDescendants)
          Add one element to the focus.
 void addFocus(EObject focusedObject, int childrenLevel)
          Add one element to the focus.
 List<IEffect> getPrimitiveEffects()
          Get the list of primitive IEffects that this compound effect is composed of.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FocusContextEffect

public FocusContextEffect(IWorkbenchPart editor)
Construct a FocusContextEffect at a given diagram (Editor or View). The WorkbenchPart is required to be supported by the registered GraphicalFrameworkService. If not, this will throw a runtime KielerNotSupportedException.

Parameters:
editor - a GraphicalFrameworkService compatible Editor or View
Method Detail

getPrimitiveEffects

public List<IEffect> getPrimitiveEffects()
Get the list of primitive IEffects that this compound effect is composed of.

Specified by:
getPrimitiveEffects in interface IEffectCompound
Returns:
list of IEffects

addFocus

public void addFocus(EObject focusedObject,
                     boolean addDescendants)
Add one element to the focus. All ancestors of focus objects will also be in the focus. Other objects will be the context. Descendants will be also added if the corresponding parameter is true. It will add all deeply nested children.

Parameters:
focusedObject - the object to add to the focus
addDescendants - true if all descendants (all deeply nested children) should also be added

addFocus

public void addFocus(EObject focusedObject,
                     int childrenLevel)
Add one element to the focus. Ancestors of focus objects will also be in the focus. Other objects will be the context. Descendants will be also added if the corresponding childrenLevel parameter is greater than 0. It will add all children to the given level, i.e. a level of 0 adds no children, 1 adds all direct children, 2 adds all direct children and all of their direct children, etc.

Parameters:
focusedObject - the object to add to the focus
childrenLevel - adds children up to this given hierarchy level

addFocus

public void addFocus(Collection<EObject> focusedObjects,
                     boolean addDescendants)
Add multiple elements to the focus. All ancestors of focus objects will also be in the focus. Other objects will be the context.

Parameters:
focusedObjects - the objects to add to the focus
addDescendants - true if all descendants (all deeply nested children) should also be added

addFocus

public void addFocus(Collection<EObject> focusedObjects,
                     int childrenLevel)
Add multiple elements to the focus. All ancestors of focus objects will also be in the focus. Other objects will be the context. Descendants will be also added if the corresponding childrenLevel parameter is greater than 0. It will add all children to the given level, i.e. a level of 0 adds no children, 1 adds all direct children, 2 adds all direct children and all of their direct children, etc.

Parameters:
focusedObjects - the objects to add to the focus
childrenLevel - adds children up to this given hierarchy level