FreeWRL / FreeX3D 4.3.0
EventInMFString.java
1package vrml.external.field;
2import vrml.external.field.FieldTypes;
3import vrml.external.Browser;
4
5public class EventInMFString extends EventIn {
6 public EventInMFString() { EventType = FieldTypes.MFSTRING; }
7
8 public void setValue(String[] value) throws IllegalArgumentException {
9 int count;
10 String sestr;
11
12 // start off the return value with the number of elements:
13 sestr = "[";
14 for (count = 0; count < value.length; count++) {
15 if (value[count] == null) {
16 throw new IllegalArgumentException();
17 }
18 sestr = sestr+"\"" + value[count] + "\" ";
19 }
20 sestr = sestr + "]";
21 Browser.newSendEvent (this, sestr);
22 }
23
24 public void set1Value(int index, String value) throws IllegalArgumentException {
25 // send index, and -1, indicating that we don't know
26 // the total size of this array.
27 if ((value == null) || (index < 0)) {
28 throw new IllegalArgumentException();
29 }
30
31 Browser.newSendEvent(this, " ONEVAL " + index + " \"" + value + "\"");
32
33 }
34}