1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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;
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
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
43 * client side. Notice that the method type must be void, thus it cannot
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
55 * server side. Notice that the method type must be void, thus it cannot
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
67 * by the automatic graph to node property synchronizer.
71 @Retention(RetentionPolicy.RUNTIME)
72 @Target(ElementType.METHOD)
73 public @interface PropertySetter {
74 String value(); // Property name
79 * @return unique node identifier
84 * @return root node of the scene graph or <code>null</code> if this node is
85 * not part of a properly rooted scene graph hierarchy
87 public ParentNode<?> getRootNode();
90 * @return Parent node reference or <code>null</code> if not set
92 public ParentNode<?> getParent();
95 * Set parent node. This method is for scene graph internal use only and
96 * should not be called outside the scene graph structure. This method
97 * simply sets the parent node parent field, and does not affect on parent
98 * node (i.e., should be called only from parent node).
100 public void setParent(ParentNode<?> parent);
103 * Initialize node. This is called immediately after the node is added to
104 * the scene graph tree through any of the node addition methods in
105 * {@link ParentNode}.
107 * @see ParentNode#addNode(Class)
108 * @see ParentNode#addNode(String, Class)
109 * @see ParentNode#getOrCreateNode(String, Class)
112 public void attach();
115 * Perform cleanup for this node and for the child nodes. Any resources
116 * (including child nodes) related to this node are unusable after this
117 * operation. This method is for scene graph internal use only, thus should
118 * not be called outside the scene graph structure.
120 public void cleanup();
123 * Remove this node and its children from the scene graph.
125 public void remove();
128 * Delete this node, and move its children under its parent.
131 * Note: this method has no effect if the node has no parent.
133 public void delete();
136 * Append parent node for this node. The new node will be placed between
137 * parent node and this node. In order to call this method the node must be
138 * a child of another node, hence parent must be not null.
140 public <TC> TC appendParent(String id, Class<TC> nc);
143 public String toString();
146 * @return simple name for this node class
148 public String getSimpleClassName();