FreeWRL/FreeX3D  3.0.0
FWJavaScriptBinding.java
1 package vrml;
2 import vrml.FWJavaScript;
3 //JAS import java.io.IOException;
4 
5 public class FWJavaScriptBinding {
6  BaseNode node;
7  String fieldName;
8  String lastUpdate;
9  boolean doUpdateRead;
10 
11  public FWJavaScriptBinding(BaseNode n, String f) {
12  this(n,f,true);
13  }
14 
15  public FWJavaScriptBinding(BaseNode n, String f, boolean u) {
16  node = n; fieldName = f;
17  doUpdateRead = u;
18  }
19  public BaseNode node() {return node;}
20  public String field() {return fieldName;}
21 
22  public void updateRead(Field field) {
23  if (!doUpdateRead || lastUpdate == FWJavaScript.reqid)
24  return;
25  FWJavaScript.readField(node, fieldName, field);
26  lastUpdate = FWJavaScript.reqid;
27  }
28 
29  public void updateWrite(Field field) {
30  FWJavaScript.add_touched(field);
31  lastUpdate = FWJavaScript.reqid;
32  }
33 
34  public String toString() {
35  return node._get_nodeid()+"."+fieldName;
36  }
37 }