summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/PrintAction.java
blob: e35e8423795a83d41afa676eb87347beae01fee5 (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
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import NET.worlds.console.Console;
/*     */ import java.io.IOException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class PrintAction
/*     */   extends Action
/*     */ {
/*  21 */   String txt = null;
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public PrintAction() {}
/*     */   
/*     */ 
/*     */ 
/*     */   public PrintAction(String text)
/*     */   {
/*  32 */     this.txt = text;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Persister trigger(Event arg, Persister seqID)
/*     */   {
/*  41 */     String msg = this.txt;
/*     */     
/*  43 */     if (msg == null) {
/*  44 */       msg = getName() + "Has-no-text";
/*     */     }
/*  46 */     Console.println(msg);
/*     */     
/*  48 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int mode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/*  59 */     Object ret = null;
/*  60 */     switch (index - offset) {
/*     */     case 0: 
/*  62 */       if (mode == 0) {
/*  63 */         ret = StringPropertyEditor.make(new Property(this, index, 
/*  64 */           "Text Out"));
/*  65 */       } else if (mode == 1) {
/*  66 */         ret = this.txt;
/*  67 */       } else if (mode == 2)
/*  68 */         this.txt = ((String)value);
/*  69 */       break;
/*     */     default: 
/*  71 */       ret = super.properties(index, offset + 1, mode, value);
/*     */     }
/*  73 */     return ret;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  80 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/*  84 */     s.saveVersion(0, classCookie);
/*  85 */     super.saveState(s);
/*  86 */     s.saveString(this.txt);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r)
/*     */     throws IOException, TooNewException
/*     */   {
/*  92 */     switch (r.restoreVersion(classCookie)) {
/*     */     case 0: 
/*  94 */       super.restoreState(r);
/*  95 */       this.txt = r.restoreString();
/*  96 */       break;
/*     */     default: 
/*  98 */       throw new TooNewException();
/*     */     }
/*     */     
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public String toString()
/*     */   {
/* 108 */     return super.toString() + "[" + this.txt + "]";
/*     */   }
/*     */ }


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