de.cau.cs.kieler.kiml.ui.util
Class KimlUiUtil

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.util.KimlUiUtil

public final class KimlUiUtil
extends Object

Utility methods used for the KIML UI.

Rating proposed yellow
(2009-12-11) msp

Method Summary
static Insets calcInsets(IFigure parent, IFigure child)
          Determines the insets for a parent figure, relative to the given child.
static Rectangle getAbsoluteBounds(IFigure figure)
          Calculates the absolute bounds of the given figure.
static Point getAbsolutePoint(Connection connection, int index)
          Calculates an absolute position for one of the bend points of the given connection.
static Object getOption(EditPart editPart, String optionId)
          Retrieves a layout option from the given edit part by using the layout inspector associated with the edit part type.
static Object getOption(ILayoutInspector inspector, String optionId)
          Retrieves a layout option from the given layout inspector by querying the option for the edit part's class name and its domain model name.
static LayoutOptionData getOptionData(LayoutProviderData[] providerDataArray, String displayName)
          Retrieves a suitable layout option data instance that matches the given user friendly display name.
static boolean isNoLayout(EditPart editPart)
          Determines whether the given edit part should not be layouted.
static void runModelChange(Runnable runnable, TransactionalEditingDomain editingDomain, String label)
          Performs the model changes specified in the given runnable in a safe context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calcInsets

public static Insets calcInsets(IFigure parent,
                                IFigure child)
Determines the insets for a parent figure, relative to the given child.

Parameters:
parent - the figure of a parent edit part
child - the figure of a child edit part
Returns:
the insets to add to the relative coordinates of the child

getAbsoluteBounds

public static Rectangle getAbsoluteBounds(IFigure figure)
Calculates the absolute bounds of the given figure.

Parameters:
figure - a figure
Returns:
the absolute bounds

getAbsolutePoint

public static Point getAbsolutePoint(Connection connection,
                                     int index)
Calculates an absolute position for one of the bend points of the given connection.

Parameters:
connection - a connection figure
index - the index in the point list
Returns:
the absolute point

runModelChange

public static void runModelChange(Runnable runnable,
                                  TransactionalEditingDomain editingDomain,
                                  String label)
Performs the model changes specified in the given runnable in a safe context.

Parameters:
runnable - a runnable that performs model changes
editingDomain - the editing domain for the changes
label - a user friendly label shown for the undo action

getOption

public static Object getOption(EditPart editPart,
                               String optionId)
Retrieves a layout option from the given edit part by using the layout inspector associated with the edit part type.

Parameters:
editPart - an edit part
optionId - layout option identifier
Returns:
the current value for the given option, or null

getOption

public static Object getOption(ILayoutInspector inspector,
                               String optionId)
Retrieves a layout option from the given layout inspector by querying the option for the edit part's class name and its domain model name.

Parameters:
inspector - a layout inspector for an edit part
optionId - layout option identifier
Returns:
the current value for the given option, or null

isNoLayout

public static boolean isNoLayout(EditPart editPart)
Determines whether the given edit part should not be layouted.

Parameters:
editPart - an edit part
Returns:
true if no layout should be performed for the edit part

getOptionData

public static LayoutOptionData getOptionData(LayoutProviderData[] providerDataArray,
                                             String displayName)
Retrieves a suitable layout option data instance that matches the given user friendly display name.

Parameters:
providerDataArray - array of applicable layout provider data
displayName - display name of the layout option as seen by the user
Returns:
the most suitable layout option data