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

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.AbstractEffect
      extended by de.cau.cs.kieler.kiml.ui.layout.LayoutEffect
All Implemented Interfaces:
IEffect

public class LayoutEffect
extends AbstractEffect

Performs automatic layout on a diagram editor for a given selection.

Rating red

Constructor Summary
LayoutEffect(IEditorPart editor, EObject object)
          Create a new layout effect for the given diagram editor and EObject.
LayoutEffect(IEditorPart editor, EObject object, boolean zoomToFit)
          Create a new layout effect for the given diagram editor and EObject.
LayoutEffect(IEditorPart editor, EObject object, boolean zoomToFit, boolean progressBar)
          Create a new layout effect for the given diagram editor and EObject.
LayoutEffect(IEditorPart editor, EObject object, boolean zoomToFit, boolean progressBar, boolean ancestors)
          Create a new layout effect for the given diagram editor and EObject.
LayoutEffect(IEditorPart editor, EObject object, boolean zoomToFit, boolean progressBar, boolean ancestors, boolean animation)
          Create a new layout effect for the given diagram editor and EObject.
 
Method Summary
 void execute()
          Execute the effect.
 DiagramLayoutManager getManager()
          Returns the diagram layout manager that was used for this layout effect, or null if the effect has not been executed yet.
 boolean isMergeable()
          Determines whether this effect can be merged with previously scheduled effects.
 IEffect merge(IEffect otherEffect)
          Merge this effect with another effect.
 void setOption(EObject object, IProperty<?> option, Object value)
          Set a layout option value for this layout effect.
 
Methods inherited from class de.cau.cs.kieler.core.kivi.AbstractEffect
schedule, scheduleUndo, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutEffect

public LayoutEffect(IEditorPart editor,
                    EObject object)
Create a new layout effect for the given diagram editor and EObject.

Parameters:
editor - the diagram editor containing the diagram to layout
object - the domain model object to layout

LayoutEffect

public LayoutEffect(IEditorPart editor,
                    EObject object,
                    boolean zoomToFit)
Create a new layout effect for the given diagram editor and EObject.

Parameters:
editor - the diagram editor containing the diagram to layout
object - the domain model object to layout
zoomToFit - whether zoom to fit shall be performed

LayoutEffect

public LayoutEffect(IEditorPart editor,
                    EObject object,
                    boolean zoomToFit,
                    boolean progressBar)
Create a new layout effect for the given diagram editor and EObject.

Parameters:
editor - the diagram editor containing the diagram to layout
object - the domain model object to layout
zoomToFit - whether zoom to fit shall be performed
progressBar - whether a progress bar shall be displayed

LayoutEffect

public LayoutEffect(IEditorPart editor,
                    EObject object,
                    boolean zoomToFit,
                    boolean progressBar,
                    boolean ancestors)
Create a new layout effect for the given diagram editor and EObject.

Parameters:
editor - the diagram editor containing the diagram to layout
object - the domain model object to layout
zoomToFit - whether zoom to fit shall be performed
progressBar - whether a progress bar shall be displayed
ancestors - whether to include the ancestors in the layout process

LayoutEffect

public LayoutEffect(IEditorPart editor,
                    EObject object,
                    boolean zoomToFit,
                    boolean progressBar,
                    boolean ancestors,
                    boolean animation)
Create a new layout effect for the given diagram editor and EObject.

Parameters:
editor - the diagram editor containing the diagram to layout
object - the domain model element to layout
zoomToFit - whether zoom to fit shall be performed
progressBar - whether a progress bar shall be displayed
ancestors - whether to include the ancestors in the layout process
animation - whether the layout shall be animated
Method Detail

setOption

public void setOption(EObject object,
                      IProperty<?> option,
                      Object value)
Set a layout option value for this layout effect. The value is only applied for this layout run and is thrown away afterwards.

Parameters:
object - the domain model element for which the option shall be set
option - the layout option to set (see LayoutOptions)
value - the value for the layout option

execute

public void execute()
Execute the effect.


getManager

public DiagramLayoutManager getManager()
Returns the diagram layout manager that was used for this layout effect, or null if the effect has not been executed yet.

Returns:
the diagram layout manager

isMergeable

public boolean isMergeable()
Determines whether this effect can be merged with previously scheduled effects.

Specified by:
isMergeable in interface IEffect
Overrides:
isMergeable in class AbstractEffect
Returns:
true if it can be merged, false if no search through the effect queue is necessary

merge

public IEffect merge(IEffect otherEffect)
Merge this effect with another effect. Will return null if the effects can not be merged.

Specified by:
merge in interface IEffect
Overrides:
merge in class AbstractEffect
Parameters:
otherEffect - the effect to merge with
Returns:
the newly merged effect, or null if no merge was possible.