de.cau.cs.kieler.kiml.gmf
Class GmfLayoutInspector

java.lang.Object
  extended by de.cau.cs.kieler.kiml.gmf.GmfLayoutInspector
All Implemented Interfaces:
ILayoutInspector

public class GmfLayoutInspector
extends Object
implements ILayoutInspector

Rating red

Constructor Summary
GmfLayoutInspector(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart)
          Creates a layout inspector for a GMF graphical edit part.
 
Method Summary
 LayoutProviderData getContainerLayouterData()
          Returns the layout provider descriptor for the container of the associated edit part.
 EditPart getContainerPart()
          Returns the edit part that contains the associated edit part.
 Object getDefault(LayoutOptionData optionData)
          Returns the default value for the associated diagram.
static org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart getDiagramEditPart(EditPart editPart)
          Finds the diagram edit part of an edit part.
 IFigure getDrawingLayer()
          Returns a layer figure for the associated diagram that can be used to draw additional information.
 TransactionalEditingDomain getEditingDomain()
          Returns a transactional editing domain in which to perform model changes.
 LayoutProviderData getFocusLayouterData()
          Returns the layout provider descriptor for the associated edit part.
 EObject getFocusModel()
          Returns the domain model element that is associated with this inspector.
 EditPart getFocusPart()
          Returns the edit part that is associated with this layout inspector.
 KOption getKOption(LayoutOptionData optionData, boolean create)
          Returns the currently stored KOption value for the given layout option.
 List<LayoutOptionData> getOptionData()
          Returns a list of layout option descriptors that are available for the associated edit part.
 boolean hasChildren()
          Returns true if the associated edit part has children that can be layouted.
 void initOptions()
          Initialize available layout options for the associated edit part.
 void removeAllKOptions()
          Removes all stored layout options from the associated edit part and its children.
 void removeKOption(LayoutOptionData optionData)
          Removes any stored value for the given layout option.
 void setDefault(LayoutOptionData optionData, Object value)
          Sets the given option as default value for all elements of the associated diagram.
static void setLayoutOptions(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart, KLayoutData layoutData, boolean setUserOptions)
          Sets all predefined and user defined layout options for the given edit part.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GmfLayoutInspector

public GmfLayoutInspector(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart)
Creates a layout inspector for a GMF graphical edit part.

Parameters:
editPart - a graphical edit part
Method Detail

getDiagramEditPart

public static org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart getDiagramEditPart(EditPart editPart)
Finds the diagram edit part of an edit part.

Parameters:
editPart - an edit part
Returns:
the diagram edit part, or null if there is no containing diagram edit part

setLayoutOptions

public static void setLayoutOptions(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart,
                                    KLayoutData layoutData,
                                    boolean setUserOptions)
Sets all predefined and user defined layout options for the given edit part.

Parameters:
editPart - edit part for which options are set
layoutData - layout data where options are written
setUserOptions - if true, the user defined options are also set

initOptions

public void initOptions()
Initialize available layout options for the associated edit part. Some methods require this to be called before they are used.

Specified by:
initOptions in interface ILayoutInspector

getOptionData

public List<LayoutOptionData> getOptionData()
Returns a list of layout option descriptors that are available for the associated edit part. ILayoutInspector.initOptions() must be called before this method is used.

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

getKOption

public KOption getKOption(LayoutOptionData optionData,
                          boolean create)
Returns the currently stored KOption value for the given layout option. ILayoutInspector.initOptions() must be called before this method is used.

Specified by:
getKOption in interface ILayoutInspector
Parameters:
optionData - layout option data
create - if true and the KOption is not available, a new instance is created and returned
Returns:
the current value, or null if there is no such value and create is false

removeKOption

public void removeKOption(LayoutOptionData optionData)
Removes any stored value for the given layout option. ILayoutInspector.initOptions() must be called before this method is used.

Specified by:
removeKOption in interface ILayoutInspector
Parameters:
optionData - layout option data

removeAllKOptions

public void removeAllKOptions()
Removes all stored layout options from the associated edit part and its children.

Specified by:
removeAllKOptions in interface ILayoutInspector

getFocusPart

public EditPart getFocusPart()
Returns the edit part that is associated with this layout inspector.

Specified by:
getFocusPart in interface ILayoutInspector
Returns:
the associated edit part

getFocusModel

public EObject getFocusModel()
Returns the domain model element that is associated with this inspector.

Specified by:
getFocusModel in interface ILayoutInspector
Returns:
the associated domain model element

getFocusLayouterData

public LayoutProviderData getFocusLayouterData()
Returns the layout provider descriptor for the associated edit part. ILayoutInspector.initOptions() must be called before this method is used.

Specified by:
getFocusLayouterData in interface ILayoutInspector
Returns:
the associated layout provider data

getContainerPart

public EditPart getContainerPart()
Returns the edit part that contains the associated edit part. ILayoutInspector.initOptions() must be called before this method is used.

Specified by:
getContainerPart in interface ILayoutInspector
Returns:
the container edit part

getContainerLayouterData

public LayoutProviderData getContainerLayouterData()
Returns the layout provider descriptor for the container of the associated edit part. ILayoutInspector.initOptions() must be called before this method is used.

Specified by:
getContainerLayouterData in interface ILayoutInspector
Returns:
the layout provider data for the container edit part

hasChildren

public boolean hasChildren()
Returns true if the associated edit part has children that can be layouted.

Specified by:
hasChildren in interface ILayoutInspector
Returns:
whether the edit part has children

getEditingDomain

public TransactionalEditingDomain getEditingDomain()
Returns a transactional editing domain in which to perform model changes.

Specified by:
getEditingDomain in interface ILayoutInspector
Returns:
an editing domain for model changes

setDefault

public void setDefault(LayoutOptionData optionData,
                       Object value)
Sets the given option as default value for all elements of the associated diagram.

Specified by:
setDefault in interface ILayoutInspector
Parameters:
optionData - layout option data
value - new default value

getDefault

public Object getDefault(LayoutOptionData optionData)
Returns the default value for the associated diagram.

Specified by:
getDefault in interface ILayoutInspector
Parameters:
optionData - layout option data
Returns:
default value of the layout option, or null if no default value is set for the diagram

getDrawingLayer

public IFigure getDrawingLayer()
Returns a layer figure for the associated diagram that can be used to draw additional information.

Specified by:
getDrawingLayer in interface ILayoutInspector
Returns:
a drawing layer