Class LocatableNodeDragInteractor

  • All Implemented Interfaces:
    LayerListener, LayerMotionListener, Interactor, java.util.EventListener

    public class LocatableNodeDragInteractor
    extends NodeDragInteractor
    An interaction role that drags nodes that have locatable objects as semantic objects. When the node is dragged, this interactor updates the location in the locatable object with the new location of the figure.

    The dragging of a selection is undoable, and is based on the difference between the point where the mouse was pressed and where the mouse was released. This information is used to create MoML to undo the move if requested.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Steve Neuendorffer
    Pt.AcceptedRating:
    Red (johnr)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Detail

      • LocatableNodeDragInteractor

        public LocatableNodeDragInteractor​(LocatableNodeController controller)
        Create a new interactor contained within the given controller.
        Parameters:
        controller - The controller.
    • Method Detail

      • mousePressed

        public void mousePressed​(LayerEvent e)
        When the mouse is pressed before dragging, store a copy of the pressed point location so that a relative move can be evaluated for undo purposes.
        Specified by:
        mousePressed in interface LayerListener
        Overrides:
        mousePressed in class DragInteractor
        Parameters:
        e - The press event.
      • mouseReleased

        public void mouseReleased​(LayerEvent e)
        When the mouse is released after dragging, mark the frame modified and update the panner, and generate an undo entry for the move. If no movement has occurred, then do nothing.
        Specified by:
        mouseReleased in interface LayerListener
        Overrides:
        mouseReleased in class DragInteractor
        Parameters:
        e - The release event.
      • setSnapResolution

        public void setSnapResolution​(double resolution)
        Specify the snap resolution. The default snap resolution is 5.0.
        Parameters:
        resolution - The snap resolution.
      • translate

        public void translate​(LayerEvent e,
                              double x,
                              double y)
        Drag all selected nodes and move any attached edges. Update the locatable nodes with the current location.
        Overrides:
        translate in class NodeDragInteractor
        Parameters:
        e - The event triggering this translation.
        x - The horizontal delta.
        y - The vertical delta.