1
2 package org.freehep.graphicsio.swf;
3
4 import java.io.IOException;
5 import java.util.Vector;
6
7 import org.freehep.util.io.Action;
8
9
10
11
12
13
14
15
16 public class ButtonCondAction {
17
18 private int condition;
19
20 private Vector actions;
21
22 public ButtonCondAction(int condition, Vector actions) {
23 this.condition = condition;
24 this.actions = actions;
25 }
26
27 public ButtonCondAction(SWFInputStream input) throws IOException {
28
29 condition = input.readUnsignedShort();
30
31 actions = new Vector();
32 Action action = input.readAction();
33 while (action != null) {
34 actions.add(action);
35 action = input.readAction();
36 }
37 }
38
39 public void write(SWFOutputStream swf) throws IOException {
40 swf.writeUnsignedShort(condition);
41
42 for (int i = 0; i < actions.size(); i++) {
43 Action a = (Action) actions.get(i);
44 swf.writeAction(a);
45 }
46 swf.writeAction(null);
47 }
48
49 public String toString() {
50 StringBuffer s = new StringBuffer();
51 s.append("ButtonCondAction " + condition + "\n");
52 s.append(" actions: " + actions.size() + "\n");
53 for (int i = 0; i < actions.size(); i++) {
54 s.append(" " + actions.get(i) + "\n");
55 }
56 return s.toString();
57 }
58 }