de.cau.cs.kieler.kiml
Class DefaultLayoutConfig

java.lang.Object
  extended by de.cau.cs.kieler.kiml.DefaultLayoutConfig
All Implemented Interfaces:
IPropertyHolder, ILayoutConfig
Direct Known Subclasses:
EclipseLayoutConfig

public class DefaultLayoutConfig
extends Object
implements ILayoutConfig

Default implementation of the layout configuration interface. This configuration handles the default values of layout providers and layout options.

Rating red

Constructor Summary
DefaultLayoutConfig()
           
 
Method Summary
 void clearProperties()
          Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.
 void copyProperties(IPropertyHolder holder)
          Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.
 Map<IProperty<?>,Object> getAllProperties()
          Returns a map of all layout options that are available for the selected element to their default values.
 LayoutProviderData getContainerLayouterData()
          Returns the layout provider descriptor for the container of the associated element.
 LayoutProviderData getContentLayouterData()
          Returns the layout provider descriptor for the content of the associated element.
 LayoutProviderData getLayouterData(String theLayoutHint, String diagramType)
          Returns the most appropriate layout provider for the given layout hint and diagram type.
 List<LayoutOptionData<?>> getOptionData()
          Returns a list of available layout option descriptors.
<T> T
getProperty(IProperty<T> property)
          Retrieve the default value for a layout option.
 void initialize(LayoutOptionData.Target targetType, String layoutHint, String diagramType)
          Initialize the configuration with a layout hint and diagram type for the content or the container of the selected element.
 boolean isDefault(LayoutOptionData<?> optionData)
          Since this configuration handles only default values, this always returns true.
 void setDiagramDefault(LayoutOptionData<?> optionData, Object value)
          Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.
 void setFocus(Object element)
          Initialize the configuration with a layout hint.
 void setProperty(IProperty<?> property, Object value)
          Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLayoutConfig

public DefaultLayoutConfig()
Method Detail

setFocus

public void setFocus(Object element)
Initialize the configuration with a layout hint. This is only done if the given object is a string.

Specified by:
setFocus in interface ILayoutConfig
Parameters:
element - a layout hint of type String

initialize

public final void initialize(LayoutOptionData.Target targetType,
                             String layoutHint,
                             String diagramType)
Initialize the configuration with a layout hint and diagram type for the content or the container of the selected element.

Parameters:
targetType - type of the selected element (parent, node, edge, port, etc.)
layoutHint - a layout hint, or null
diagramType - a diagram type, or null

getOptionData

public 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 layout options that are available for the selected element to their default values.

Specified by:
getAllProperties in interface IPropertyHolder
Returns:
a map of all layout options to their default values

getProperty

public <T> T getProperty(IProperty<T> property)
Retrieve the default value for a layout option. This implementation requires initialize to be called first in order to work properly.

Specified by:
getProperty in interface IPropertyHolder
Type Parameters:
T - type of option
Parameters:
property - a layout option
Returns:
the default value for the layout option

isDefault

public boolean isDefault(LayoutOptionData<?> optionData)
Since this configuration handles only default values, this always returns true.

Specified by:
isDefault in interface ILayoutConfig
Parameters:
optionData - layout option data
Returns:
true

getContentLayouterData

public LayoutProviderData getContentLayouterData()
Returns the layout provider descriptor for the content of the associated element.

Specified by:
getContentLayouterData in interface ILayoutConfig
Returns:
the layout provider data for the element's content

getContainerLayouterData

public LayoutProviderData getContainerLayouterData()
Returns the layout provider descriptor for the container of the associated element.

Specified by:
getContainerLayouterData in interface ILayoutConfig
Returns:
the layout provider data for the element's container

getLayouterData

public LayoutProviderData getLayouterData(String theLayoutHint,
                                          String diagramType)
Returns the most appropriate layout provider for the given layout hint and diagram type.

Specified by:
getLayouterData in interface ILayoutConfig
Parameters:
theLayoutHint - identifier of either a layout provider or a layout type
diagramType - identifier of a diagram type
Returns:
the most appropriate layout provider, or null

setProperty

public void setProperty(IProperty<?> property,
                        Object value)
Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.

Specified by:
setProperty in interface IPropertyHolder
Parameters:
property - a layout option
value - an option value

copyProperties

public void copyProperties(IPropertyHolder holder)
Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.

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

clearProperties

public void clearProperties()
Throws an UnsupportedOperationException, since this configuration cannot be used to change default values.

Specified by:
clearProperties in interface ILayoutConfig

setDiagramDefault

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

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