]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/ElementFactory.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / adapter / ElementFactory.java
index f80043e311f58a499dbfc830156fe545e27a1a95..7aaf63cd6ded70f0a276a22d7c3bfffe48f26ba4 100644 (file)
@@ -1,85 +1,85 @@
-/*******************************************************************************\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.diagram.adapter;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.procedure.guarded.GuardedAsyncProcedureWrapper;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-import org.simantics.db.procedure.Procedure;\r
-import org.simantics.g2d.canvas.ICanvasContext;\r
-import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.g2d.element.ElementClass;\r
-import org.simantics.g2d.element.IElement;\r
-\r
-/**\r
- * The base interface for loading diagram elements from the graph database into\r
- * {@link ElementClass} and {@link IElement} instances for use with the g2d\r
- * diagram framework.\r
- * \r
- * @author Tuukka Lehtonen\r
- * \r
- * @see ElementFactoryAdapter\r
- * @see SyncElementFactory\r
- */\r
-public interface ElementFactory {\r
-\r
-    /**\r
-     * Retrieves the {@link ElementClass} for the given modelled element type.\r
-     */\r
-    void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType, AsyncProcedure<ElementClass> procedure);\r
-\r
-    /**\r
-     * Retrieves the {@link ElementClass} for the given modelled element\r
-     * instance. The only real difference to\r
-     * {@link #create(AsyncReadGraph, ICanvasContext, IDiagram, Resource, AsyncProcedure)}\r
-     * is that the resource argument is an element instance, not a type.\r
-     * \r
-     * The most usual default implementation of this method is to get the type\r
-     * of the resource and invoke\r
-     * {@link #create(AsyncReadGraph, ICanvasContext, IDiagram, Resource, AsyncProcedure)}\r
-     * with the type.\r
-     */\r
-    void getClass(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource, AsyncProcedure<ElementClass> procedure);\r
-\r
-    /**\r
-     * Loads data from given modelled element resource into the given element.\r
-     * \r
-     * <p>\r
-     * The loader shall notify the specified <code>procedure</code> when the\r
-     * element has been loaded. If the element cannot be loaded properly for\r
-     * some reason, {@link Procedure#exception(Throwable)} should be invoked.\r
-     * Only invoke either {@link Procedure#exception(Throwable)} or\r
-     * {@link Procedure#execute(Object)} once.\r
-     * {@link GuardedAsyncProceureWrapper} can help with that.\r
-     * \r
-     * <p>\r
-     * IMPORTANT: Diagram elements are essentially nothing more than their\r
-     * {@link ElementClass} and a set of hints. Updating the appearance or any\r
-     * other property related to an IElement is always a matter of updating its\r
-     * hint values. This is exactly what {@link GraphToDiagramSynchronizer} does\r
-     * in order to keep the run-time IElement representation in sync with the\r
-     * database contents. IElements may contain any number of hints that are set\r
-     * outside of the ElementFactory that loaded the element. In order for the\r
-     * graph &rarr; IElement updates to work properly, the updater must be able\r
-     * to rely on the fact that it simply needs to replace the existing hint\r
-     * values with the new hint values loaded by this method. Therefore\r
-     * implementers need to ensure that the same set of hint keys is always\r
-     * loaded for a single element. Otherwise the update process will\r
-     * potentially leave unwanted hints lying around in the run-time diagram\r
-     * elements.\r
-     * \r
-     * @see GuardedAsyncProcedureWrapper\r
-     */\r
-    void load(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource, IElement element, AsyncProcedure<IElement> procedure);\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.diagram.adapter;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.guarded.GuardedAsyncProcedureWrapper;
+import org.simantics.db.procedure.AsyncProcedure;
+import org.simantics.db.procedure.Procedure;
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.g2d.element.ElementClass;
+import org.simantics.g2d.element.IElement;
+
+/**
+ * The base interface for loading diagram elements from the graph database into
+ * {@link ElementClass} and {@link IElement} instances for use with the g2d
+ * diagram framework.
+ * 
+ * @author Tuukka Lehtonen
+ * 
+ * @see ElementFactoryAdapter
+ * @see SyncElementFactory
+ */
+public interface ElementFactory {
+
+    /**
+     * Retrieves the {@link ElementClass} for the given modelled element type.
+     */
+    void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType, AsyncProcedure<ElementClass> procedure);
+
+    /**
+     * Retrieves the {@link ElementClass} for the given modelled element
+     * instance. The only real difference to
+     * {@link #create(AsyncReadGraph, ICanvasContext, IDiagram, Resource, AsyncProcedure)}
+     * is that the resource argument is an element instance, not a type.
+     * 
+     * The most usual default implementation of this method is to get the type
+     * of the resource and invoke
+     * {@link #create(AsyncReadGraph, ICanvasContext, IDiagram, Resource, AsyncProcedure)}
+     * with the type.
+     */
+    void getClass(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource, AsyncProcedure<ElementClass> procedure);
+
+    /**
+     * Loads data from given modelled element resource into the given element.
+     * 
+     * <p>
+     * The loader shall notify the specified <code>procedure</code> when the
+     * element has been loaded. If the element cannot be loaded properly for
+     * some reason, {@link Procedure#exception(Throwable)} should be invoked.
+     * Only invoke either {@link Procedure#exception(Throwable)} or
+     * {@link Procedure#execute(Object)} once.
+     * {@link GuardedAsyncProceureWrapper} can help with that.
+     * 
+     * <p>
+     * IMPORTANT: Diagram elements are essentially nothing more than their
+     * {@link ElementClass} and a set of hints. Updating the appearance or any
+     * other property related to an IElement is always a matter of updating its
+     * hint values. This is exactly what {@link GraphToDiagramSynchronizer} does
+     * in order to keep the run-time IElement representation in sync with the
+     * database contents. IElements may contain any number of hints that are set
+     * outside of the ElementFactory that loaded the element. In order for the
+     * graph &rarr; IElement updates to work properly, the updater must be able
+     * to rely on the fact that it simply needs to replace the existing hint
+     * values with the new hint values loaded by this method. Therefore
+     * implementers need to ensure that the same set of hint keys is always
+     * loaded for a single element. Otherwise the update process will
+     * potentially leave unwanted hints lying around in the run-time diagram
+     * elements.
+     * 
+     * @see GuardedAsyncProcedureWrapper
+     */
+    void load(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource, IElement element, AsyncProcedure<IElement> procedure);
+
+}