de.cau.cs.kieler.kiml
Class SemanticLayoutConfig

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

public abstract class SemanticLayoutConfig
extends Object
implements ILayoutConfig

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

Rating red

Constructor Summary
SemanticLayoutConfig()
           
 
Method Summary
 void clearProperties()
          Remove all stored layout options.
 void copyProperties(IPropertyHolder holder)
          Copy all properties from another property holder to this one.
 Map<IProperty<?>,Object> getAllProperties()
          Returns a map of all assigned properties with associated values.
 LayoutAlgorithmData getContainerLayouterData()
          Returns null, since this layout configuration is not connected to a layout algorithm.
 LayoutAlgorithmData getContentLayouterData()
          Returns null, since this layout configuration is not connected to a layout algorithm.
 LayoutAlgorithmData getLayouterData(String layoutHint, String diagramType)
          Throws an UnsupportedOperationException, since this configuration cannot be used to handle layout providers.
 List<LayoutOptionData<?>> getOptionData()
          Returns a list of available layout option descriptors.
protected abstract  List<LayoutOptionData<?>> getOptionData(EObject semanticElem)
          Returns a list of options that are affected by this layout configuration.
<T> T
getProperty(IProperty<T> property)
          Retrieves a property value.
protected abstract  Object getSemanticProperty(EObject semanticElem, LayoutOptionData<?> layoutOption)
          Determine the value of the given layout option from the semantic element.
 boolean isDefault(LayoutOptionData<?> optionData)
          Returns true if the given option has its default value.
protected  List<LayoutOptionData<?>> makeList(String... ids)
          Make a list of layout option descriptors from the given layout option identifiers.
 void setDiagramDefault(LayoutOptionData<?> optionData, Object value)
          Throws an UnsupportedOperationException, since this configuration cannot be used to change diagram options.
 void setFocus(Object obj)
          Set the focus of this layout configuration on the given element.
 void setProperty(IProperty<?> property, Object value)
          Sets a property value.
protected abstract  void setSemanticProperty(EObject semanticElem, LayoutOptionData<?> layoutOption, Object value)
          Set a layout option value for the semantic element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemanticLayoutConfig

public SemanticLayoutConfig()
Method Detail

makeList

protected final List<LayoutOptionData<?>> makeList(String... ids)
Make a list of layout option descriptors from the given layout option identifiers.

Parameters:
ids - identifiers of layout options
Returns:
a list of corresponding layout option descriptors

getOptionData

protected abstract List<LayoutOptionData<?>> getOptionData(EObject semanticElem)
Returns a list of options that are affected by this layout configuration.

Parameters:
semanticElem - a semantic model element
Returns:
the affected options

getSemanticProperty

protected abstract Object getSemanticProperty(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

setSemanticProperty

protected abstract void setSemanticProperty(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

getOptionData

public final List<LayoutOptionData<?>> getOptionData()
Returns a list of available layout option descriptors.

Specified by:
getOptionData in interface ILayoutConfig
Returns:
list of available layout options

getAllProperties

public Map<IProperty<?>,Object> getAllProperties()
Returns a map of all assigned properties with associated values.

Specified by:
getAllProperties in interface IPropertyHolder
Returns:
a map of all properties

getProperty

public final <T> T getProperty(IProperty<T> property)
Retrieves a property value. If the property is not set, its default value shall be taken, which is taken from the given property instance.

Specified by:
getProperty in interface IPropertyHolder
Type Parameters:
T - type of property
Parameters:
property - the property to get
Returns:
the current value, or the default value if the property is not set

setProperty

public final void setProperty(IProperty<?> property,
                              Object value)
Sets a property value. No type checking is performed while setting, so users of this method must take care that the right object types are generated.

Specified by:
setProperty in interface IPropertyHolder
Parameters:
property - the property to set
value - the new value

setFocus

public final void setFocus(Object obj)
Set the focus of this layout configuration on the given element. If null is passed, the current focus is cleared.

Specified by:
setFocus in interface ILayoutConfig
Parameters:
obj - a diagram element for which layout options shall be analyzed, or null

isDefault

public boolean isDefault(LayoutOptionData<?> optionData)
Returns true if the given option has its default value.

Specified by:
isDefault in interface ILayoutConfig
Parameters:
optionData - a layout option data
Returns:
whether the option has a default value

clearProperties

public void clearProperties()
Remove all stored layout options.

Specified by:
clearProperties in interface ILayoutConfig

copyProperties

public void copyProperties(IPropertyHolder holder)
Copy all properties from another property holder to this one.

Specified by:
copyProperties in interface IPropertyHolder
Parameters:
holder - another property holder

getContentLayouterData

public LayoutAlgorithmData getContentLayouterData()
Returns null, since this layout configuration is not connected to a layout algorithm.

Specified by:
getContentLayouterData in interface ILayoutConfig
Returns:
null

getContainerLayouterData

public LayoutAlgorithmData getContainerLayouterData()
Returns null, since this layout configuration is not connected to a layout algorithm.

Specified by:
getContainerLayouterData in interface ILayoutConfig
Returns:
null

setDiagramDefault

public void setDiagramDefault(LayoutOptionData<?> optionData,
                              Object value)
Throws an UnsupportedOperationException, since this configuration cannot be used to change diagram options.

Specified by:
setDiagramDefault in interface ILayoutConfig
Parameters:
optionData - a layout option
value - an option value

getLayouterData

public LayoutAlgorithmData getLayouterData(String layoutHint,
                                           String diagramType)
Throws an UnsupportedOperationException, since this configuration cannot be used to handle layout providers.

Specified by:
getLayouterData in interface ILayoutConfig
Parameters:
layoutHint - a layout hint
diagramType - a diagram type
Returns:
nothing