summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WebWallControlAction.java
blob: dac96118b500ea7583e939a0bb66d36affbad6d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import NET.worlds.console.WebControlImp;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class WebWallControlAction
/*     */   extends Action
/*     */ {
/*     */   WebWallControlAction()
/*     */   {
/*  16 */     this.mode = 1;
/*  17 */     this.webWall = null;
/*  18 */     this.postData = null;
/*  19 */     this.url = "http://www.worlds.com/";
/*     */   }
/*     */   
/*     */ 
/*  23 */   private final int reload = 1;
/*  24 */   private final int setURL = 2;
/*  25 */   private final int refresh = 3;
/*  26 */   private final int back = 4;
/*  27 */   private final int forward = 5;
/*  28 */   private final int stop = 6;
/*  29 */   private final int home = 7;
/*     */   private int mode;
/*     */   private String url;
/*     */   private String postData;
/*     */   private WebPageWall webWall;
/*     */   
/*     */   public Persister trigger(Event e, Persister seqID) {
/*  36 */     if (!getWebWall())
/*     */     {
/*  38 */       System.out.println("ERROR! Tried to attach WebWallControlAction to something other than a WebWall object.");
/*     */       
/*  40 */       return null;
/*     */     }
/*     */     
/*  43 */     switch (this.mode)
/*     */     {
/*     */     case 1: 
/*  46 */       this.webWall.rebuild();
/*  47 */       break;
/*     */     
/*     */     case 2: 
/*  50 */       this.webWall.getWebControlImp().setURL(this.url, this.postData);
/*  51 */       break;
/*     */     
/*     */     case 3: 
/*  54 */       this.webWall.getWebControlImp().refresh();
/*  55 */       break;
/*     */     
/*     */     case 4: 
/*  58 */       this.webWall.getWebControlImp().goBack();
/*  59 */       break;
/*     */     
/*     */     case 5: 
/*  62 */       this.webWall.getWebControlImp().goForward();
/*  63 */       break;
/*     */     
/*     */     case 6: 
/*  66 */       this.webWall.getWebControlImp().stop();
/*  67 */       break;
/*     */     
/*     */     case 7: 
/*  70 */       this.webWall.getWebControlImp().home();
/*     */     }
/*     */     
/*     */     
/*  74 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */   private boolean getWebWall()
/*     */   {
/*  80 */     if (this.webWall != null) {
/*  81 */       return true;
/*     */     }
/*     */     
/*     */ 
/*  85 */     Object owner = getOwner();
/*  86 */     if ((owner == null) || (!(owner instanceof WebPageWall))) {
/*  87 */       return false;
/*     */     }
/*  89 */     this.webWall = ((WebPageWall)owner);
/*     */     
/*  91 */     if (this.webWall == null)
/*     */     {
/*  93 */       return false;
/*     */     }
/*     */     
/*  96 */     if (this.webWall.getWebControlImp() == null) {
/*  97 */       return false;
/*     */     }
/*  99 */     return true;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/* 104 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/* 108 */     s.saveVersion(0, classCookie);
/* 109 */     super.saveState(s);
/* 110 */     s.saveInt(this.mode);
/* 111 */     s.saveString(this.url);
/* 112 */     s.saveString(this.postData);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 117 */     switch (r.restoreVersion(classCookie))
/*     */     {
/*     */     case 0: 
/* 120 */       super.restoreState(r);
/* 121 */       this.mode = r.restoreInt();
/* 122 */       this.url = r.restoreString();
/* 123 */       this.postData = r.restoreString();
/*     */     }
/*     */     
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int pmode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/* 134 */     Object ret = null;
/* 135 */     switch (index - offset) {
/*     */     case 0: 
/* 137 */       if (pmode == 0) {
/* 138 */         ret = IntegerPropertyEditor.make(
/* 139 */           new Property(this, index, "1=Reload, 2=SetURL, 3=Refresh, 4=Back, 5=Fwd, 6=Stop, 7=Home"));
/*     */       }
/* 141 */       else if (pmode == 1) {
/* 142 */         ret = new Integer(this.mode);
/* 143 */       } else if (pmode == 2)
/* 144 */         this.mode = ((Integer)value).intValue();
/* 145 */       break;
/*     */     
/*     */     case 1: 
/* 148 */       if (pmode == 0) {
/* 149 */         ret = StringPropertyEditor.make(new Property(this, 
/* 150 */           index, 
/* 151 */           "URL for mode 2"));
/* 152 */       } else if (pmode == 1) {
/* 153 */         ret = this.url;
/* 154 */       } else if (pmode == 2)
/* 155 */         this.url = ((String)value).trim();
/* 156 */       break;
/*     */     
/*     */     case 2: 
/* 159 */       if (pmode == 0) {
/* 160 */         ret = StringPropertyEditor.make(new Property(this, 
/* 161 */           index, 
/* 162 */           "POST data for mode 2"));
/* 163 */       } else if (pmode == 1) {
/* 164 */         ret = this.postData;
/* 165 */       } else if (pmode == 2)
/* 166 */         this.postData = ((String)value).trim();
/* 167 */       break;
/*     */     
/*     */     default: 
/* 170 */       ret = super.properties(index, offset + 3, pmode, value);
/*     */     }
/* 172 */     return ret;
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WebWallControlAction.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */