X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Fdiagram%2FDiagramHints.java;h=0c11d348ab62fcc3860437b1e8a72f779f5349d5;hb=16cb606570307cf9be0138baa51d5babac2fb99c;hp=76637fe4877265cae9667982bfa97d5649438693;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/DiagramHints.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/DiagramHints.java index 76637fe48..0c11d348a 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/DiagramHints.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/DiagramHints.java @@ -1,182 +1,203 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.g2d.diagram; - -import java.awt.Color; -import java.awt.Point; -import java.awt.geom.Point2D; -import java.util.List; -import java.util.Map; - -import org.simantics.g2d.canvas.ICanvasContext; -import org.simantics.g2d.canvas.ICanvasParticipant; -import org.simantics.g2d.connection.IConnectionAdvisor; -import org.simantics.g2d.layers.ILayers; -import org.simantics.g2d.layers.ILayersEditor; -import org.simantics.g2d.routing.IRouter2; -import org.simantics.scenegraph.g2d.snap.ISnapAdvisor; -import org.simantics.utils.datastructures.hints.IHintContext.Key; -import org.simantics.utils.datastructures.hints.IHintContext.KeyOf; -import org.simantics.utils.page.MarginUtils.Margins; - -/** - * These hints are meant to be used with IDiagram instances. - * - * @author Toni Kalajainen - */ -public class DiagramHints { - - /** - * A hint for disabling painting of the diagram the hint is associated with. - * - *
- * By default diagram viewers perform a zoom-to-fit operation on the opened - * diagram immediately after opening. Sometimes it is desirable to allow - * disabling of this fitting process. Due to the SWT/AWT interplay nature of - * diagram editors, the process of zoom-to-fit is rather asynchronous and - * needs to schedule runnables into the toolkit threads. Since editor - * opening is synchronously performed in the SWT thread we can safely veto - * the zoom-to-fit operation by removing this hint from the diagram after - * opening the editor. - * - *
- * Can also be set for an {@link ICanvasContext} to enable or disable
- * initial zoom to fit for the context regardless of the diagram in
- * question.
- */
- public static final Key KEY_INITIAL_ZOOM_TO_FIT = new KeyOf(Boolean.class, "INITIAL_ZOOM_TO_FIT");
-
- /** Diagram */
- public static final Key KEY_DIAGRAM = new KeyOf(IDiagram.class, "DIAGRAM");
-
- public static final Key KEY_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "SELECTION_FRAME_COLOR");
-
- public static final Key KEY_TEXT = new KeyOf(String.class, "DIAGRAM_TEXT");
-
- public static final Key KEY_CANVAS_COLOR = new KeyOf(Color.class, "CANVAS_COLOR");
-
- // Layer composition List
+ * By default diagram viewers perform a zoom-to-fit operation on the opened
+ * diagram immediately after opening. Sometimes it is desirable to allow
+ * disabling of this fitting process. Due to the SWT/AWT interplay nature of
+ * diagram editors, the process of zoom-to-fit is rather asynchronous and
+ * needs to schedule runnables into the toolkit threads. Since editor
+ * opening is synchronously performed in the SWT thread we can safely veto
+ * the zoom-to-fit operation by removing this hint from the diagram after
+ * opening the editor.
+ *
+ *
+ * Can also be set for an {@link ICanvasContext} to enable or disable
+ * initial zoom to fit for the context regardless of the diagram in
+ * question.
+ */
+ public static final Key KEY_INITIAL_ZOOM_TO_FIT = new KeyOf(Boolean.class, "INITIAL_ZOOM_TO_FIT");
+
+ /** Diagram */
+ public static final Key KEY_DIAGRAM = new KeyOf(IDiagram.class, "DIAGRAM");
+
+ public static final Key KEY_SELECTION_FRAME_COLOR = new KeyOf(Color.class, "SELECTION_FRAME_COLOR");
+
+ public static final Key KEY_TEXT = new KeyOf(String.class, "DIAGRAM_TEXT");
+
+ public static final Key KEY_CANVAS_COLOR = new KeyOf(Color.class, "CANVAS_COLOR");
+
+ // Layer composition Listtrue
to allow connection branching. null
or
- * false
will disable connection branching.
- *
- * This is a hint for editing, not for visualisation.
- *
- * If the hint is not present, the default interpretation should be to allow branching.
- */
- public static final Key KEY_ALLOW_CONNECTION_BRANCHING = new KeyOf(Boolean.class, "ALLOW_CONNECTION_BRANCHING");
-
- /**
- * true
to create flags when connections are left in the air,
- * null
or false
will leave the connections
- * hanging in the air.
- *
- * This is a hint for editing, not for visualisation.
- *
- * If the hint is not present, the default interpretation should be not to
- * use connection flags.
- */
- public static final Key KEY_USE_CONNECTION_FLAGS = new KeyOf(Boolean.class, "USE_CONNECTION_FLAGS");
-
- /**
- * true
to allow adding of route points into connections or
- * false
to deny route points from being added/created.
- *
- * This is a hint for editing, not for visualisation.
- *
- * If the hint is not present, the default interpretation should be to use
- * route points
- */
- public static final Key KEY_ALLOW_ROUTE_POINTS = new KeyOf(Boolean.class, "ALLOW_ROUTE_POINTS");
-
-
- /**
- * A Hint for other participants to use for showing the context menu at the
- * contol position specified by the Point2D argument.
- */
- public static final Key SHOW_POPUP_MENU = new KeyOf(Point2D.class, "SHOW_POPUP_MENU_CMD");
-
- /**
- * Screen position of mouse on canvas control when the menu was invoked to
- * be opened. For use by menu contributions.
- */
- public static final Key POPUP_MENU_CONTROL_POSITION = new KeyOf(Point2D.class, "POPUP_MENU_CONTROL_POSITION");
-
- /**
- * Canvas position of mouse on canvas control when the menu was invoked to
- * be opened. For use by menu contributions.
- */
- public static final Key POPUP_MENU_CANVAS_POSITION = new KeyOf(Point2D.class, "POPUP_MENU_CANVAS_POSITION");
-
- /**
- * {@link System#currentTimeMillis()} from the time of processing the popup
- * menu show event.
- */
- public static final Key POPUP_MENU_SHOWN = new KeyOf(Long.class, "POPUP_MENU_SHOWN");
-
- /**
- * {@link System#currentTimeMillis()} from the time of processing the popup
- * menu hide event.
- */
- public static final Key POPUP_MENU_HIDDEN = new KeyOf(Long.class, "POPUP_MENU_HIDDEN");
-
-}
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.diagram;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.geom.Point2D;
+import java.util.List;
+import java.util.Map;
+
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.g2d.canvas.ICanvasParticipant;
+import org.simantics.g2d.connection.IConnectionAdvisor;
+import org.simantics.g2d.diagram.handler.impl.PickContextImpl;
+import org.simantics.g2d.diagram.participant.ElementPainter;
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.layers.ILayers;
+import org.simantics.g2d.layers.ILayersEditor;
+import org.simantics.g2d.routing.IRouter2;
+import org.simantics.scenegraph.INode;
+import org.simantics.scenegraph.g2d.snap.ISnapAdvisor;
+import org.simantics.utils.datastructures.hints.IHintContext.Key;
+import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
+import org.simantics.utils.page.MarginUtils.Margins;
+
+/**
+ * These hints are meant to be used with IDiagram instances.
+ *
+ * @author Toni Kalajainen
+ */
+public class DiagramHints {
+
+ /**
+ * A hint for disabling painting of the diagram the hint is associated with.
+ *
+ * true
to allow connection branching. null
or
+ * false
will disable connection branching.
+ *
+ * This is a hint for editing, not for visualisation.
+ *
+ * If the hint is not present, the default interpretation should be to allow branching.
+ */
+ public static final Key KEY_ALLOW_CONNECTION_BRANCHING = new KeyOf(Boolean.class, "ALLOW_CONNECTION_BRANCHING");
+
+ /**
+ * true
to create flags when connections are left in the air,
+ * null
or false
will leave the connections
+ * hanging in the air.
+ *
+ * This is a hint for editing, not for visualisation.
+ *
+ * If the hint is not present, the default interpretation should be not to
+ * use connection flags.
+ */
+ public static final Key KEY_USE_CONNECTION_FLAGS = new KeyOf(Boolean.class, "USE_CONNECTION_FLAGS");
+
+ /**
+ * true
to allow adding of route points into connections or
+ * false
to deny route points from being added/created.
+ *
+ * This is a hint for editing, not for visualisation.
+ *
+ * If the hint is not present, the default interpretation should be to use
+ * route points
+ */
+ public static final Key KEY_ALLOW_ROUTE_POINTS = new KeyOf(Boolean.class, "ALLOW_ROUTE_POINTS");
+
+
+ /**
+ * A Hint for other participants to use for showing the context menu at the
+ * control position specified by the Point2D argument.
+ */
+ public static final Key SHOW_POPUP_MENU = new KeyOf(Point2D.class, "SHOW_POPUP_MENU_CMD");
+
+ /**
+ * Screen position of mouse on canvas control when the menu was invoked to
+ * be opened. For use by menu contributions.
+ */
+ public static final Key POPUP_MENU_CONTROL_POSITION = new KeyOf(Point2D.class, "POPUP_MENU_CONTROL_POSITION");
+
+ /**
+ * Canvas position of mouse on canvas control when the menu was invoked to
+ * be opened. For use by menu contributions.
+ */
+ public static final Key POPUP_MENU_CANVAS_POSITION = new KeyOf(Point2D.class, "POPUP_MENU_CANVAS_POSITION");
+
+ /**
+ * {@link System#currentTimeMillis()} from the time of processing the popup
+ * menu show event.
+ */
+ public static final Key POPUP_MENU_SHOWN = new KeyOf(Long.class, "POPUP_MENU_SHOWN");
+
+ /**
+ * {@link System#currentTimeMillis()} from the time of processing the popup
+ * menu hide event.
+ */
+ public static final Key POPUP_MENU_HIDDEN = new KeyOf(Long.class, "POPUP_MENU_HIDDEN");
+
+ /**
+ * For specifying a user-defined padding for selections
+ *
+ * @since 1.33.0
+ */
+ public static final Key SELECTION_PADDING_SCALE_FACTOR = new KeyOf(Double.class, "SELECTION_PADDING_SCALE_FACTOR");
+
+ /**
+ * An optional cache map that maps scene graph {@link INode}s to
+ * {@link IElement}s to speed up IElement lookups based on SG nodes.
+ *
+ * @since 1.36.0
+ * @see PickContextImpl
+ * @see ElementPainter
+ */
+ public static final Key NODE_TO_ELEMENT_MAP = new KeyOf(Map.class, "NODE_TO_ELEMENT_MAP");
+
+}