1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.widgets.buttongroups; |
17 | |
|
18 | |
import org.kuali.student.common.ui.client.application.Application; |
19 | |
import org.kuali.student.common.ui.client.application.ApplicationContext; |
20 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
21 | |
|
22 | |
|
23 | 0 | public class ButtonEnumerations { |
24 | |
public interface ButtonEnum{ |
25 | |
public String getText(); |
26 | |
public ButtonStyle getStyle(); |
27 | |
public ButtonEnum getActionType(); |
28 | |
public ButtonEnum getCancelType(); |
29 | |
}; |
30 | |
|
31 | 0 | final static ApplicationContext context = Application.getApplicationContext(); |
32 | |
|
33 | 0 | public static enum OkEnum implements ButtonEnum{Ok; |
34 | |
|
35 | |
@Override |
36 | |
public String getText() { |
37 | 0 | switch(this){ |
38 | |
case Ok: |
39 | 0 | return "Ok"; |
40 | |
} |
41 | 0 | return null; |
42 | |
} |
43 | |
|
44 | |
@Override |
45 | |
public ButtonStyle getStyle() { |
46 | 0 | return ButtonStyle.PRIMARY; |
47 | |
} |
48 | |
|
49 | |
@Override |
50 | |
public ButtonEnum getActionType() { |
51 | 0 | return Ok; |
52 | |
} |
53 | |
|
54 | |
@Override |
55 | |
public ButtonEnum getCancelType() { |
56 | 0 | return Ok; |
57 | |
} |
58 | |
|
59 | |
}; |
60 | |
|
61 | 0 | public static enum YesNoEnum implements ButtonEnum{YES, NO; |
62 | |
|
63 | |
@Override |
64 | |
public String getText() { |
65 | 0 | switch(this){ |
66 | |
case YES: |
67 | 0 | return context.getMessage("yes"); |
68 | |
case NO: |
69 | 0 | return context.getMessage("no"); |
70 | |
} |
71 | 0 | return null; |
72 | |
} |
73 | |
@Override |
74 | |
public ButtonStyle getStyle() { |
75 | 0 | return ButtonStyle.PRIMARY; |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public ButtonEnum getActionType() { |
80 | 0 | return YES; |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public ButtonEnum getCancelType() { |
85 | 0 | return NO; |
86 | |
} |
87 | |
}; |
88 | |
|
89 | 0 | public static enum ConfirmCancelEnum implements ButtonEnum{CONFIRM, CANCEL; |
90 | |
|
91 | |
@Override |
92 | |
public String getText() { |
93 | 0 | switch(this){ |
94 | |
case CONFIRM: |
95 | 0 | return context.getMessage("confirm"); |
96 | |
case CANCEL: |
97 | 0 | return context.getMessage("cancel"); |
98 | |
} |
99 | 0 | return null; |
100 | |
} |
101 | |
@Override |
102 | |
public ButtonStyle getStyle() { |
103 | 0 | switch(this){ |
104 | |
case CONFIRM: |
105 | 0 | return ButtonStyle.PRIMARY; |
106 | |
case CANCEL: |
107 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
108 | |
} |
109 | 0 | return ButtonStyle.PRIMARY; |
110 | |
} |
111 | |
@Override |
112 | |
public ButtonEnum getActionType() { |
113 | 0 | return CONFIRM; |
114 | |
} |
115 | |
@Override |
116 | |
public ButtonEnum getCancelType() { |
117 | 0 | return CANCEL; |
118 | |
} |
119 | |
}; |
120 | |
|
121 | 0 | public static enum YesNoCancelEnum implements ButtonEnum{YES, NO, CANCEL; |
122 | |
|
123 | |
@Override |
124 | |
public String getText() { |
125 | 0 | switch(this){ |
126 | |
case YES: |
127 | 0 | return context.getMessage("yes"); |
128 | |
case NO: |
129 | 0 | return context.getMessage("no"); |
130 | |
case CANCEL: |
131 | 0 | return context.getMessage("cancel"); |
132 | |
} |
133 | 0 | return null; |
134 | |
} |
135 | |
@Override |
136 | |
public ButtonStyle getStyle() { |
137 | 0 | switch(this){ |
138 | |
case CANCEL: |
139 | 0 | return ButtonStyle.ANCHOR_LARGE_CENTERED; |
140 | |
default: |
141 | 0 | return ButtonStyle.PRIMARY; |
142 | |
} |
143 | |
|
144 | |
} |
145 | |
@Override |
146 | |
public ButtonEnum getActionType() { |
147 | 0 | return YES; |
148 | |
} |
149 | |
|
150 | |
@Override |
151 | |
public ButtonEnum getCancelType() { |
152 | 0 | return NO; |
153 | |
} |
154 | |
}; |
155 | |
|
156 | 0 | public static enum AddModifyRemoveEnum implements ButtonEnum{ADD, MODIFY, REMOVE; |
157 | |
|
158 | |
@Override |
159 | |
public String getText() { |
160 | 0 | switch(this){ |
161 | |
case ADD: |
162 | 0 | return context.getMessage("add"); |
163 | |
case MODIFY: |
164 | 0 | return context.getMessage("modify"); |
165 | |
case REMOVE: |
166 | 0 | return context.getMessage("remove"); |
167 | |
} |
168 | 0 | return null; |
169 | |
} |
170 | |
@Override |
171 | |
public ButtonStyle getStyle() { |
172 | 0 | return ButtonStyle.PRIMARY; |
173 | |
} |
174 | |
@Override |
175 | |
public ButtonEnum getActionType() { |
176 | 0 | return null; |
177 | |
} |
178 | |
|
179 | |
@Override |
180 | |
public ButtonEnum getCancelType() { |
181 | 0 | return null; |
182 | |
} |
183 | |
}; |
184 | |
|
185 | 0 | public static enum SendCancelEnum implements ButtonEnum{SEND, CANCEL; |
186 | |
|
187 | |
@Override |
188 | |
public String getText() { |
189 | 0 | switch(this){ |
190 | |
case SEND: |
191 | 0 | return context.getMessage("send"); |
192 | |
case CANCEL: |
193 | 0 | return context.getMessage("cancel"); |
194 | |
} |
195 | 0 | return null; |
196 | |
} |
197 | |
@Override |
198 | |
public ButtonStyle getStyle() { |
199 | 0 | return ButtonStyle.PRIMARY; |
200 | |
} |
201 | |
@Override |
202 | |
public ButtonEnum getActionType() { |
203 | 0 | return SEND; |
204 | |
} |
205 | |
|
206 | |
@Override |
207 | |
public ButtonEnum getCancelType() { |
208 | 0 | return CANCEL; |
209 | |
} |
210 | |
}; |
211 | |
|
212 | 0 | public static enum GoCancelEnum implements ButtonEnum{GO, CANCEL; |
213 | |
|
214 | |
@Override |
215 | |
public String getText() { |
216 | 0 | switch(this){ |
217 | |
case GO: |
218 | 0 | return context.getMessage("go"); |
219 | |
case CANCEL: |
220 | 0 | return context.getMessage("cancel"); |
221 | |
} |
222 | 0 | return null; |
223 | |
} |
224 | |
@Override |
225 | |
public ButtonStyle getStyle() { |
226 | 0 | return ButtonStyle.PRIMARY; |
227 | |
} |
228 | |
@Override |
229 | |
public ButtonEnum getActionType() { |
230 | 0 | return GO; |
231 | |
} |
232 | |
|
233 | |
@Override |
234 | |
public ButtonEnum getCancelType() { |
235 | 0 | return CANCEL; |
236 | |
} |
237 | |
}; |
238 | |
|
239 | 0 | public static enum CreateCancelEnum implements ButtonEnum{CREATE, CANCEL; |
240 | |
|
241 | |
@Override |
242 | |
public String getText() { |
243 | 0 | switch(this){ |
244 | |
case CREATE: |
245 | 0 | return context.getMessage("create"); |
246 | |
case CANCEL: |
247 | 0 | return context.getMessage("cancel"); |
248 | |
} |
249 | 0 | return null; |
250 | |
} |
251 | |
@Override |
252 | |
public ButtonStyle getStyle() { |
253 | 0 | return ButtonStyle.PRIMARY; |
254 | |
} |
255 | |
@Override |
256 | |
public ButtonEnum getActionType() { |
257 | 0 | return CREATE; |
258 | |
} |
259 | |
|
260 | |
@Override |
261 | |
public ButtonEnum getCancelType() { |
262 | 0 | return CANCEL; |
263 | |
} |
264 | |
}; |
265 | |
|
266 | 0 | public static enum SearchCancelEnum implements ButtonEnum{SEARCH, CANCEL; |
267 | |
|
268 | |
@Override |
269 | |
public String getText() { |
270 | 0 | switch(this){ |
271 | |
case SEARCH: |
272 | 0 | return context.getMessage("search"); |
273 | |
case CANCEL: |
274 | 0 | return context.getMessage("cancel"); |
275 | |
} |
276 | 0 | return null; |
277 | |
} |
278 | |
@Override |
279 | |
public ButtonStyle getStyle() { |
280 | 0 | switch(this){ |
281 | |
case SEARCH: |
282 | 0 | return ButtonStyle.PRIMARY; |
283 | |
case CANCEL: |
284 | 0 | return ButtonStyle.ANCHOR_LARGE_CENTERED; |
285 | |
} |
286 | 0 | return ButtonStyle.PRIMARY; |
287 | |
} |
288 | |
@Override |
289 | |
public ButtonEnum getActionType() { |
290 | 0 | return SEARCH; |
291 | |
} |
292 | |
@Override |
293 | |
public ButtonEnum getCancelType() { |
294 | 0 | return CANCEL; |
295 | |
} |
296 | |
}; |
297 | |
|
298 | 0 | public static enum AddCancelEnum implements ButtonEnum{ADD, CANCEL; |
299 | |
|
300 | |
@Override |
301 | |
public String getText() { |
302 | 0 | switch(this){ |
303 | |
case ADD: |
304 | 0 | return context.getMessage("add"); |
305 | |
case CANCEL: |
306 | 0 | return context.getMessage("cancel"); |
307 | |
} |
308 | 0 | return null; |
309 | |
} |
310 | |
@Override |
311 | |
public ButtonStyle getStyle() { |
312 | 0 | switch(this){ |
313 | |
case ADD: |
314 | 0 | return ButtonStyle.PRIMARY; |
315 | |
case CANCEL: |
316 | 0 | return ButtonStyle.ANCHOR_LARGE_CENTERED; |
317 | |
} |
318 | 0 | return ButtonStyle.PRIMARY; |
319 | |
} |
320 | |
@Override |
321 | |
public ButtonEnum getActionType() { |
322 | 0 | return ADD; |
323 | |
} |
324 | |
@Override |
325 | |
public ButtonEnum getCancelType() { |
326 | 0 | return CANCEL; |
327 | |
} |
328 | |
}; |
329 | |
|
330 | 0 | public static enum UpdateCancelEnum implements ButtonEnum{UPDATE, CANCEL; |
331 | |
|
332 | |
@Override |
333 | |
public String getText() { |
334 | 0 | switch(this){ |
335 | |
case UPDATE: |
336 | 0 | return context.getMessage("update"); |
337 | |
case CANCEL: |
338 | 0 | return context.getMessage("cancel"); |
339 | |
} |
340 | 0 | return null; |
341 | |
} |
342 | |
@Override |
343 | |
public ButtonStyle getStyle() { |
344 | 0 | switch(this){ |
345 | |
case UPDATE: |
346 | 0 | return ButtonStyle.PRIMARY; |
347 | |
case CANCEL: |
348 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
349 | |
} |
350 | 0 | return ButtonStyle.PRIMARY; |
351 | |
} |
352 | |
@Override |
353 | |
public ButtonEnum getActionType() { |
354 | 0 | return UPDATE; |
355 | |
} |
356 | |
@Override |
357 | |
public ButtonEnum getCancelType() { |
358 | 0 | return CANCEL; |
359 | |
} |
360 | |
}; |
361 | |
|
362 | 0 | public static enum ContinueCancelEnum implements ButtonEnum{CONTINUE, CANCEL; |
363 | |
|
364 | |
@Override |
365 | |
public String getText() { |
366 | 0 | switch(this){ |
367 | |
case CONTINUE: |
368 | 0 | return context.getMessage("continue"); |
369 | |
case CANCEL: |
370 | 0 | return context.getMessage("cancel"); |
371 | |
} |
372 | 0 | return null; |
373 | |
} |
374 | |
@Override |
375 | |
public ButtonStyle getStyle() { |
376 | 0 | switch(this){ |
377 | |
case CONTINUE: |
378 | 0 | return ButtonStyle.PRIMARY; |
379 | |
case CANCEL: |
380 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
381 | |
} |
382 | 0 | return ButtonStyle.PRIMARY; |
383 | |
} |
384 | |
@Override |
385 | |
public ButtonEnum getActionType() { |
386 | 0 | return CONTINUE; |
387 | |
} |
388 | |
@Override |
389 | |
public ButtonEnum getCancelType() { |
390 | 0 | return CANCEL; |
391 | |
} |
392 | |
}; |
393 | |
|
394 | 0 | public static enum SaveCancelEnum implements ButtonEnum{SAVE, CANCEL; |
395 | |
|
396 | |
@Override |
397 | |
public String getText() { |
398 | 0 | switch(this){ |
399 | |
case SAVE: |
400 | 0 | return context.getMessage("save"); |
401 | |
case CANCEL: |
402 | 0 | return context.getMessage("cancel"); |
403 | |
} |
404 | 0 | return null; |
405 | |
} |
406 | |
@Override |
407 | |
public ButtonStyle getStyle() { |
408 | 0 | switch(this){ |
409 | |
case SAVE: |
410 | 0 | return ButtonStyle.PRIMARY; |
411 | |
case CANCEL: |
412 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
413 | |
} |
414 | 0 | return ButtonStyle.PRIMARY; |
415 | |
} |
416 | |
@Override |
417 | |
public ButtonEnum getActionType() { |
418 | 0 | return SAVE; |
419 | |
} |
420 | |
@Override |
421 | |
public ButtonEnum getCancelType() { |
422 | 0 | return CANCEL; |
423 | |
} |
424 | |
}; |
425 | |
|
426 | 0 | public static enum SaveContinueCancelEnum implements ButtonEnum{SAVE_CONTINUE, CANCEL; |
427 | |
|
428 | |
@Override |
429 | |
public String getText() { |
430 | 0 | switch(this){ |
431 | |
case SAVE_CONTINUE: |
432 | 0 | return context.getMessage("saveContinue"); |
433 | |
case CANCEL: |
434 | 0 | return context.getMessage("cancel"); |
435 | |
} |
436 | 0 | return null; |
437 | |
} |
438 | |
@Override |
439 | |
public ButtonStyle getStyle() { |
440 | 0 | switch(this){ |
441 | |
case SAVE_CONTINUE: |
442 | 0 | return ButtonStyle.PRIMARY; |
443 | |
case CANCEL: |
444 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
445 | |
} |
446 | 0 | return ButtonStyle.PRIMARY; |
447 | |
} |
448 | |
@Override |
449 | |
public ButtonEnum getActionType() { |
450 | 0 | return SAVE_CONTINUE; |
451 | |
} |
452 | |
@Override |
453 | |
public ButtonEnum getCancelType() { |
454 | 0 | return CANCEL; |
455 | |
} |
456 | |
}; |
457 | |
|
458 | 0 | public static enum ConfirmApprovalCancelEnum implements ButtonEnum{CONFIRM, CANCEL; |
459 | |
|
460 | |
@Override |
461 | |
public String getText() { |
462 | 0 | switch(this){ |
463 | |
case CONFIRM: |
464 | 0 | return context.getMessage("confirmApproval"); |
465 | |
case CANCEL: |
466 | 0 | return context.getMessage("cancel"); |
467 | |
} |
468 | 0 | return null; |
469 | |
} |
470 | |
@Override |
471 | |
public ButtonStyle getStyle() { |
472 | 0 | switch(this){ |
473 | |
case CONFIRM: |
474 | 0 | return ButtonStyle.PRIMARY; |
475 | |
case CANCEL: |
476 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
477 | |
} |
478 | 0 | return ButtonStyle.PRIMARY; |
479 | |
} |
480 | |
@Override |
481 | |
public ButtonEnum getActionType() { |
482 | 0 | return CONFIRM; |
483 | |
} |
484 | |
@Override |
485 | |
public ButtonEnum getCancelType() { |
486 | 0 | return CANCEL; |
487 | |
} |
488 | |
}; |
489 | |
|
490 | 0 | public static enum AcknowledgeCancelEnum implements ButtonEnum{ACKNOWLEDGE, CANCEL; |
491 | |
|
492 | |
@Override |
493 | |
public String getText() { |
494 | 0 | switch(this){ |
495 | |
case ACKNOWLEDGE: |
496 | 0 | return context.getMessage("acknowledge"); |
497 | |
case CANCEL: |
498 | 0 | return context.getMessage("cancel"); |
499 | |
} |
500 | 0 | return null; |
501 | |
} |
502 | |
@Override |
503 | |
public ButtonStyle getStyle() { |
504 | 0 | switch(this){ |
505 | |
case ACKNOWLEDGE: |
506 | 0 | return ButtonStyle.PRIMARY; |
507 | |
case CANCEL: |
508 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
509 | |
} |
510 | 0 | return ButtonStyle.PRIMARY; |
511 | |
} |
512 | |
@Override |
513 | |
public ButtonEnum getActionType() { |
514 | 0 | return ACKNOWLEDGE; |
515 | |
} |
516 | |
@Override |
517 | |
public ButtonEnum getCancelType() { |
518 | 0 | return CANCEL; |
519 | |
} |
520 | |
}; |
521 | |
|
522 | 0 | public static enum RejectCancelEnum implements ButtonEnum{REJECT, CANCEL; |
523 | |
|
524 | |
@Override |
525 | |
public String getText() { |
526 | 0 | switch(this){ |
527 | |
case REJECT: |
528 | 0 | return context.getMessage("reject"); |
529 | |
case CANCEL: |
530 | 0 | return context.getMessage("cancel"); |
531 | |
} |
532 | 0 | return null; |
533 | |
} |
534 | |
@Override |
535 | |
public ButtonStyle getStyle() { |
536 | 0 | switch(this){ |
537 | |
case REJECT: |
538 | 0 | return ButtonStyle.PRIMARY; |
539 | |
case CANCEL: |
540 | 0 | return ButtonStyle.DEFAULT_ANCHOR; |
541 | |
} |
542 | 0 | return ButtonStyle.PRIMARY; |
543 | |
} |
544 | |
@Override |
545 | |
public ButtonEnum getActionType() { |
546 | 0 | return REJECT; |
547 | |
} |
548 | |
@Override |
549 | |
public ButtonEnum getCancelType() { |
550 | 0 | return CANCEL; |
551 | |
} |
552 | |
}; |
553 | |
} |