de.cau.cs.kieler.kiml.ui.layout
Class CachedLayout

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.layout.CachedLayout

public class CachedLayout
extends Object

A cache for results of automatic layout. Can be used to repeatedly apply the same layout to a diagram.

Rating proposed yellow
(2010-01-26) msp

Constructor Summary
CachedLayout(int initialCapacity)
          Creates a cached layout with given initial capacity.
 
Method Summary
 void addLayout(EObject modelObject, KGraphElement graphElement)
          Adds the given model object with associated layout to the cache.
 void addLayout(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart, KGraphElement graphElement)
          Adds the given edit part with associated layout to the cache.
 void applyLayout(IEditorPart editorPart, boolean animate, boolean progressBar)
          Applies the cached layout to the given editor part.
 IStatus applyLayout(IEditorPart editorPart, IKielerProgressMonitor progressMonitor)
          Applies the cached layout to the given editor part with a specified progress monitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedLayout

public CachedLayout(int initialCapacity)
Creates a cached layout with given initial capacity.

Parameters:
initialCapacity - the initial capacity of the cache
Method Detail

addLayout

public void addLayout(EObject modelObject,
                      KGraphElement graphElement)
Adds the given model object with associated layout to the cache.

Parameters:
modelObject - a model object
graphElement - the associated layout graph element

addLayout

public void addLayout(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart,
                      KGraphElement graphElement)
Adds the given edit part with associated layout to the cache.

Parameters:
editPart - an edit part
graphElement - the associated layout graph element

applyLayout

public void applyLayout(IEditorPart editorPart,
                        boolean animate,
                        boolean progressBar)
Applies the cached layout to the given editor part.

Parameters:
editorPart - a diagram editor part
animate - if true, Draw2D animation is activated
progressBar - if true, a progress bar is displayed

applyLayout

public IStatus applyLayout(IEditorPart editorPart,
                           IKielerProgressMonitor progressMonitor)
Applies the cached layout to the given editor part with a specified progress monitor.

Parameters:
editorPart - a diagram editor part
progressMonitor - a progress monitor
Returns:
a status indicating success or failure