1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.scenegraph;
14 import java.io.Serializable;
15 import java.lang.annotation.ElementType;
16 import java.lang.annotation.Retention;
17 import java.lang.annotation.RetentionPolicy;
18 import java.lang.annotation.Target;
26 public interface INode extends Serializable {
27 public static enum Location { LOCAL, REMOTE };
30 * Tell the MethodInterceptor to synchronize the given fields after the
\r
35 @Retention(RetentionPolicy.RUNTIME)
36 @Target(ElementType.METHOD)
37 public @interface SyncField {
38 String[] value(); // Field name(s)
42 * Tell the MethodInterceptor to remotely call this method if we are on the
\r
43 * client side. Notice that the method type must be void, thus it cannot
\r
48 @Retention(RetentionPolicy.RUNTIME)
49 @Target(ElementType.METHOD)
50 public @interface ServerSide {
54 * Tell the MethodInterceptor to remotely call this method if we are on the
\r
55 * server side. Notice that the method type must be void, thus it cannot
\r
60 @Retention(RetentionPolicy.RUNTIME)
61 @Target(ElementType.METHOD)
62 public @interface ClientSide {
66 * Tag method as setter for a property identified by string. Basically used
\r
67 * by the automatic graph to node property synchronizer.
\r
71 @Retention(RetentionPolicy.RUNTIME)
\r
72 @Target(ElementType.METHOD)
\r
73 public @interface PropertySetter {
\r
74 String value(); // Property name
\r
79 * @return unique node identifier
\r
84 * @return root node of the scene graph or <code>null</code> if this node is
\r
85 * not part of a properly rooted scene graph hierarchy
\r
87 public ParentNode<?> getRootNode();
\r
90 * @return Parent node reference or <code>null</code> if not set
\r
92 public ParentNode<?> getParent();
95 * Set parent node. This method is for scene graph internal use only and
\r
96 * should not be called outside the scene graph structure. This method
\r
97 * simply sets the parent node parent field, and does not affect on parent
\r
98 * node (i.e., should be called only from parent node).
\r
100 public void setParent(ParentNode<?> parent);
103 * Initialize node. This is called immediately after the node is added to
\r
104 * the scene graph tree through any of the node addition methods in
\r
105 * {@link ParentNode}.
\r
107 * @see ParentNode#addNode(Class)
\r
108 * @see ParentNode#addNode(String, Class)
\r
109 * @see ParentNode#getOrCreateNode(String, Class)
\r
112 public void attach();
\r
115 * Perform cleanup for this node and for the child nodes. Any resources
\r
116 * (including child nodes) related to this node are unusable after this
\r
117 * operation. This method is for scene graph internal use only, thus should
\r
118 * not be called outside the scene graph structure.
\r
120 public void cleanup();
123 * Remove this node and its children from the scene graph.
\r
125 public void remove();
128 * Delete this node, and move its children under its parent.
\r
131 * Note: this method has no effect if the node has no parent.
\r
133 public void delete();
\r
136 * Append parent node for this node. The new node will be placed between
\r
137 * parent node and this node. In order to call this method the node must be
\r
138 * a child of another node, hence parent must be not null.
\r
140 public <TC> TC appendParent(String id, Class<TC> nc);
\r
143 public String toString();
146 * @return simple name for this node class
\r
148 public String getSimpleClassName();
\r