1 /*******************************************************************************
2 * Copyright (c) 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.scenegraph.g2d.nodes.connection;
14 import java.awt.BasicStroke;
15 import java.awt.Color;
16 import java.awt.Graphics2D;
17 import java.awt.RenderingHints;
18 import java.awt.Shape;
19 import java.awt.Stroke;
20 import java.awt.event.KeyEvent;
21 import java.awt.geom.AffineTransform;
22 import java.awt.geom.Path2D;
23 import java.awt.geom.Point2D;
24 import java.awt.geom.Rectangle2D;
25 import java.lang.reflect.Constructor;
26 import java.util.Collection;
29 import org.simantics.diagram.connection.RouteGraph;
30 import org.simantics.diagram.connection.RouteLine;
31 import org.simantics.diagram.connection.RouteLink;
32 import org.simantics.diagram.connection.RouteTerminal;
33 import org.simantics.diagram.connection.actions.IAction;
34 import org.simantics.diagram.connection.actions.IReconnectAction;
35 import org.simantics.diagram.connection.actions.MoveAction;
36 import org.simantics.diagram.connection.actions.ReconnectLineAction;
37 import org.simantics.diagram.connection.delta.RouteGraphDelta;
38 import org.simantics.diagram.connection.rendering.BasicConnectionStyle;
39 import org.simantics.diagram.connection.rendering.ConnectionStyle;
40 import org.simantics.diagram.connection.rendering.IRouteGraphRenderer;
41 import org.simantics.diagram.connection.rendering.StyledRouteGraphRenderer;
42 import org.simantics.diagram.connection.rendering.arrows.ILineEndStyle;
43 import org.simantics.diagram.connection.splitting.SplittedRouteGraph;
44 import org.simantics.scenegraph.INode;
45 import org.simantics.scenegraph.ISelectionPainterNode;
46 import org.simantics.scenegraph.g2d.G2DNode;
47 import org.simantics.scenegraph.g2d.G2DParentNode;
48 import org.simantics.scenegraph.g2d.IG2DNode;
49 import org.simantics.scenegraph.g2d.events.EventTypes;
50 import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent;
51 import org.simantics.scenegraph.g2d.events.KeyEvent.KeyReleasedEvent;
52 import org.simantics.scenegraph.g2d.events.MouseEvent;
53 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonPressedEvent;
54 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonReleasedEvent;
55 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseClickEvent;
56 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDragBegin;
57 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent;
58 import org.simantics.scenegraph.g2d.events.command.CommandEvent;
59 import org.simantics.scenegraph.g2d.events.command.Commands;
60 import org.simantics.scenegraph.g2d.nodes.GridNode;
61 import org.simantics.scenegraph.g2d.nodes.LinkNode;
62 import org.simantics.scenegraph.g2d.nodes.connection.HighlightActionPointsAction.Action;
63 import org.simantics.scenegraph.g2d.nodes.connection.HighlightActionPointsAction.Pick;
64 import org.simantics.scenegraph.g2d.snap.ISnapAdvisor;
65 import org.simantics.scenegraph.utils.GeometryUtils;
66 import org.simantics.scenegraph.utils.InitValueSupport;
67 import org.simantics.scenegraph.utils.NodeUtil;
69 import gnu.trove.map.hash.THashMap;
72 * @author Tuukka Lehtonen
74 public class RouteGraphNode extends G2DNode implements ISelectionPainterNode, InitValueSupport {
76 private static final long serialVersionUID = -917194130412280965L;
78 private static final double TOLERANCE = IAction.TOLERANCE;
79 private static final Stroke SELECTION_STROKE = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
80 private static final Color SELECTION_COLOR = new Color(255, 0, 255, 96);
82 private static final HighlightActionPointsAction highlightActions = new HighlightActionPointsAction(null);
84 protected RouteGraph rg;
85 protected IRouteGraphRenderer baseRenderer;
86 protected IRouteGraphRenderer renderer;
87 protected double pickTolerance = TOLERANCE;
88 protected boolean editable = true;
89 private boolean branchable = true;
91 protected IRouteGraphListener rgListener;
92 protected RouteGraphDelta rgDelta;
94 protected transient double mouseX;
95 protected transient double mouseY;
96 protected transient Point2D pt = new Point2D.Double();
98 protected transient MoveAction dragAction;
99 protected transient IAction currentAction;
100 protected transient Rectangle2D bounds;
103 * Dynamic color for connection rendering.
105 protected transient Color dynamicColor;
108 * Dynamic stroke for connection rendering.
110 protected transient Stroke dynamicStroke;
112 protected transient Path2D selectionPath = new Path2D.Double();
113 protected transient Stroke selectionStroke = null;
115 protected transient boolean highlightActionsEnabled = false;
116 protected transient AffineTransform lastViewTransform = null;
119 * x = NaN is used to indicate that possible branch point should not be
120 * rendered but interaction has not ended yet.
122 protected transient Point2D newBranchPointPosition = null;
125 protected transient Map<Object,ILineEndStyle> dynamicStyles = null;
128 public void initValues() {
133 @PropertySetter("color")
134 @SyncField(value = {"dynamicColor"})
135 public void setDynamicColor(Color color) {
136 this.dynamicColor = color;
140 @PropertySetter("width")
141 @SyncField("dynamicStroke")
142 public void setDynamicStroke(Stroke stroke) {
143 this.dynamicStroke = stroke;
145 createSelectionStroke();
148 @SyncField(value = {"dynamicStyles"})
149 public void setDynamicLineEnd(RouteTerminal terminal, ILineEndStyle style) {
150 if (dynamicStyles == null)
151 dynamicStyles = new THashMap<Object, ILineEndStyle>();
152 terminal.setDynamicStyle(style);
153 if (terminal.getData() != null) {
155 dynamicStyles.put(terminal.getData(),style);
157 dynamicStyles.remove(terminal.getData());
161 private void updateLineEnds() {
162 if (dynamicStyles == null)
164 for (RouteTerminal t : rg.getTerminals()) {
165 if (t.getData() == null)
167 ILineEndStyle dynamicStyle = dynamicStyles.get(t.getData());
168 if (dynamicStyle != null)
169 t.setDynamicStyle(dynamicStyle);
173 @SyncField(value = {"rg"})
174 public void setRouteGraph(RouteGraph graph) {
180 @SyncField(value = {"rgDelta"})
181 public void setRouteGraphDelta(RouteGraphDelta delta) {
182 this.rgDelta = delta;
185 @SyncField(value = {"renderer"})
186 public void setRenderer(IRouteGraphRenderer renderer) {
188 this.baseRenderer = renderer;
191 createSelectionStroke();
194 private void createSelectionStroke() {
195 BasicConnectionStyle style = tryGetStyle();
196 selectionStroke = null;
198 BasicStroke stroke = (BasicStroke) style.getLineStroke();
199 if (stroke != null) {
200 float width = Math.max(stroke.getLineWidth() + 0.75f, stroke.getLineWidth()*1.3f);
201 selectionStroke = new BasicStroke(width, BasicStroke.CAP_BUTT, stroke.getLineJoin());
204 selectionStroke = SELECTION_STROKE;
208 private void wrapRenderer() {
210 if(baseRenderer == null) {
215 if(dynamicColor != null || dynamicStroke != null) {
216 BasicConnectionStyle baseStyle = (BasicConnectionStyle)tryGetStyle(baseRenderer);
218 Constructor<? extends BasicConnectionStyle> c = baseStyle.getClass().getConstructor(Color.class, Color.class, double.class, Stroke.class, Stroke.class, double.class, double.class);
219 renderer = new StyledRouteGraphRenderer(c.newInstance(
220 dynamicColor != null ? dynamicColor : baseStyle.getLineColor(),
221 baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(),
222 dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(),
223 dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(),
224 baseStyle.getDegeneratedLineLength(), baseStyle.getRounding()));
225 } catch (Exception e) {
226 renderer = new StyledRouteGraphRenderer(new BasicConnectionStyle(
227 dynamicColor != null ? dynamicColor : baseStyle.getLineColor(),
228 baseStyle.getBranchPointColor(), baseStyle.getBranchPointRadius(),
229 dynamicStroke != null ? dynamicStroke : baseStyle.getLineStroke(),
230 dynamicStroke != null ? dynamicStroke : baseStyle.getRouteLineStroke(),
231 baseStyle.getDegeneratedLineLength(), baseStyle.getRounding()));
236 renderer = baseRenderer;
241 @SyncField(value = {"pickTolerance"})
242 public void setPickTolerance(double tolerance) {
243 this.pickTolerance = tolerance;
246 @SyncField(value = {"editable"})
247 public void setEditable(boolean editable) {
248 this.editable = editable;
251 @SyncField(value = {"branchable"})
252 public void setBranchable(boolean branchable) {
253 this.branchable = branchable;
256 public RouteGraph getRouteGraph() {
260 public RouteGraphDelta getRouteGraphDelta() {
264 public IRouteGraphRenderer getRenderer() {
268 public boolean isEditable() {
272 public boolean isBranchable() {
276 public double getPickTolerance() {
277 return pickTolerance;
281 * When in client-server mode, listener is only set on the server side and
282 * fireRouteGraphChanged will tell it when rg has changed.
286 public void setRouteGraphListener(IRouteGraphListener listener) {
287 this.rgListener = listener;
293 * @return <code>true</code> if changes were fired
295 private boolean setRouteGraphAndFireChanges(RouteGraph before, RouteGraph after) {
296 RouteGraphDelta delta = new RouteGraphDelta(before, after);
297 if (!delta.isEmpty()) {
298 setRouteGraph(after);
299 setRouteGraphDelta(delta);
300 fireRouteGraphChanged(before, after, delta);
307 protected void fireRouteGraphChanged(RouteGraph before, RouteGraph after, RouteGraphDelta delta) {
308 if (rgListener != null) {
309 RouteGraphChangeEvent event = new RouteGraphChangeEvent(this, before, after, delta);
310 rgListener.routeGraphChanged(event);
314 public void showBranchPoint(Point2D p) {
315 newBranchPointPosition = p;
321 addEventHandler(this);
325 public void cleanup() {
327 removeEventHandler(this);
331 protected boolean isSelected() {
332 return NodeUtil.isSelected(this, 1);
336 public void render(Graphics2D g) {
337 if (renderer == null)
340 AffineTransform ot = null;
341 AffineTransform t = getTransform();
342 if (t != null && !t.isIdentity()) {
343 ot = g.getTransform();
344 g.transform(getTransform());
347 Object aaHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
348 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
350 boolean selected = NodeUtil.isSelected(this, 1);
352 rg.updateTerminals();
354 if (currentAction != null) {
355 currentAction.render(g, renderer, mouseX, mouseY);
357 if (selected && selectionStroke != null) {
358 selectionPath.reset();
359 rg.getPath2D(selectionPath);
360 Shape selectionShape = selectionStroke.createStrokedShape(selectionPath);
361 g.setColor(SELECTION_COLOR);
362 g.fill(selectionShape);
365 renderer.render(g, rg);
367 renderer.renderGuides(g, rg);
369 if (selected && highlightActionsEnabled) {
370 // Needed for performing actions in #mouseClicked
371 this.lastViewTransform = g.getTransform();
372 highlightActions.setRouteGraph(rg);
373 highlightActions.render(g, renderer, mouseX, mouseY);
374 highlightActions.setRouteGraph(null);
378 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aaHint);
380 if (editable && branchable && newBranchPointPosition != null && !Double.isNaN(newBranchPointPosition.getX())) {
381 ConnectionStyle style = tryGetStyle();
383 style.drawBranchPoint(g, newBranchPointPosition.getX(), newBranchPointPosition.getY());
390 private BasicConnectionStyle tryGetStyle() {
391 return tryGetStyle(renderer);
394 private BasicConnectionStyle tryGetStyle(IRouteGraphRenderer renderer) {
395 if (renderer instanceof StyledRouteGraphRenderer) {
396 ConnectionStyle cs = ((StyledRouteGraphRenderer) renderer).getStyle();
397 if (cs instanceof BasicConnectionStyle)
398 return (BasicConnectionStyle) cs;
403 private double getSelectionStrokeWidth() {
404 if (selectionStroke instanceof BasicStroke) {
405 BasicStroke bs = (BasicStroke) selectionStroke;
406 return bs.getLineWidth();
412 public Rectangle2D getBoundsInLocal() {
416 protected void updateBounds() {
417 Rectangle2D r = this.bounds;
419 r = new Rectangle2D.Double();
420 this.bounds = calculateBounds(r);
422 // Need to expand to take stroke width into account.
423 double sw = getSelectionStrokeWidth() / 2;
424 GeometryUtils.expandRectangle(this.bounds, sw, sw);
427 protected Rectangle2D calculateBounds(Rectangle2D rect) {
428 RouteGraph rg = this.rg;
429 if (currentAction instanceof MoveAction)
430 rg = ((MoveAction) currentAction).getRouteGraph();
435 protected void getMouseLocalPos(MouseEvent e) {
436 //System.out.println("m: " + e.controlPosition);
437 pt.setLocation(e.controlPosition);
438 //System.out.println("parent: " + pt);
439 pt = NodeUtil.worldToLocal(this, pt, pt);
440 //System.out.println("local: " + pt);
446 protected boolean mouseDragged(MouseDragBegin e) {
447 if (dragAction != null && !e.hasAnyModifier(MouseEvent.ALL_MODIFIERS_MASK) && e.button == MouseEvent.LEFT_BUTTON) {
448 currentAction = dragAction;
451 return updateCurrentAction(e, true);
455 protected boolean mouseMoved(MouseMovedEvent e) {
456 //System.out.println("mouse moved: " + e);
458 // Handle connection branching visualization.
460 if (newBranchPointPosition == null && e.hasAnyModifier(MouseEvent.ALT_MASK | MouseEvent.ALT_GRAPH_MASK)) {
461 if (bounds.contains(mouseX, mouseY)) {
462 newBranchPointPosition = new Point2D.Double(Double.NaN, Double.NaN);
465 if (newBranchPointPosition != null) {
466 RouteLine line = rg.pickLine(mouseX, mouseY, pickTolerance);
468 newBranchPointPosition.setLocation(mouseX, mouseY);
469 SplittedRouteGraph.snapToLine(newBranchPointPosition, line);
471 } else if (!Double.isNaN(newBranchPointPosition.getX())) {
472 newBranchPointPosition.setLocation(Double.NaN, Double.NaN);
477 // Make sure that highlight action rendering is according to mouse hover.
478 if (highlightActionsEnabled) {
479 if (NodeUtil.isSelected(this, 1)) {
484 return updateCurrentAction(e, false);
487 protected boolean updateCurrentAction(MouseEvent e, boolean updateMousePos) {
488 boolean oldHighlight = highlightActionsEnabled;
489 highlightActionsEnabled = e.hasAllModifiers(MouseEvent.CTRL_MASK);
490 if (oldHighlight != highlightActionsEnabled)
493 if (currentAction != null) {
498 // Repaint, but only if absolutely necessary.
499 if (currentAction instanceof MoveAction || bounds.contains(mouseX, mouseY))
508 protected boolean mouseClicked(MouseClickEvent e) {
512 if (e.button == MouseEvent.LEFT_BUTTON) {
513 if (isSelected() && highlightActionsEnabled) {
514 // Reconnection / segment deletion only available for branched connections.
515 if (rg.getTerminals().size() > 2) {
516 Pick pick = highlightActions.pickAction(rg, lastViewTransform, mouseX, mouseY);
517 if (pick.hasAction(Action.REMOVE)) {
518 RemoveLineAction remove = RemoveLineAction.perform(rg, pick.line.getLine(), mouseX, mouseY);
519 if (remove != null) {
520 setRouteGraphAndFireChanges(remove.getOriginalRouteGraph(), remove.getRouteGraph());
525 if (pick.hasAction(Action.RECONNECT)) {
526 currentAction = ReconnectLineAction.create(rg, mouseX, mouseY);
527 if (currentAction != null) {
539 protected boolean mouseButtonPressed(MouseButtonPressedEvent e) {
543 if (e.button == MouseEvent.LEFT_BUTTON) {
544 // Visualize new branch point no longer.
545 newBranchPointPosition = null;
549 // if(currentAction instanceof HighlightActionPointsAction) {
550 // RemoveLineAction remove = RemoveLineAction.perform(rg, mouseX, mouseY);
551 // if (remove != null) {
552 // setRouteGraphAndFireChanges(remove.getOriginalRouteGraph(), remove.getRouteGraph());
555 // currentAction = ReconnectLineAction.create(rg, mouseX, mouseY);
556 // if (currentAction != null)
561 if(currentAction instanceof IReconnectAction) {
562 RouteGraph originalRg = rg.copy();
563 ((IReconnectAction)currentAction).finish(mouseX, mouseY);
564 currentAction = null;
566 setRouteGraphAndFireChanges(originalRg, rg);
568 currentAction = null;
573 if (!allowConnectionRerouting()) {
576 //System.out.println("move action");
577 dragAction = SnappingMoveAction.create(rg, mouseX, mouseY, pickTolerance, moveFilter, getSnapAdvisor());
578 //System.out.println("DRAG ACTION: " + dragAction);
581 //System.out.println(this + " NEW action: " + currentAction);
582 if (currentAction != null)
589 * Checks the selections data node in the scene graph for any links
592 private boolean allowConnectionRerouting() {
593 final int maxOtherNodesSelected = 1;
595 INode selections = NodeUtil.tryLookup(this, "selections");
596 if (!(selections instanceof G2DParentNode))
598 G2DParentNode p = (G2DParentNode) selections;
599 for (IG2DNode selection : p.getNodes()) {
600 if (!(selection instanceof G2DParentNode))
603 G2DParentNode sp = (G2DParentNode) selection;
604 Collection<IG2DNode> links = sp.getNodes();
607 int othersSelected = 0;
608 for (IG2DNode link : links) {
609 if (link instanceof LinkNode) {
610 INode node = ((LinkNode) link).getDelegate();
611 if (!NodeUtil.isParentOf(node, this)) {
613 if (othersSelected > maxOtherNodesSelected)
618 if (othersSelected > maxOtherNodesSelected)
624 protected ISnapAdvisor getSnapAdvisor() {
625 GridNode grid = lookupNode(GridNode.GRID_NODE_ID, GridNode.class);
626 return grid != null ? grid.getSnapAdvisor() : null;
629 MoveAction.TargetFilter moveFilter = new MoveAction.TargetFilter() {
631 public boolean accept(Object target) {
632 return (target instanceof RouteLine) || (target instanceof RouteLink);
637 protected boolean handleCommand(CommandEvent e) {
638 /*if (Commands.DELETE.equals(e.command)) {
639 Object target = rg.pick(mouseX, mouseY, pickTolerance);
640 return deleteTarget(target);
641 } else if (Commands.SPLIT_CONNECTION.equals(e.command)) {
642 Object target = rg.pick(mouseX, mouseY, pickTolerance);
643 return splitTarget(target);
645 if (Commands.CANCEL.equals(e.command)) {
646 return cancelCurrentAction();
651 protected boolean mouseButtonReleased(MouseButtonReleasedEvent e) {
652 if (currentAction instanceof MoveAction) {
653 MoveAction move = (MoveAction) currentAction;
654 RouteGraph originalRg = rg.copy();
655 move.finish(mouseX, mouseY);
657 setRouteGraphAndFireChanges(originalRg, rg);
659 currentAction = null;
667 protected boolean keyPressed(KeyPressedEvent e) {
671 if (!e.hasAnyModifier(MouseEvent.ALL_MODIFIERS_MASK) && e.keyCode == KeyEvent.VK_S) {
672 Object target = rg.pick(mouseX, mouseY, pickTolerance, RouteGraph.PICK_PERSISTENT_LINES | RouteGraph.PICK_TRANSIENT_LINES);
673 return splitTarget(target);
675 else if (!e.hasAnyModifier(MouseEvent.ALT_MASK | MouseEvent.ALT_GRAPH_MASK | MouseEvent.CTRL_MASK) && (e.keyCode == KeyEvent.VK_R || e.keyCode == KeyEvent.VK_D)) {
676 Object target = rg.pick(mouseX, mouseY, pickTolerance, RouteGraph.PICK_PERSISTENT_LINES);
677 return deleteTarget(target);
679 else if (e.keyCode == KeyEvent.VK_ESCAPE) {
680 return cancelCurrentAction();
682 // else if (e.keyCode == KeyEvent.VK_D) {
683 // if (target instanceof RouteTerminal) {
684 // RouteTerminal terminal = (RouteTerminal) target;
685 // RouteGraph before = rg.copy();
686 // rg.toggleDirectLines(terminal);
687 // setRouteGraphAndFireChanges(before, rg);
691 // else if (target != null && e.getKeyCode() == KeyEvent.VK_P) {
694 else if (e.keyCode == KeyEvent.VK_CONTROL) {
695 highlightActionsEnabled = true;
698 else if (e.keyCode == KeyEvent.VK_ALT) {
699 // Begin connection branching visualization.
700 RouteLine line = rg.pickLine(mouseX, mouseY, pickTolerance);
701 if (branchable && line != null) {
702 newBranchPointPosition = new Point2D.Double(mouseX, mouseY);
703 SplittedRouteGraph.snapToLine(newBranchPointPosition, line);
712 protected boolean keyReleased(KeyReleasedEvent e) {
713 if (e.keyCode == KeyEvent.VK_ALT) {
714 // End connection branching visualization.
715 if (newBranchPointPosition != null) {
716 newBranchPointPosition = null;
720 if (e.keyCode == KeyEvent.VK_CONTROL) {
721 highlightActionsEnabled = false;
728 private boolean cancelCurrentAction() {
729 if (currentAction != null) {
730 currentAction = null;
737 private boolean splitTarget(Object target) {
738 if (target instanceof RouteLine) {
739 RouteLine rLine = (RouteLine)target;
740 RouteGraph before = rg.copy();
741 rg.split(rLine, rLine.isHorizontal() ? mouseX : mouseY);
742 setRouteGraphAndFireChanges(before, rg);
749 private boolean deleteTarget(Object target) {
750 boolean changed = false;
751 if (target instanceof RouteLine) {
752 RouteLine line = (RouteLine) target;
753 RouteGraph before = rg.copy();
755 changed = setRouteGraphAndFireChanges(before, rg);
757 else if (target instanceof RouteLink) {
758 RouteGraph before = rg.copy();
759 rg.deleteCorner((RouteLink) target);
760 changed = setRouteGraphAndFireChanges(before, rg);
762 // else if (target instanceof RouteTerminal) {
763 // RouteGraph before = rg.copy();
764 // rg.remove((RouteTerminal) target);
765 // changed = setRouteGraphAndFireChanges(before, rg);
773 * A version of MoveAction that snaps movements using the specified
776 static class SnappingMoveAction extends MoveAction {
778 private ISnapAdvisor snapAdvisor;
779 private Point2D point = new Point2D.Double();
781 public SnappingMoveAction(RouteGraph rg, Object target, ISnapAdvisor snapAdvisor) {
783 this.snapAdvisor = snapAdvisor;
786 protected void move(RouteGraph rg, Object target, double x, double y) {
787 point.setLocation(x, y);
788 snapAdvisor.snap(point);
789 super.move(rg, target, point.getX(), point.getY());
792 public static MoveAction create(RouteGraph rg, double x, double y, double tolerance, TargetFilter filter, ISnapAdvisor snapAdvisor) {
793 Object target = rg.pick(x, y, tolerance, RouteGraph.PICK_LINES | RouteGraph.PICK_INTERIOR_POINTS);
794 if (target != null && (filter == null || filter.accept(target))) {
795 if (snapAdvisor != null)
796 return new SnappingMoveAction(rg, target, snapAdvisor);
797 return new MoveAction(rg, target);
805 public int getEventMask() {
806 return EventTypes.CommandMask | EventTypes.KeyMask | EventTypes.MouseMask;