Class UndoLayoutAction

  • All Implemented Interfaces:
    UndoAction

    public class UndoLayoutAction
    extends java.lang.Object
    implements UndoAction
    An undo action that is able to revert the changes made by automatic layout, or to repeat them in the case of redo.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Miro Spoenemann (msp)
    Pt.AcceptedRating:
    Red (msp)
    Pt.ProposedRating:
    Red (msp)
    • Constructor Summary

      Constructors 
      Constructor Description
      UndoLayoutAction​(NamedObj source)
      Create an undo action for automatic layout.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addConnection​(NamedObj container, LayoutHint layoutHint)
      Add a connection.
      void addCurve​(ptolemy.vergil.basic.layout.kieler.ApplyLayoutRequest.CurveEntry entry)
      Add a curve to the undo action.
      void addLocation​(ptolemy.vergil.basic.layout.kieler.ApplyLayoutRequest.LocationEntry entry)
      Add a location to the undo action.
      void execute()
      Execute the undo or redo action.
      void removeConnection​(LayoutHint layoutHint)
      Mark the given connection routing hint for removal.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UndoLayoutAction

        public UndoLayoutAction​(NamedObj source)
        Create an undo action for automatic layout.
        Parameters:
        source - The source object, which is typically the parent composite entity.
    • Method Detail

      • addConnection

        public void addConnection​(NamedObj container,
                                  LayoutHint layoutHint)
        Add a connection.
        Parameters:
        container - The container in which to add the connection
        layoutHint - to be added.
      • addCurve

        public void addCurve​(ptolemy.vergil.basic.layout.kieler.ApplyLayoutRequest.CurveEntry entry)
        Add a curve to the undo action. The action will set the exit angle to the value stored in the given curve entry.
        Parameters:
        entry - A curve entry with stored exit value
      • addLocation

        public void addLocation​(ptolemy.vergil.basic.layout.kieler.ApplyLayoutRequest.LocationEntry entry)
        Add a location to the undo action. The action will set the location to the coordinates stored in the given location entry.
        Parameters:
        entry - A location entry with all required data
      • execute

        public void execute()
                     throws java.lang.Exception
        Execute the undo or redo action. This sets all previously configured locations, removes connection routing hints that are marked for removal, and adds connection routing hints that are marked for adding.
        Specified by:
        execute in interface UndoAction
        Throws:
        java.lang.Exception - If something goes wrong.
      • removeConnection

        public void removeConnection​(LayoutHint layoutHint)
        Mark the given connection routing hint for removal. The action will remove the layout hint from its containing relation.
        Parameters:
        layoutHint - A connection routing hint contained in a relation