de.cau.cs.kieler.kiml.ui.service
Class EclipseLayoutConfig

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.service.EclipseLayoutConfig
All Implemented Interfaces:
ILayoutConfig

public class EclipseLayoutConfig
extends Object
implements ILayoutConfig

A layout configuration for extension point configurations and user preferences.

Rating proposed yellow
(2011-01-13) msp

Field Summary
static IProperty<Float> ASPECT_RATIO
          the aspect ratio of the currently processed diagram viewer.
static int PRIORITY
          the priority for the Eclipse layout configuration.
static IProperty<IWorkbenchPart> WORKBENCH_PART
          the currently tracked diagram editor.
 
Constructor Summary
EclipseLayoutConfig()
           
 
Method Summary
 void enrich(LayoutContext context)
          Enrich the given context with additional information that can be derived from what is already contained.
static Object getOption(Object diagramPart, EObject modelElement, IProperty<?> property)
          Retrieves a layout option for the given edit part and model element by querying the option for the edit part's class name and its domain model name.
static Object getOption(Object diagramPart, IProperty<?> optionData)
          Retrieves a layout option from the given edit part by using the framework bridge associated with the edit part type.
 int getPriority()
          Return the priority of this layout configuration, which is relevant when multiple configurations are applied.
 Object getValue(LayoutOptionData<?> optionData, LayoutContext context)
          Get the current 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 priority for the Eclipse layout configuration.

See Also:
Constant Field Values

WORKBENCH_PART

public static final IProperty<IWorkbenchPart> WORKBENCH_PART
the currently tracked diagram editor.


ASPECT_RATIO

public static final IProperty<Float> ASPECT_RATIO
the aspect ratio of the currently processed diagram viewer.

Constructor Detail

EclipseLayoutConfig

public EclipseLayoutConfig()
Method Detail

getOption

public static Object getOption(Object diagramPart,
                               IProperty<?> optionData)
Retrieves a layout option from the given edit part by using the framework bridge associated with the edit part type.

Parameters:
diagramPart - a diagram part such as an edit part
optionData - layout option data
Returns:
the current value for the given option, or null

getOption

public static Object getOption(Object diagramPart,
                               EObject modelElement,
                               IProperty<?> property)
Retrieves a layout option for the given edit part and model element by querying the option for the edit part's class name and its domain model name.

Parameters:
diagramPart - a diagram part such as an edit part
modelElement - the corresponding model element
property - layout option data
Returns:
the current value for the given option, or null

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

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 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 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