summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/LibraryEntry.java
blob: 8002335eae11d2d98d254272fbecc24219ca0378 (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
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import NET.worlds.network.URL;
/*     */ import java.io.IOException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class LibraryEntry
/*     */   extends SuperRoot
/*     */   implements Iconic
/*     */ {
/*     */   protected URL iconURL;
/*     */   protected URL contentURL;
/*     */   protected String propertyName;
/*     */   
/*     */   public LibraryEntry() {}
/*     */   
/*     */   public LibraryEntry(String name, URL iconURL)
/*     */   {
/*  37 */     setName(name);
/*  38 */     this.iconURL = iconURL;
/*     */   }
/*     */   
/*     */   private void changed()
/*     */   {
/*  43 */     Library owner = (Library)getOwner();
/*  44 */     if (owner != null)
/*  45 */       owner.entryChanged(this);
/*     */   }
/*     */   
/*  48 */   public String getIconCaption() { return getName(); }
/*  49 */   public URL getIconURL() { return this.iconURL; }
/*  50 */   public URL getContentURL() { return this.contentURL; }
/*     */   
/*     */   public String getPropertyName(boolean checkParent)
/*     */   {
/*     */     Library owner;
/*  55 */     if ((this.propertyName == null) && (checkParent) && 
/*  56 */       ((owner = (Library)getOwner()) != null))
/*  57 */       return owner.getPropertyName();
/*  58 */     return this.propertyName;
/*     */   }
/*     */   
/*  61 */   public void setName(String s) { super.setName(s);changed(); }
/*  62 */   public void setIconURL(URL s) { this.iconURL = s;changed(); }
/*  63 */   public void setContentURL(URL s) { this.contentURL = s;changed(); }
/*  64 */   public void setPropertyName(String s) { this.propertyName = s;changed();
/*     */   }
/*     */   
/*     */   public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException
/*     */   {
/*  69 */     Object ret = null;
/*  70 */     switch (index - offset) {
/*     */     case 0: 
/*  72 */       if (mode == 0) {
/*  73 */         ret = URLPropertyEditor.make(
/*  74 */           new Property(this, index, "Icon").allowSetNull(), 
/*  75 */           TextureDecoder.getJavaExts());
/*  76 */       } else if (mode == 1) {
/*  77 */         ret = getIconURL();
/*  78 */       } else if (mode == 2)
/*  79 */         setIconURL((URL)value);
/*  80 */       break;
/*     */     case 1: 
/*  82 */       if (mode == 0) {
/*  83 */         ret = URLPropertyEditor.make(
/*  84 */           new Property(this, index, "Content URL").allowSetNull(), 
/*  85 */           "*wob");
/*  86 */       } else if (mode == 1) {
/*  87 */         ret = this.contentURL;
/*  88 */       } else if (mode == 2)
/*  89 */         setContentURL((URL)value);
/*  90 */       break;
/*     */     case 2: 
/*  92 */       if (mode == 0) {
/*  93 */         ret = StringPropertyEditor.make(
/*  94 */           new Property(this, index, "Property Name")
/*  95 */           .allowSetNull());
/*  96 */       } else if (mode == 1) {
/*  97 */         ret = getPropertyName(false);
/*  98 */       } else if (mode == 2)
/*  99 */         setPropertyName((String)value);
/* 100 */       break;
/*     */     default: 
/* 102 */       ret = super.properties(index, offset + 3, mode, value);
/*     */     }
/* 104 */     return ret;
/*     */   }
/*     */   
/* 107 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/* 111 */     s.saveVersion(3, classCookie);
/* 112 */     super.saveState(s);
/* 113 */     URL.save(s, this.iconURL);
/* 114 */     URL.save(s, this.contentURL);
/* 115 */     s.saveString(this.propertyName);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 120 */     switch (r.restoreVersion(classCookie)) {
/*     */     case 3: 
/* 122 */       super.restoreState(r);
/* 123 */       this.iconURL = URL.restore(r);
/* 124 */       this.contentURL = URL.restore(r);
/* 125 */       this.propertyName = r.restoreString();
/* 126 */       break;
/*     */     case 2: 
/* 128 */       super.restoreState(r);
/* 129 */       setName(r.restoreString());
/* 130 */       this.iconURL = URL.restore(r);
/* 131 */       this.contentURL = URL.restore(r);
/* 132 */       break;
/*     */     case 1: 
/* 134 */       super.restoreState(r);
/*     */     case 0: 
/* 136 */       setName(r.restoreString());
/* 137 */       this.iconURL = URL.restore(r);
/* 138 */       this.contentURL = URL.restore(r);
/* 139 */       r.restoreMaybeNull();
/* 140 */       break;
/*     */     default: 
/* 142 */       throw new TooNewException();
/*     */     }
/*     */   }
/*     */ }


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