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
adaptableProperties 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
FieldsModifier and TypeFieldDescriptionprotected 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.ConnectedSupportprotected org.eclipse.gef.geometry.planar.Pointprotected booleanprotected org.eclipse.gef.mvc.fx.handlers.SnapToSupportprotected List<javafx.util.Pair<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>, org.eclipse.gef.mvc.fx.policies.TransformPolicy>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddPartsToTargetParts(List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts) protected voidappendPostTransformCommands(org.eclipse.emf.common.command.CompoundCommand cc) Appends additional commands to be executed after the primary transformation completes.voiddrag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta) voidendDrag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta) protected ActionModelprotected org.eclipse.gef.mvc.fx.handlers.ConnectedSupportReturns theConnectedSupportthat is used by thisTranslateSelectedOnDragHandlerto normalize the anchoreds of ddragged elements.protected InfiniteCanvasViewerprotected org.eclipse.gef.geometry.planar.PointReturns the initial mouse location in scene coordinates.protected org.eclipse.gef.mvc.fx.handlers.SnapToSupportReturns theSnapToSupportof this policy.protected List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> Returns aListcontaining allIContentParts that should be relocated by this policy.protected org.eclipse.gef.mvc.fx.policies.TransformPolicygetTransformPolicy(org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node> part) Returns theTransformPolicythat is installed on the givenIContentPart.protected ViewportPolicyvoidprotected booleanisPrecise(javafx.scene.input.MouseEvent e) Returnstrueif precise manipulations should be performed for the givenMouseEvent.protected booleanisRelocateRestricted(Object content) Hook for products to restrict relocating for certain content objects (e.g.protected booleanisTranslate(javafx.scene.input.MouseEvent event, List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts) Returns whether the givenMouseEventshould trigger translation.protected voidsetInitialMouseLocationInScene(org.eclipse.gef.geometry.planar.Point point) Sets the initial mouse location to the given value.booleanshowIndicationCursor(javafx.scene.input.KeyEvent event) booleanshowIndicationCursor(javafx.scene.input.MouseEvent event) voidstartDrag(javafx.scene.input.MouseEvent e) Methods inherited from class org.eclipse.gef.mvc.fx.handlers.AbstractHandler
commit, execute, getHost, init, isRegistered, isRegisteredForHost, restoreRefreshVisuals, rollback, storeAndDisableRefreshVisualsMethods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl
adaptableProperty, getAdaptable, setAdaptableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
adaptableProperty, getAdaptable, setAdaptableMethods 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
-
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:
abortDragin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
drag
public void drag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta) - Specified by:
dragin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
getActionModel
-
getContentViewer
-
isRelocateRestricted
Hook for products to restrict relocating for certain content objects (e.g. layer-based editability). Default: allow relocating. -
getViewportPolicy
-
endDrag
public void endDrag(javafx.scene.input.MouseEvent e, org.eclipse.gef.geometry.planar.Dimension delta) - Specified by:
endDragin interfaceorg.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 theConnectedSupportthat is used by thisTranslateSelectedOnDragHandlerto normalize the anchoreds of ddragged elements.- Returns:
- The
ConnectedSupportthat is used by thisTranslateSelectedOnDragHandler.
-
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 theSnapToSupportof this policy.- Returns:
- The
SnapToSupportof this policy.
-
getTargetParts
protected List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> getTargetParts()Returns aListcontaining allIContentParts that should be relocated by this policy.- Returns:
- A
Listcontaining allIContentParts 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 theTransformPolicythat is installed on the givenIContentPart.- Parameters:
part- TheIContentPartfor which to return the installedTransformPolicy.- Returns:
- The
TransformPolicythat is installed on the givenIContentPart.
-
hideIndicationCursor
public void hideIndicationCursor()- Specified by:
hideIndicationCursorin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
isPrecise
protected boolean isPrecise(javafx.scene.input.MouseEvent e) Returnstrueif precise manipulations should be performed for the givenMouseEvent. Otherwise returnsfalse.- Parameters:
e- TheMouseEventthat is used to determine if precise manipulations should be performed (i.e. if the corresponding modifier key is pressed).- Returns:
trueif precise manipulations should be performed,falseotherwise.
-
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 givenMouseEventshould trigger translation. Per default, will returntrueif we have more than one target part or the single target part does not have a connection with an orthogonal router.- Parameters:
event- TheMouseEventin question.targetParts- The list of (provisional) targetIContentParts.- Returns:
trueif the givenMouseEventshould trigger translation, otherwisefalse.
-
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:
showIndicationCursorin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
showIndicationCursor
public boolean showIndicationCursor(javafx.scene.input.MouseEvent event) - Specified by:
showIndicationCursorin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
startDrag
public void startDrag(javafx.scene.input.MouseEvent e) - Specified by:
startDragin interfaceorg.eclipse.gef.mvc.fx.handlers.IOnDragHandler
-
addPartsToTargetParts
protected void addPartsToTargetParts(List<org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>> targetParts)
-