summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/OpenURLAction.java
blob: 6b58e330b618b9c153cb5ba001fd5811967a93ec (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
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import NET.worlds.console.Console;
/*     */ import NET.worlds.console.DefaultConsole;
/*     */ import NET.worlds.console.NoWebControlException;
/*     */ import NET.worlds.console.WebControl;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class OpenURLAction
/*     */   extends Action
/*     */ {
/*  29 */   String targetURL = "http://www.worlds.com";
/*  30 */   int xPercent = 100;
/*  31 */   int yPercent = 100;
/*  32 */   boolean hasToolbar = true;
/*  33 */   boolean isFixed = false;
/*     */   
/*     */ 
/*     */ 
/*     */   public Persister trigger(Event e, Persister seqID)
/*     */   {
/*  39 */     if (seqID != null)
/*     */     {
/*     */ 
/*  42 */       return seqID;
/*     */     }
/*     */     
/*  45 */     Console c = Console.getActive();
/*  46 */     if ((c != null) && ((c instanceof DefaultConsole)))
/*     */     {
/*  48 */       System.out.println("Opening up a URL now.");
/*     */       
/*  50 */       DefaultConsole dc = (DefaultConsole)c;
/*     */       try {
/*  52 */         WebControl wc = new WebControl(dc.getRender(), 
/*  53 */           this.xPercent, this.yPercent, this.hasToolbar, this.isFixed, 
/*  54 */           false);
/*  55 */         wc.activate();
/*  56 */         wc.setURL(this.targetURL);
/*     */       }
/*     */       catch (NoWebControlException localNoWebControlException) {}
/*     */       
/*     */ 
/*     */ 
/*     */ 
/*  63 */       seqID = new SuperRoot();
/*  64 */       return this;
/*     */     }
/*     */     
/*     */ 
/*     */ 
/*  69 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int mode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/*  79 */     Object ret = null;
/*  80 */     switch (index - offset) {
/*     */     case 0: 
/*  82 */       if (mode == 0) {
/*  83 */         ret = StringPropertyEditor.make(
/*  84 */           new Property(this, index, "Target URL"));
/*  85 */       } else if (mode == 1) {
/*  86 */         ret = this.targetURL;
/*  87 */       } else if (mode == 2)
/*  88 */         this.targetURL = ((String)value);
/*  89 */       break;
/*     */     case 1: 
/*  91 */       if (mode == 0) {
/*  92 */         ret = IntegerPropertyEditor.make(
/*  93 */           new Property(this, index, "X Overlay % or Width"), 
/*  94 */           0, 1024);
/*  95 */       } else if (mode == 1) {
/*  96 */         ret = new Integer(this.xPercent);
/*  97 */       } else if (mode == 2)
/*  98 */         this.xPercent = ((Integer)value).intValue();
/*  99 */       break;
/*     */     case 2: 
/* 101 */       if (mode == 0) {
/* 102 */         ret = IntegerPropertyEditor.make(
/* 103 */           new Property(this, index, "Y Overlay % or Height"), 
/* 104 */           0, 1024);
/* 105 */       } else if (mode == 1) {
/* 106 */         ret = new Integer(this.yPercent);
/* 107 */       } else if (mode == 2)
/* 108 */         this.yPercent = ((Integer)value).intValue();
/* 109 */       break;
/*     */     case 3: 
/* 111 */       if (mode == 0) {
/* 112 */         ret = BooleanPropertyEditor.make(
/* 113 */           new Property(this, index, "Has Toolbar"), 
/* 114 */           "No", "Yes");
/* 115 */       } else if (mode == 1) {
/* 116 */         ret = new Boolean(this.hasToolbar);
/* 117 */       } else if (mode == 2)
/* 118 */         this.hasToolbar = ((Boolean)value).booleanValue();
/* 119 */       break;
/*     */     case 4: 
/* 121 */       if (mode == 0) {
/* 122 */         ret = BooleanPropertyEditor.make(
/* 123 */           new Property(this, index, "Fixed size"), 
/* 124 */           "No - Percentage specified", "Yes - Pixels specified");
/* 125 */       } else if (mode == 1) {
/* 126 */         ret = new Boolean(this.isFixed);
/* 127 */       } else if (mode == 2)
/* 128 */         this.isFixed = ((Boolean)value).booleanValue();
/* 129 */       break;
/*     */     default: 
/* 131 */       ret = super.properties(index, offset + 4, mode, value);
/*     */     }
/*     */     
/* 134 */     return ret;
/*     */   }
/*     */   
/*     */ 
/* 138 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/* 142 */     s.saveVersion(0, classCookie);
/* 143 */     super.saveState(s);
/*     */     
/* 145 */     s.saveString(this.targetURL);
/* 146 */     s.saveInt(this.xPercent);
/* 147 */     s.saveInt(this.yPercent);
/* 148 */     s.saveBoolean(this.hasToolbar);
/* 149 */     s.saveBoolean(this.isFixed);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 154 */     switch (r.restoreVersion(classCookie)) {
/*     */     case 0: 
/* 156 */       super.restoreState(r);
/* 157 */       this.targetURL = r.restoreString();
/* 158 */       this.xPercent = r.restoreInt();
/* 159 */       this.yPercent = r.restoreInt();
/* 160 */       this.hasToolbar = r.restoreBoolean();
/* 161 */       this.isFixed = r.restoreBoolean();
/* 162 */       break;
/*     */     
/*     */     default: 
/* 165 */       throw new TooNewException();
/*     */     }
/*     */   }
/*     */ }


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