summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/SwitchableBehavior.java
blob: 774e17de52b2cd17ee0496e6d3c58877f583e8d5 (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
/*    */ package NET.worlds.scape;
/*    */ 
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class SwitchableBehavior
/*    */   extends SuperRoot
/*    */ {
/* 22 */   protected boolean enabled = true;
/* 23 */   public boolean getEnabled() { return this.enabled; }
/*    */   
/*    */   public SwitchableBehavior setEnabled(boolean s)
/*    */   {
/* 27 */     this.enabled = s;
/* 28 */     return this;
/*    */   }
/*    */   
/*    */   public SwitchableBehavior toggleEnabled()
/*    */   {
/* 33 */     setEnabled(!getEnabled());
/* 34 */     return this;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public Object properties(int index, int offset, int mode, Object value)
/*    */     throws NoSuchPropertyException
/*    */   {
/* 43 */     Object ret = null;
/* 44 */     switch (index - offset) {
/*    */     case 0: 
/* 46 */       if (mode == 0) {
/* 47 */         ret = BooleanPropertyEditor.make(
/* 48 */           new Property(this, index, "Enabled"), 
/* 49 */           "No", "Yes");
/* 50 */       } else if (mode == 1) {
/* 51 */         ret = new Boolean(this.enabled);
/* 52 */       } else if (mode == 2)
/* 53 */         this.enabled = ((Boolean)value).booleanValue();
/* 54 */       break;
/*    */     default: 
/* 56 */       ret = super.properties(index, offset + 1, mode, value);
/*    */     }
/* 58 */     return ret;
/*    */   }
/*    */   
/* 61 */   private static Object classCookie = new Object();
/*    */   
/*    */   public void saveState(Saver s)
/*    */     throws IOException
/*    */   {
/* 66 */     s.saveVersion(1, classCookie);
/* 67 */     super.saveState(s);
/* 68 */     s.saveBoolean(this.enabled);
/*    */   }
/*    */   
/*    */   public void restoreState(Restorer r)
/*    */     throws IOException, TooNewException
/*    */   {
/* 74 */     switch (r.restoreVersion(classCookie)) {
/*    */     case 1: 
/* 76 */       super.restoreState(r);
/*    */     case 0: 
/* 78 */       this.enabled = r.restoreBoolean();
/* 79 */       break;
/*    */     default: 
/* 81 */       throw new TooNewException();
/*    */     }
/*    */   }
/*    */ }


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