]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/IDiagram.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / diagram / IDiagram.java
index d07a2b2e29407d245d56f55fe68621f9aecdd6b7..ddef14539311701d80197d79b14f83eee6a50b27 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.diagram;\r
-\r
-import java.util.Comparator;\r
-import java.util.List;\r
-\r
-import org.simantics.g2d.diagram.impl.Diagram;\r
-import org.simantics.g2d.diagram.participant.ZOrderHandler;\r
-import org.simantics.g2d.element.IElement;\r
-import org.simantics.utils.datastructures.hints.IHintContext;\r
-\r
-/**\r
- * Diagram is a flat ordered composition of elements.\r
- * <p>\r
- * Diagram may only be accessed from canvas thread.\r
- * <p>\r
- * Diagram variables are persistent.\r
- * <p>\r
- * Elements are ordered according to their z-value\r
- * \r
- * @see Diagram Default implementation\r
- * @see IElement\r
- * @see ZOrderHandler\r
- * @author Toni Kalajainen\r
- */\r
-public interface IDiagram extends IHintContext {\r
-\r
-    public interface CompositionVetoListener {\r
-        /**\r
-         * Invoked before an element is actually added on to a diagram. This\r
-         * provides the possibility to veto the addition by returning\r
-         * <code>false</code>.\r
-         * \r
-         * @param d the diagram to be changed\r
-         * @param e the element to be added\r
-         * @return <code>true</code> to allow the addition or <code>false</code>\r
-         *         to veto the addition\r
-         */\r
-        boolean beforeElementAdded(IDiagram d, IElement e);\r
-\r
-        /**\r
-         * Invoked before an element is actually removed from a diagram. This\r
-         * provides the possibility to veto the addition by returning\r
-         * <code>false</code>.\r
-         * \r
-         * @param d the diagram to be changed\r
-         * @param e the element to be removed\r
-         * @return <code>true</code> to allow the removal or <code>false</code>\r
-         *         to veto the removal\r
-         */\r
-        boolean beforeElementRemoved(IDiagram d, IElement e);\r
-    }\r
-\r
-    public interface CompositionListener {\r
-        /**\r
-         * @param d\r
-         * @param e\r
-         */\r
-        void onElementAdded(IDiagram d, IElement e);\r
-\r
-        /**\r
-         * @param d\r
-         * @param e\r
-         */\r
-        void onElementRemoved(IDiagram d, IElement e);\r
-    }\r
-\r
-    /**\r
-     * Add a composition listener that can veto element addition/removal\r
-     * @param listener\r
-     */\r
-    void addCompositionVetoListener(CompositionVetoListener listener);\r
-    /**\r
-     * Remove composition veto listener\r
-     * @param listener\r
-     */\r
-    void removeCompositionVetoListener(CompositionVetoListener listener);\r
-\r
-    /**\r
-     * Add a composition listener that notifies about element composition\r
-     * @param listener\r
-     */\r
-    void addCompositionListener(CompositionListener listener);\r
-    /**\r
-     * Remove composition listener\r
-     * @param listener\r
-     */\r
-    void removeCompositionListener(CompositionListener listener);\r
-\r
-    /**\r
-     * Get diagram class\r
-     * @return diagram class\r
-     */\r
-    DiagramClass getDiagramClass();\r
-\r
-    /**\r
-     * Get a snapshot of elements. The list is z-ordered, where\r
-     * top most elements are at the end of the list.\r
-     * @return a snapshot of elements\r
-     */\r
-    List<IElement> getSnapshot();\r
-\r
-    /**\r
-     * Get z-ordered list of the elements. The return value is not intended for\r
-     * direct modification.\r
-     * \r
-     * @return\r
-     */\r
-    List<IElement> getElements();\r
-\r
-    /**\r
-     * Reorder the contained diagram elements using the specified comparator.\r
-     * \r
-     * @param comparator\r
-     */\r
-    void sort(Comparator<IElement> comparator);\r
-\r
-    /**\r
-     * Add an element to the diagram.\r
-     * \r
-     * @param element the element to add\r
-     * @return element of class\r
-     */\r
-    void addElement(IElement element);\r
-\r
-    /**\r
-     * Checks if a diagram contains an element.\r
-     * @return true if diagram contains the element.\r
-     */\r
-    boolean containsElement(IElement element);\r
-\r
-    /**\r
-     * Remove an element from the diagram\r
-     * @param element element to remove\r
-     */\r
-    void removeElement(IElement element);\r
-\r
-    /**\r
-     * Destroy the diagram from the world permanently.\r
-     * Destroys all contained elements as well.\r
-     */\r
-    void destroy();\r
-    void dispose();\r
-\r
-    // Z-Order\r
-    boolean bringUp(IElement e);\r
-    boolean sendDown(IElement e);\r
-    boolean bringToTop(IElement e);\r
-    boolean sendToBottom(IElement e);\r
-\r
-    /**\r
-     * @param e\r
-     * @param position\r
-     * @return <code>true</code> if the position changed\r
-     */\r
-    boolean moveTo(IElement e, int position);\r
-\r
-}\r
+/*******************************************************************************
+ * 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.util.Comparator;
+import java.util.List;
+
+import org.simantics.g2d.diagram.impl.Diagram;
+import org.simantics.g2d.diagram.participant.ZOrderHandler;
+import org.simantics.g2d.element.IElement;
+import org.simantics.utils.datastructures.hints.IHintContext;
+
+/**
+ * Diagram is a flat ordered composition of elements.
+ * <p>
+ * Diagram may only be accessed from canvas thread.
+ * <p>
+ * Diagram variables are persistent.
+ * <p>
+ * Elements are ordered according to their z-value
+ * 
+ * @see Diagram Default implementation
+ * @see IElement
+ * @see ZOrderHandler
+ * @author Toni Kalajainen
+ */
+public interface IDiagram extends IHintContext {
+
+    public interface CompositionVetoListener {
+        /**
+         * Invoked before an element is actually added on to a diagram. This
+         * provides the possibility to veto the addition by returning
+         * <code>false</code>.
+         * 
+         * @param d the diagram to be changed
+         * @param e the element to be added
+         * @return <code>true</code> to allow the addition or <code>false</code>
+         *         to veto the addition
+         */
+        boolean beforeElementAdded(IDiagram d, IElement e);
+
+        /**
+         * Invoked before an element is actually removed from a diagram. This
+         * provides the possibility to veto the addition by returning
+         * <code>false</code>.
+         * 
+         * @param d the diagram to be changed
+         * @param e the element to be removed
+         * @return <code>true</code> to allow the removal or <code>false</code>
+         *         to veto the removal
+         */
+        boolean beforeElementRemoved(IDiagram d, IElement e);
+    }
+
+    public interface CompositionListener {
+        /**
+         * @param d
+         * @param e
+         */
+        void onElementAdded(IDiagram d, IElement e);
+
+        /**
+         * @param d
+         * @param e
+         */
+        void onElementRemoved(IDiagram d, IElement e);
+    }
+
+    /**
+     * Add a composition listener that can veto element addition/removal
+     * @param listener
+     */
+    void addCompositionVetoListener(CompositionVetoListener listener);
+    /**
+     * Remove composition veto listener
+     * @param listener
+     */
+    void removeCompositionVetoListener(CompositionVetoListener listener);
+
+    /**
+     * Add a composition listener that notifies about element composition
+     * @param listener
+     */
+    void addCompositionListener(CompositionListener listener);
+    /**
+     * Remove composition listener
+     * @param listener
+     */
+    void removeCompositionListener(CompositionListener listener);
+
+    /**
+     * Get diagram class
+     * @return diagram class
+     */
+    DiagramClass getDiagramClass();
+
+    /**
+     * Get a snapshot of elements. The list is z-ordered, where
+     * top most elements are at the end of the list.
+     * @return a snapshot of elements
+     */
+    List<IElement> getSnapshot();
+
+    /**
+     * Get z-ordered list of the elements. The return value is not intended for
+     * direct modification.
+     * 
+     * @return
+     */
+    List<IElement> getElements();
+
+    /**
+     * Reorder the contained diagram elements using the specified comparator.
+     * 
+     * @param comparator
+     */
+    void sort(Comparator<IElement> comparator);
+
+    /**
+     * Add an element to the diagram.
+     * 
+     * @param element the element to add
+     * @return element of class
+     */
+    void addElement(IElement element);
+
+    /**
+     * Checks if a diagram contains an element.
+     * @return true if diagram contains the element.
+     */
+    boolean containsElement(IElement element);
+
+    /**
+     * Remove an element from the diagram
+     * @param element element to remove
+     */
+    void removeElement(IElement element);
+
+    /**
+     * Destroy the diagram from the world permanently.
+     * Destroys all contained elements as well.
+     */
+    void destroy();
+    void dispose();
+
+    // Z-Order
+    boolean bringUp(IElement e);
+    boolean sendDown(IElement e);
+    boolean bringToTop(IElement e);
+    boolean sendToBottom(IElement e);
+
+    /**
+     * @param e
+     * @param position
+     * @return <code>true</code> if the position changed
+     */
+    boolean moveTo(IElement e, int position);
+
+}