01: /*
02: * Project: AMODA - Abstract Modeled Application
03: * Class: de.gulden.framework.amoda.generic.option.GenericOptionChoice
04: * Version: snapshot-beautyj-1.1
05: *
06: * Date: 2004-09-29
07: *
08: * This is a snapshot version of the AMODA 0.2 development branch,
09: * it is not released as a seperate version.
10: * For AMODA, see http://amoda.berlios.de/.
11: *
12: * This is licensed under the GNU Lesser General Public License (LGPL)
13: * and comes with NO WARRANTY.
14: *
15: * Author: Jens Gulden
16: * Email: amoda@jensgulden.de
17: */
18:
19: package de.gulden.framework.amoda.generic.option;
20:
21: import de.gulden.framework.amoda.generic.data.*;
22: import de.gulden.framework.amoda.model.data.*;
23: import de.gulden.framework.amoda.model.option.*;
24: import de.gulden.framework.amoda.model.option.OptionChoice;
25: import java.lang.*;
26: import java.util.*;
27:
28: /**
29: * Class GenericOptionChoice.
30: *
31: * @author Jens Gulden
32: * @version snapshot-beautyj-1.1
33: */
34: public class GenericOptionChoice extends GenericOptions implements
35: OptionChoice {
36:
37: // ------------------------------------------------------------------------
38: // --- constructor ---
39: // ------------------------------------------------------------------------
40:
41: public GenericOptionChoice() {
42: // your code here
43: }
44:
45: // ------------------------------------------------------------------------
46: // --- methods ---
47: // ------------------------------------------------------------------------
48:
49: public OptionEntry getSelectedOption() {
50: for (Iterator it = getEntries().values().iterator(); it
51: .hasNext();) {
52: OptionEntry o = (OptionEntry) it.next();
53: if (o.getValue().getBoolean() == true) {
54: return o;
55: }
56: }
57: return null;
58: }
59:
60: public String getSelectedId() {
61: OptionEntry o = getSelectedOption();
62: if (o != null) {
63: return o.getId();
64: } else {
65: return null;
66: }
67: }
68:
69: public Value getValue() {
70: // your code here
71: return null;
72: }
73:
74: public Value getValue(int state) {
75: // your code here
76: return null;
77: }
78:
79: public Class getType() {
80: throw new AbstractMethodError(
81: "getType() is not available on GenericOptionChoice");
82: }
83:
84: public String findTitle() {
85: return de.gulden.framework.amoda.generic.metadata.GenericMetadata
86: .findTitle(this ); // restoreoriginal implementation
87: }
88:
89: } // end GenericOptionChoice
|