de.cau.cs.kieler.kiml.config
Class SemanticLayoutConfig

java.lang.Object
  extended by de.cau.cs.kieler.kiml.config.SemanticLayoutConfig
All Implemented Interfaces:
ILayoutConfig, IMutableLayoutConfig
Direct Known Subclasses:
ActionLayoutConfig, AnnotationsLayoutConfig, AnnotationsLayoutConfig, HVLayoutConfig, HypernodeLayoutConfig, TypeLayoutConfig

public abstract class SemanticLayoutConfig
extends Object
implements IMutableLayoutConfig

An abstract layout configuration that is able to consider semantic model properties.

Rating red

Field Summary
static int PRIORITY
          the default priority for semantic layout configurations.
 
Fields inherited from interface de.cau.cs.kieler.kiml.config.IMutableLayoutConfig
OPT_RECURSIVE
 
Constructor Summary
SemanticLayoutConfig()
           
 
Method Summary
 void clearValues(LayoutContext context)
          Clear all layout option values that have been set for the given context.
 void enrich(LayoutContext context)
          Enrich the given context with additional information that can be derived from what is already contained.
protected abstract  IProperty<?>[] getAffectedOptions(EObject semanticElem)
          Returns the options that are affected by this layout configuration.
 int getPriority()
          Return the priority of this layout configuration, which is relevant when multiple configurations are applied.
protected abstract  Object getSemanticValue(EObject semanticElem, LayoutOptionData<?> layoutOption)
          Determine the value of the given layout option from the semantic element.
 Object getValue(LayoutOptionData<?> optionData, LayoutContext context)
          Get the current value for a layout option in the given context.
 boolean isSet(LayoutOptionData<?> optionData, LayoutContext context)
          Determine whether the given layout option is set, not considering any default values.
protected abstract  void setSemanticValue(EObject semanticElem, LayoutOptionData<?> layoutOption, Object value)
          Set a layout option value for the semantic element.
 void setValue(LayoutOptionData<?> optionData, LayoutContext context, Object value)
          Set a new value for a layout option in the given context.
 void transferValues(KGraphData graphData, LayoutContext context)
          Transfer all non-default values that are managed by this layout configuration to the given graph data holder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY

public static final int PRIORITY
the default priority for semantic layout configurations.

See Also:
Constant Field Values
Constructor Detail

SemanticLayoutConfig

public SemanticLayoutConfig()
Method Detail

getPriority

public int getPriority()
Return the priority of this layout configuration, which is relevant when multiple configurations are applied.

Specified by:
getPriority in interface ILayoutConfig
Returns:
the priority

getAffectedOptions

protected abstract IProperty<?>[] getAffectedOptions(EObject semanticElem)
Returns the options that are affected by this layout configuration.

Parameters:
semanticElem - a semantic model element
Returns:
the affected options, or null if there are none

getSemanticValue

protected abstract Object getSemanticValue(EObject semanticElem,
                                           LayoutOptionData<?> layoutOption)
Determine the value of the given layout option from the semantic element.

Parameters:
semanticElem - a semantic model element
layoutOption - a layout option
Returns:
the corresponding value, or null if no specific value is determined

setSemanticValue

protected abstract void setSemanticValue(EObject semanticElem,
                                         LayoutOptionData<?> layoutOption,
                                         Object value)
Set a layout option value for the semantic element. This feature is optional, so subclasses may leave the implementation empty.

Parameters:
semanticElem - a semantic model element
layoutOption - a layout option
value - a value for the layout option, or null if the currently set value shall be deleted

enrich

public void enrich(LayoutContext context)
Enrich the given context with additional information that can be derived from what is already contained.

Specified by:
enrich in interface ILayoutConfig
Parameters:
context - a context for layout configuration

getValue

public final Object getValue(LayoutOptionData<?> optionData,
                             LayoutContext context)
Get the current value for a layout option in the given context.

Specified by:
getValue in interface ILayoutConfig
Parameters:
optionData - a layout option descriptor
context - a context for layout configuration
Returns:
the layout option value, or null if the option has no value in this context

transferValues

public final void transferValues(KGraphData graphData,
                                 LayoutContext context)
Transfer all non-default values that are managed by this layout configuration to the given graph data holder.

Specified by:
transferValues in interface ILayoutConfig
Parameters:
graphData - a graph data instance that can hold layout options
context - a context for layout configuration

clearValues

public void clearValues(LayoutContext context)
Clear all layout option values that have been set for the given context.

Specified by:
clearValues in interface IMutableLayoutConfig
Parameters:
context - a context for layout configuration

setValue

public final void setValue(LayoutOptionData<?> optionData,
                           LayoutContext context,
                           Object value)
Set a new value for a layout option in the given context.

Specified by:
setValue in interface IMutableLayoutConfig
Parameters:
optionData - a layout option descriptor
context - a context for layout configuration
value - the new layout option value, or null if the current value shall be removed

isSet

public final boolean isSet(LayoutOptionData<?> optionData,
                           LayoutContext context)
Determine whether the given layout option is set, not considering any default values.

Specified by:
isSet in interface IMutableLayoutConfig
Parameters:
optionData - a layout option descriptor
context - a context for layout configuration
Returns:
true if the option is set