FreeWRL/FreeX3D  3.0.0
FWProtoDeclaration.java
1 package sai;
2 import org.web3d.x3d.sai.*;
3 import java.util.*;
4 
6  String protoName;
7  FreeWRLFieldDefinition[] fields;
8  FreeWRLBrowser browser;
9  int nodeType;
10 
12  browser = b;
13  }
14  public String getProtoName() {
15  return protoName;
16  }
17 
18  public String toString() {
19  String temp;
20  temp = "" + protoName + " " + FreeWRLFieldTypes.getStringDesc(nodeType);
21  temp = temp + " " + fields.length;
22  for (int i = 0; i < fields.length; i++) {
23  temp = temp + " " + fields[i].getFieldTypeString() + " " + fields[i].getName() + " " + fields[i].getDefault();
24  }
25 
26  return temp;
27 
28  }
30  String retval;
31  StringTokenizer tokens;
32  FWProtoInstance proto;
33 
34  retval = browser.sendGlobalCommand("b " + protoName);
35  tokens = new StringTokenizer(retval);
36  proto = new FWProtoInstance(browser);
37  proto.setNodeName(tokens.nextToken());
38  proto.setPointer(tokens.nextToken());
39 
40  return proto;
41  }
42  public X3DFieldDefinition[] getFieldDefinitions() throws InvalidOperationTimingException, InvalidProtoException {
43  return fields;
44  }
45 
46  public int getLoadState() {
47  return -1;
48  }
49 
50  public void loadNow() {
51  }
52 
53  public void setProtoName(String name) {
54  protoName = name;
55  }
56 
57  public void setFields(FreeWRLFieldDefinition[] f) {
58  fields = f;
59  }
60 
61  public void setType(int t) {
62  nodeType = t;
63  }
64 
65  public int[] getNodeType() throws InvalidProtoException {
66  int[] types;
67  types = new int[1];
68  types[0] = nodeType;
69 
70  return types;
71  }
72 
73  public void dispose() {
74 
75  }
76 }