2 import org.web3d.x3d.sai.*;
21 rNodes =
new ArrayList(1);
22 routes =
new ArrayList(1);
23 metaData =
new HashMap();
28 profile = FWProfInfo.getProfile(
new String(
"Full"));
32 for (
int i = 0; i < n.length; i++) {
42 String tofield, fromfield;
43 StringTokenizer tokens;
48 root = (
FreeWRLNode) browser.getNode(
"_Sarah_this_is_the_FreeWRL_System_Root_Node");
51 numnodes = children.size();
53 children.getValue(nodes);
54 for (i = 0; i < numnodes; i++) {
57 retval = browser.sendGlobalCommand(
"j");
59 tokens =
new StringTokenizer(retval);
61 numRoutes = Integer.parseInt(tokens.nextToken());
63 for (i = 0; i < numRoutes; i++) {
65 fromnode.setPerlPtr(tokens.nextToken());
66 fromnode.setPointer(tokens.nextToken());
67 fromfield = tokens.nextToken();
69 tonode.setPerlPtr(tokens.nextToken());
70 tonode.setPointer(tokens.nextToken());
71 tofield = tokens.nextToken();
72 route =
new FWRoute(fromnode, fromfield, tonode, tofield);
80 metaData =
new HashMap();
81 rNodes =
new ArrayList(1);
82 routes =
new ArrayList(1);
87 profile = FWProfInfo.getProfile(
new String(
"Full"));
92 metaData =
new HashMap();
101 rNodes =
new ArrayList(1);
102 routes =
new ArrayList(1);
104 if ((profile != null) && (components != null)) {
106 tempcomps =
new ArrayList(1);
108 for (i = 0; i < profcomps.length; i++) {
110 for (j = 0; j < components.length; j++) {
111 if ((profcomps[i].getName()).equals(components[j].getName())) {
112 if ((profcomps[i].getLevel()) > (components[j].getLevel())) {
113 tempcomps.add(profcomps[i]);
116 tempcomps.add(components[j]);
122 tempcomps.add(profcomps[i]);
126 for (j = 0; j < components.length; j++) {
128 for (i = 0; i < profcomps.length; i++) {
129 if ((profcomps[i].getName()).equals(components[j].getName())) {
134 tempcomps.add(components[j]);
138 Object[] returnval = tempcomps.toArray();
142 for (i = 0; i < returnval.length; i++) {
149 public void setCurrent(
boolean val) {
154 return (String) metaData.get(key);
158 metaData.put(key, value);
163 return browser.getNode(nodeName);
173 nodeRef = browser.getNode(nodeName);
175 retval = browser.sendGlobalCommand(
"c " + newName +
" " + nodeRef);
177 if (retval.equals(
"1")) {
187 retval = browser.sendGlobalCommand(
"d " + nodeName);
189 if (retval.equals(
"1")) {
200 if (rootNode == null) {
206 rNodes.add(rootNode);
208 root = (
FreeWRLNode) browser.getNode(
"_Sarah_this_is_the_FreeWRL_System_Root_Node");
209 MFNode addChildren = (
MFNode) root.getField(
"addChildren");
210 addChildren.setValue(1, nodes);
221 if (rootNode == null) {
227 index = rNodes.indexOf(rootNode);
229 System.out.println(
"Node not present");
232 rNodes.remove(index);
234 root = (
FreeWRLNode) browser.getNode(
"_Sarah_this_is_the_FreeWRL_System_Root_Node");
235 MFNode removeChildren = (
MFNode) root.getField(
"removeChildren");
236 removeChildren.setValue(1, nodes);
243 spec = browser.sendGlobalCommand(
"Y");
244 int version = Integer.parseInt(spec);
246 spec =
new String(
"2.0");
247 }
else if (version == 4) {
248 spec =
new String(
"1.0");
250 spec =
new String(
"0.0");
258 spec = browser.sendGlobalCommand(
"Y");
259 return Integer.parseInt(spec);
276 myurl = browser.sendGlobalCommand(
"O");
283 return browser.getNode(nodeName);
288 return browser.getNode(nodeName);
293 StringTokenizer tokens;
298 if (nodeName == null) {
302 retval = browser.sendGlobalCommand(
"a " + nodeName);
304 if (retval.equals(
"")) {
307 tokens =
new StringTokenizer(retval);
309 newnode.setPerlPtr(tokens.nextToken());
310 newnode.setPointer(tokens.nextToken());
311 newnode.setType(FreeWRLFieldTypes.getIntType(
"h"));
318 StringTokenizer tokens;
323 if (protoName == null) {
327 retval = browser.sendGlobalCommand(
"b " + protoName);
328 if (retval.equals(
"")) {
331 tokens =
new StringTokenizer(retval);
333 proto.setPerlPtr(tokens.nextToken());
334 proto.setPointer(tokens.nextToken());
335 proto.setNodeName(protoName);
336 proto.setType(FreeWRLNodeTypes.X3DProtoInstance);
347 retval = browser.sendGlobalCommand(
"c " + nodeName +
" " + nodeRef);
349 if (retval.equals(
"1")) {
363 retval = browser.sendGlobalCommand(
"d " + nodeName);
365 if (retval.equals(
"1")) {
375 retval = browser.sendGlobalCommand(
"d " + nodeName);
377 if (retval.equals(
"1")) {
384 StringTokenizer tokens;
397 retval = browser.sendGlobalCommand(
"e " + protoName);
399 if (retval.equals(
"1")) {
405 tokens =
new StringTokenizer(retval);
407 dec.setProtoName(tokens.nextToken());
408 type = tokens.nextToken();
409 numFields = Integer.valueOf(tokens.nextToken()).intValue();
413 for (
int i = 0; i < numFields; i++) {
414 fieldAccess = tokens.nextToken();
415 fieldType = tokens.nextToken();
416 fieldName = tokens.nextToken();
417 ft = FreeWRLFieldTypes.getIntFromStringDesc(fieldType);
418 fa = FreeWRLFieldTypes.getAccessFromType(fieldAccess);
420 defaultValue = tokens.nextToken();
426 if (defaultValue.equals(
"[")) {
427 while(!temp.equals(
"]")) {
428 temp = tokens.nextToken();
429 defaultValue = defaultValue +
" " + temp;
433 if (defaultValue.charAt(0) == test) {
434 while(!temp.endsWith(tests)) {
435 temp = tokens.nextToken();
436 defaultValue = defaultValue +
" " + temp;
440 defs[i].setDefaultValue(defaultValue);
452 retval = browser.sendGlobalCommand(
"f " + protoName +
" " + newDeclaration);
453 System.out.println(
"sent: f " + protoName +
" " + newDeclaration);
455 if (retval.equals(
"1")) {
465 if (protoName == null) {
468 retval = browser.sendGlobalCommand(
"g " + protoName);
470 if (retval.equals(
"1")) {
480 updateProtoDeclaration(protoName, newDeclaration);
484 removeProtoDeclaration(protoName);
489 Object[] returnval = rNodes.toArray();
491 for (
int i = 0; i < rNodes.size(); i++)
498 Object[] returnval = routes.toArray();
500 for (
int i = 0; i < routes.size(); i++)
501 temp[i] = (
FWRoute) returnval[i];
510 System.out.println(
"retval: " + retval);
511 if (retval.equals(
"1")) {
526 index = routes.indexOf(route);
528 System.out.println(
"Route not present");
532 routes.remove(index);
534 browser.deleteRoute((
FreeWRLNode)(route.getSourceNode()), route.getSourceField(), (
FreeWRLNode)(route.getDestinationNode()), route.getDestinationField());
537 public void checkValid() {
543 public void dispose() {