|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.kiml.ui.layout.DiagramLayoutManager
de.cau.cs.kieler.kiml.gmf.GmfDiagramLayoutManager
public class GmfDiagramLayoutManager
Diagram layout manager that is able to generically layout diagrams generated by GMF. The internal
KGraph graph structure is built from the structure of edit parts in the diagram. The new layout
is applied to the diagram using GmfLayoutEditPolicy
, which creates a
GmfLayoutCommand
to directly manipulate data in the GMF notation model, where layout
information is stored persistently.
Field Summary |
---|
Fields inherited from class de.cau.cs.kieler.kiml.ui.layout.DiagramLayoutManager |
---|
MAX_PROGRESS_LEVELS |
Constructor Summary | |
---|---|
GmfDiagramLayoutManager()
|
Method Summary | |
---|---|
void |
addChangeListener(IEditorPart editorPart,
IEditorChangeListener listener)
Register a listener for change of the active editor or active selection. |
protected void |
applyLayout()
Applies the transferred layout to the original diagram. |
KNode |
buildLayoutGraph(IEditorPart editorPart,
EditPart editPart,
boolean layoutAncestors)
Builds a KGraph instance for the given editor or edit part. |
protected KNode |
cleanupAncestryPath(KNode topNode)
Cleans the path from the ancestry target node to the top level node, including all parallel paths. |
protected KNode |
doBuildLayoutGraph(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart rootPart)
Builds the layout graph for the given root edit part. |
protected ICachedLayout |
getCachedLayout()
Returns the cached layout for the last layout run. |
EditPart |
getCurrentEditPart()
Returns the currently processed top level edit part. |
protected org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart |
getDiagramEditPart()
Returns the diagram edit part. |
EditPart |
getEditPart(KNode knode)
Returns the edit part associated with the given layout node. |
protected Map<org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart,KGraphElement> |
getEditPart2GraphElemMap()
Returns the map of graphical edit parts to corresponding layout graph elements. |
protected Map<KGraphElement,org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart> |
getGraphElem2EditPartMap()
Returns the map of layout graph elements to corresponding edit parts. |
ILayoutInspector |
getInspector(EditPart editPart)
Returns a layout inspector for the given edit part. |
ILayoutInspector |
getInspector(IEditorPart editorPart)
Returns a layout inspector for the given editor part. |
protected Command |
getLayoutCommand()
Returns the command that is calculated by transferLayout(boolean) to apply the
layout. |
ILayoutConfig |
getLayoutConfig(EditPart editPart)
Returns a layout configuration for the given edit part. |
KNode |
getLayoutGraph()
Returns the last built layout graph. |
KNode |
getLayoutNode(EditPart editPart)
Returns the layout node associated with the given edit part. |
ISelection |
getSelection(IEditorPart editorPart)
Returns the current selection for the given editor part. |
protected void |
processLabels(org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection,
KEdge edge,
EdgeLabelPlacement placement,
float offsetx,
float offsety)
Process the labels of an edge. |
void |
removeChangeListener(IEditorChangeListener listener)
Remove a change listener from all editors for which it has registered. |
protected void |
setEdgeLayout(KEdgeLayout edgeLayout,
org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection,
float offsetx,
float offsety)
Stores the layout information of the given connection edit part into an edge layout. |
protected void |
setLayoutCommand(Command thelayoutCommand)
Sets the given command as new layout command. |
protected boolean |
supports(EditPart editPart)
Determines whether this layout manager is able to perform layout for the given edit part. |
protected boolean |
supports(IEditorPart editorPart)
Determines whether this layout manager is able to perform layout for the given editor. |
protected void |
transferLayout(boolean cacheLayout)
Transfers all layout data from the last created KGraph instance to the original diagram. |
Methods inherited from class de.cau.cs.kieler.kiml.ui.layout.DiagramLayoutManager |
---|
applyAndZoom, applyAnimatedLayout, calcAnimationTime, getExternalConfig, getPriority, layout, layout, layout, setLayoutConfig, setPriority |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GmfDiagramLayoutManager()
Method Detail |
---|
protected Map<KGraphElement,org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart> getGraphElem2EditPartMap()
protected Map<org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart,KGraphElement> getEditPart2GraphElemMap()
protected org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart getDiagramEditPart()
protected Command getLayoutCommand()
transferLayout(boolean)
to apply the
layout.
protected void setLayoutCommand(Command thelayoutCommand)
thelayoutCommand
- the apply layout commandprotected boolean supports(IEditorPart editorPart)
supports
in class DiagramLayoutManager
editorPart
- an editor part
protected boolean supports(EditPart editPart)
supports
in class DiagramLayoutManager
editPart
- an edit part
public void addChangeListener(IEditorPart editorPart, IEditorChangeListener listener)
addChangeListener
in class DiagramLayoutManager
editorPart
- editor to register tolistener
- listener to registerpublic void removeChangeListener(IEditorChangeListener listener)
removeChangeListener
in class DiagramLayoutManager
listener
- listener to removepublic ISelection getSelection(IEditorPart editorPart)
getSelection
in class DiagramLayoutManager
editorPart
- an editor part
null
if the selection cannot
be determinedpublic ILayoutInspector getInspector(EditPart editPart)
getInspector
in class DiagramLayoutManager
editPart
- an edit part
null
if the edit part
is not supportedpublic ILayoutInspector getInspector(IEditorPart editorPart)
getInspector
in class DiagramLayoutManager
editorPart
- an editor part
null
if the editor part
is not supportedpublic ILayoutConfig getLayoutConfig(EditPart editPart)
editPart
is
null
, a generic layout configuration is created.
getLayoutConfig
in class DiagramLayoutManager
editPart
- an edit part
public KNode buildLayoutGraph(IEditorPart editorPart, EditPart editPart, boolean layoutAncestors)
buildLayoutGraph
in class DiagramLayoutManager
editorPart
- the editor for which layout is performed, or null
if
the diagram is not part of an editoreditPart
- the parent edit part for which layout is performed, or null
if the whole diagram shall be layoutedlayoutAncestors
- if true, layout is not only performed for the selected edit
part, but also for its ancestors
protected void transferLayout(boolean cacheLayout)
transferLayout
in class DiagramLayoutManager
cacheLayout
- if true, the layout result is cached for the underlying modelprotected void applyLayout()
applyLayout
in class DiagramLayoutManager
public KNode getLayoutGraph()
getLayoutGraph
in class DiagramLayoutManager
protected ICachedLayout getCachedLayout()
getCachedLayout
in class DiagramLayoutManager
public EditPart getCurrentEditPart()
DiagramLayoutManager.buildLayoutGraph(IEditorPart, EditPart, boolean)
was called.
getCurrentEditPart
in class DiagramLayoutManager
public EditPart getEditPart(KNode knode)
DiagramLayoutManager.buildLayoutGraph(IEditorPart, EditPart, boolean)
was called.
getEditPart
in class DiagramLayoutManager
knode
- a node from the layout graph
null
public KNode getLayoutNode(EditPart editPart)
DiagramLayoutManager.buildLayoutGraph(IEditorPart, EditPart, boolean)
was called.
getLayoutNode
in class DiagramLayoutManager
editPart
- an edit part of the currently layouted diagram
null
protected KNode doBuildLayoutGraph(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart rootPart)
rootPart
- the root edit part for layout
protected void setEdgeLayout(KEdgeLayout edgeLayout, org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection, float offsetx, float offsety)
edgeLayout
- an edge layoutconnection
- a connection edit partoffsetx
- horizontal offset to be subtracted from coordinatesoffsety
- vertical offset to be subtracted from coordinatesprotected void processLabels(org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection, KEdge edge, EdgeLabelPlacement placement, float offsetx, float offsety)
connection
- the connection edit partedge
- the layout edgeplacement
- predefined placement for all labels, or UNDEFINED
if the placement
shall be derived from the edit partoffsetx
- the offset for horizontal coordinatesoffsety
- the offset for vertical coordinatesprotected KNode cleanupAncestryPath(KNode topNode)
topNode
- the top level node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |