Class RelocateOnDragHandler

java.lang.Object
org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>>
org.eclipse.gef.mvc.fx.handlers.AbstractHandler
com.amalgamasimulation.graphicaleditor.handlers.RelocateOnDragHandler
All Implemented Interfaces:
org.eclipse.gef.common.adapt.IAdaptable.Bound<org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>>, org.eclipse.gef.mvc.fx.handlers.IHandler, org.eclipse.gef.mvc.fx.handlers.IOnDragHandler

public class RelocateOnDragHandler extends org.eclipse.gef.mvc.fx.handlers.AbstractHandler implements org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
  • Property Summary

    Properties inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl

    adaptable

    Properties inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound

    adaptable
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound

    org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<T extends org.eclipse.gef.common.adapt.IAdaptable>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Map<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,org.eclipse.gef.geometry.planar.Rectangle>
     
    protected org.eclipse.gef.mvc.fx.handlers.ConnectedSupport
     
    protected org.eclipse.gef.geometry.planar.Point
     
    protected boolean
     
    protected org.eclipse.gef.mvc.fx.handlers.SnapToSupport
     
    protected List<javafx.util.Pair<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,org.eclipse.gef.mvc.fx.policies.TransformPolicy>>
     
    protected Map<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,Integer>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected void
    addPartsToTargetParts(List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts)
     
    protected void
    appendPostTransformCommands(org.eclipse.emf.common.command.CompoundCommand cc)
    Appends additional commands to be executed after the primary transformation completes.
    void
    drag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta)
     
    void
    endDrag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta)
     
    protected ActionModel
     
    protected org.eclipse.gef.mvc.fx.handlers.ConnectedSupport
    Returns the ConnectedSupport that is used by this TranslateSelectedOnDragHandler to normalize the anchoreds of ddragged elements.
     
    protected org.eclipse.gef.geometry.planar.Point
    Returns the initial mouse location in scene coordinates.
    protected org.eclipse.gef.mvc.fx.handlers.SnapToSupport
    Returns the SnapToSupport of this policy.
    protected List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>>
    Returns a List containing all IContentParts that should be relocated by this policy.
    protected org.eclipse.gef.mvc.fx.policies.TransformPolicy
    getTransformPolicy(org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node> part)
    Returns the TransformPolicy that is installed on the given IContentPart.
    protected ViewportPolicy
     
    void
     
    protected boolean
    isPrecise(javafx.scene.input.MouseEvent e)
    Returns true if precise manipulations should be performed for the given MouseEvent.
    protected boolean
    Hook for products to restrict relocating for certain content objects (e.g.
    protected boolean
    isTranslate(javafx.scene.input.MouseEvent event, List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts)
    Returns whether the given MouseEvent should trigger translation.
    protected void
    setInitialMouseLocationInScene(org.eclipse.gef.geometry.planar.Point point)
    Sets the initial mouse location to the given value.
    boolean
    showIndicationCursor(javafx.scene.input.KeyEvent event)
     
    boolean
    showIndicationCursor(javafx.scene.input.MouseEvent event)
     
    void
    startDrag(javafx.scene.input.MouseEvent e)
     

    Methods inherited from class org.eclipse.gef.mvc.fx.handlers.AbstractHandler

    commit, execute, getHost, init, isRegistered, isRegisteredForHost, restoreRefreshVisuals, rollback, storeAndDisableRefreshVisuals

    Methods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl

    adaptableProperty, getAdaptable, setAdaptable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound

    adaptableProperty, getAdaptable, setAdaptable

    Methods inherited from interface org.eclipse.gef.mvc.fx.handlers.IHandler

    getHost
  • Field Details

    • connectedSupport

      protected org.eclipse.gef.mvc.fx.handlers.ConnectedSupport connectedSupport
    • snapToSupport

      protected org.eclipse.gef.mvc.fx.handlers.SnapToSupport snapToSupport
    • initialMouseLocationInScene

      protected org.eclipse.gef.geometry.planar.Point initialMouseLocationInScene
    • translationIndices

      protected Map<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,Integer> translationIndices
    • targets

      protected List<javafx.util.Pair<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,org.eclipse.gef.mvc.fx.policies.TransformPolicy>> targets
    • invalidGesture

      protected boolean invalidGesture
    • boundsInScene

      protected Map<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>,org.eclipse.gef.geometry.planar.Rectangle> boundsInScene
  • Constructor Details

    • RelocateOnDragHandler

      public RelocateOnDragHandler()
  • Method Details

    • abortDrag

      public void abortDrag()
      Specified by:
      abortDrag in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • drag

      public void drag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta)
      Specified by:
      drag in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • getActionModel

      protected ActionModel getActionModel()
    • getContentViewer

      protected InfiniteCanvasViewer getContentViewer()
    • isRelocateRestricted

      protected boolean isRelocateRestricted(Object content)
      Hook for products to restrict relocating for certain content objects (e.g. layer-based editability). Default: allow relocating.
    • getViewportPolicy

      protected ViewportPolicy getViewportPolicy()
    • endDrag

      public void endDrag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta)
      Specified by:
      endDrag in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • appendPostTransformCommands

      protected void appendPostTransformCommands(org.eclipse.emf.common.command.CompoundCommand cc)
      Appends additional commands to be executed after the primary transformation completes.

      This hook method allows subclasses to contribute to the transformation workflow without modifying core transformation logic. Appended commands execute sequentially following the main transformation command.

    • getConnectedSupport

      protected org.eclipse.gef.mvc.fx.handlers.ConnectedSupport getConnectedSupport()
      Returns the ConnectedSupport that is used by this TranslateSelectedOnDragHandler to normalize the anchoreds of ddragged elements.
      Returns:
      The ConnectedSupport that is used by this TranslateSelectedOnDragHandler.
    • getInitialMouseLocationInScene

      protected org.eclipse.gef.geometry.planar.Point getInitialMouseLocationInScene()
      Returns the initial mouse location in scene coordinates.
      Returns:
      The initial mouse location in scene coordinates.
    • getSnapToSupport

      protected org.eclipse.gef.mvc.fx.handlers.SnapToSupport getSnapToSupport()
      Returns the SnapToSupport of this policy.
      Returns:
      The SnapToSupport of this policy.
    • getTargetParts

      protected List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> getTargetParts()
      Returns a List containing all IContentParts that should be relocated by this policy.
      Returns:
      A List containing all IContentParts that should be relocated by this policy.
    • getTransformPolicy

      protected org.eclipse.gef.mvc.fx.policies.TransformPolicy getTransformPolicy(org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node> part)
      Returns the TransformPolicy that is installed on the given IContentPart.
      Parameters:
      part - The IContentPart for which to return the installed TransformPolicy.
      Returns:
      The TransformPolicy that is installed on the given IContentPart.
    • hideIndicationCursor

      public void hideIndicationCursor()
      Specified by:
      hideIndicationCursor in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • isPrecise

      protected boolean isPrecise(javafx.scene.input.MouseEvent e)
      Returns true if precise manipulations should be performed for the given MouseEvent. Otherwise returns false.
      Parameters:
      e - The MouseEvent that is used to determine if precise manipulations should be performed (i.e. if the corresponding modifier key is pressed).
      Returns:
      true if precise manipulations should be performed, false otherwise.
    • isTranslate

      protected boolean isTranslate(javafx.scene.input.MouseEvent event, List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts)
      Returns whether the given MouseEvent should trigger translation. Per default, will return true if we have more than one target part or the single target part does not have a connection with an orthogonal router.
      Parameters:
      event - The MouseEvent in question.
      targetParts - The list of (provisional) target IContentParts.
      Returns:
      true if the given MouseEvent should trigger translation, otherwise false.
    • setInitialMouseLocationInScene

      protected void setInitialMouseLocationInScene(org.eclipse.gef.geometry.planar.Point point)
      Sets the initial mouse location to the given value.
      Parameters:
      point - The initial mouse location.
    • showIndicationCursor

      public boolean showIndicationCursor(javafx.scene.input.KeyEvent event)
      Specified by:
      showIndicationCursor in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • showIndicationCursor

      public boolean showIndicationCursor(javafx.scene.input.MouseEvent event)
      Specified by:
      showIndicationCursor in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • startDrag

      public void startDrag(javafx.scene.input.MouseEvent e)
      Specified by:
      startDrag in interface org.eclipse.gef.mvc.fx.handlers.IOnDragHandler
    • addPartsToTargetParts

      protected void addPartsToTargetParts(List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts)