summaryrefslogtreecommitdiff
path: root/NET/worlds/console/AttributeSortPanel.java
blob: 318162645512e486c47b076b730412feb498dd52 (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import java.awt.Button;
/*     */ import java.awt.Color;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Event;
/*     */ import java.awt.Frame;
/*     */ import java.awt.GridBagConstraints;
/*     */ import java.awt.GridBagLayout;
/*     */ import java.awt.Label;
/*     */ import java.awt.Point;
/*     */ import java.awt.TextField;
/*     */ import java.awt.Window;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class AttributeSortPanel
/*     */   extends Frame
/*     */   implements MainCallback, MainTerminalCallback
/*     */ {
/*     */   private static final long serialVersionUID = -7230661745931320369L;
/*     */   private AttributeList list;
/*  35 */   private Button addButton = new Button("Add");
/*  36 */   private Button deleteButton = new Button("Delete");
/*  37 */   private Button moveUpButton = new Button("MoveUp");
/*  38 */   private Button moveDownButton = new Button("MoveDown");
/*  39 */   private Button okButton = new Button("Ok");
/*  40 */   private Button cancelButton = new Button("Cancel");
/*  41 */   private Button clearButton = new Button("Clear");
/*  42 */   private TextField attNameField = new TextField(32);
/*  43 */   private Label attNameLabel = new Label("Attribute Name: ");
/*     */   
/*     */   public AttributeSortPanel(Window parent) {
/*  46 */     super("Attribute Sorting");
/*     */     
/*  48 */     this.list = new AttributeList(10);
/*  49 */     GridBagLayout gbag = new GridBagLayout();
/*  50 */     GridBagConstraints c = new GridBagConstraints();
/*  51 */     setLayout(gbag);
/*  52 */     setBackground(Color.gray);
/*     */     
/*  54 */     c.gridx = 1;
/*  55 */     c.gridy = 1;
/*  56 */     c.gridheight = 7;
/*  57 */     c.gridwidth = 3;
/*  58 */     c.anchor = 18;
/*  59 */     gbag.setConstraints(this.list, c);
/*  60 */     add(this.list);
/*     */     
/*  62 */     c.gridx = 4;
/*  63 */     c.gridy = 1;
/*  64 */     c.gridwidth = 1;
/*  65 */     c.gridheight = 1;
/*  66 */     gbag.setConstraints(this.moveUpButton, c);
/*  67 */     add(this.moveUpButton);
/*     */     
/*  69 */     c.gridx = 4;
/*  70 */     c.gridy = 2;
/*  71 */     c.gridwidth = 1;
/*  72 */     c.gridheight = 1;
/*  73 */     gbag.setConstraints(this.moveDownButton, c);
/*  74 */     add(this.moveDownButton);
/*     */     
/*  76 */     c.gridx = 4;
/*  77 */     c.gridy = 5;
/*  78 */     c.gridheight = 1;
/*  79 */     c.gridwidth = 3;
/*  80 */     gbag.setConstraints(this.attNameLabel, c);
/*  81 */     add(this.attNameLabel);
/*     */     
/*  83 */     c.gridy = 6;
/*  84 */     c.gridheight = 1;
/*  85 */     c.gridwidth = 3;
/*  86 */     gbag.setConstraints(this.attNameField, c);
/*  87 */     add(this.attNameField);
/*     */     
/*  89 */     c.gridx = 7;
/*  90 */     c.gridy = 6;
/*  91 */     c.gridheight = 1;
/*  92 */     c.gridwidth = 1;
/*  93 */     gbag.setConstraints(this.addButton, c);
/*  94 */     add(this.addButton);
/*     */     
/*  96 */     c.gridx = 7;
/*  97 */     c.gridy = 1;
/*  98 */     c.gridwidth = 1;
/*  99 */     c.gridheight = 1;
/* 100 */     gbag.setConstraints(this.deleteButton, c);
/* 101 */     add(this.deleteButton);
/*     */     
/* 103 */     c.gridx = 7;
/* 104 */     c.gridy = 2;
/* 105 */     gbag.setConstraints(this.clearButton, c);
/* 106 */     add(this.clearButton);
/*     */     
/* 108 */     c.gridx = 5;
/* 109 */     c.gridy = 8;
/* 110 */     gbag.setConstraints(this.okButton, c);
/* 111 */     add(this.okButton);
/*     */     
/* 113 */     c.gridx = 7;
/* 114 */     gbag.setConstraints(this.cancelButton, c);
/* 115 */     add(this.cancelButton);
/*     */     
/*     */ 
/* 118 */     pack();
/* 119 */     Point loc = parent.getLocation();
/* 120 */     Dimension size = parent.getSize();
/* 121 */     setBounds(loc.x + (size.width - 512) / 2, 
/* 122 */       loc.y + (size.height - 240) / 2, 512, 240);
/*     */     
/* 124 */     setVisible(true);
/*     */     
/* 126 */     Main.register(this);
/*     */   }
/*     */   
/*     */   @Deprecated
/*     */   public boolean handleEvent(Event ev)
/*     */   {
/* 132 */     switch (ev.id) {
/*     */     case 201: 
/* 134 */       dispose();
/* 135 */       return true;
/*     */     }
/* 137 */     return super.handleEvent(ev);
/*     */   }
/*     */   
/*     */ 
/*     */   @Deprecated
/*     */   public boolean action(Event e, Object o)
/*     */   {
/* 144 */     if (e.target == this.addButton) {
/* 145 */       String attToAdd = this.attNameField.getText();
/* 146 */       if (attToAdd != "")
/* 147 */         this.list.add(attToAdd);
/* 148 */       this.attNameField.setText("");
/* 149 */       return true; }
/* 150 */     if (e.target == this.deleteButton) {
/* 151 */       this.list.remove(this.list.getSelectedIndex());
/* 152 */       return true; }
/* 153 */     if (e.target == this.moveUpButton) {
/* 154 */       int index = this.list.getSelectedIndex();
/* 155 */       if (index > 0) {
/* 156 */         String toPutBack = this.list.getItem(index - 1);
/* 157 */         this.list.remove(index - 1);
/* 158 */         this.list.add(toPutBack, index);
/*     */       }
/* 160 */       return true; }
/* 161 */     if (e.target == this.moveDownButton) {
/* 162 */       int index = this.list.getSelectedIndex();
/* 163 */       if (index < this.list.getItemCount()) {
/* 164 */         String toPutBack = this.list.getItem(index + 1);
/* 165 */         this.list.remove(index + 1);
/* 166 */         this.list.add(toPutBack, index);
/*     */       }
/* 168 */       return true; }
/* 169 */     if (e.target == this.cancelButton) {
/* 170 */       dispose();
/* 171 */       return true; }
/* 172 */     if (e.target == this.clearButton) {
/* 173 */       this.list.removeAll();
/* 174 */       return true; }
/* 175 */     if (e.target == this.okButton) {
/* 176 */       this.list.save();
/* 177 */       dispose();
/* 178 */       return true;
/*     */     }
/* 180 */     return false;
/*     */   }
/*     */   
/*     */ 
/*     */   public void mainCallback() {}
/*     */   
/*     */ 
/*     */   public void terminalCallback()
/*     */   {
/* 189 */     Main.unregister(this);
/*     */   }
/*     */ }


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