Source code: com/openwave/oui/waomelements/PickerCard.java
1 package com.openwave.oui.waomelements;
2
3 import com.openwave.oui.framework.*;
4 import com.sun.java.util.collections.*;
5
6 /**
7 * There are cases where users should set a variable with one single click and then move on.
8 * While this is similar to what both Menus and Pickers achieve, those two objects don't really
9 * maximize usability in a cross-browser fashion for this specific case. The PickerCard object is a
10 * special object that achieves that.<br/>
11 * Creation date: (4/4/2001 12:57:36 PM)
12 * @author: Lars Gunder Knudsen
13 */
14 public class PickerCard extends AbsCard {
15 protected String varName = null;
16 protected String nextCardURL = null;
17 protected String softkeyLabel = null;
18 protected String text = null;
19 Paragraph currentParagraph = null;
20 boolean isInParagraph = false;
21
22 private final static long serialVersionUID = -8272982501469520657L;
23 /**
24 * Insert the method's description here.
25 * Creation date: (4/4/2001 2:00:59 PM)
26 */
27 public String getId() {
28 return getIdValue();
29 }
30 /**
31 * Sets card ID.
32 * Creation date: (4/4/2001 2:00:59 PM)
33 * @param id Card ID
34 */
35 public void setId(String id) {
36 setIdValue(id);
37 }
38
39
40 /**
41 * PickerCard constructor.
42 * @param id Card ID
43 * @param varName name of the variable that will be set
44 * @param nextCardURL card to move to after the selection is made
45 * @param softkeyLabel label of the softkey on UP.Browser (also used on Nokia 7110)
46 * @param text accompanying text
47 */
48 public PickerCard(
49 String id,
50 String title,
51 String varName,
52 String nextCardURL,
53 String softkeyLabel,
54 String text) {
55 super();
56 //waomElementName = "PickerCard";
57 setWaomElementName("PickerCard");
58 setIdValue(id);
59 setTitle(title);
60 this.varName = varName;
61 this.nextCardURL = nextCardURL;
62 this.softkeyLabel = softkeyLabel;
63 this.text = text;
64 }
65
66
67 /**
68 * Possible values of the associated variable and accompanying text.
69 *
70 */
71 public void addEntry(String value, String text) {
72 super.addElement(new Option(value, null, null, text));
73 }
74
75
76 /**
77 * Possible values of the associated variable and accompanying text.
78 *
79 */
80 public void addEntry(String value, String text, String onpick, String title) {
81 super.addElement(new Option(value, title, onpick, text));
82 }
83
84
85 /**
86 * Must set to false (special for PickerCard)
87 */
88 public void enforceNavigationWithLinks() {
89 this.enforceLinks = false;
90 }
91
92
93 /**
94 * Insert the method's description here.
95 * Creation date: (10-05-2001 13:18:11)
96 * @return java.lang.String
97 */
98 public java.lang.String getNextCardURL() {
99 return nextCardURL;
100 }
101
102
103 /**
104 * Insert the method's description here.
105 * Creation date: (10-05-2001 13:18:11)
106 * @return java.lang.String
107 */
108 public java.lang.String getSoftkeyLabel() {
109 return softkeyLabel;
110 }
111
112
113 /**
114 * Insert the method's description here.
115 * Creation date: (10-05-2001 13:18:11)
116 * @return java.lang.String
117 */
118 public java.lang.String getText() {
119 return text;
120 }
121
122
123 /**
124 * Insert the method's description here.
125 * Creation date: (10-05-2001 13:18:11)
126 * @return java.lang.String
127 */
128 public java.lang.String getVarName() {
129 return varName;
130 }
131
132
133 /**
134 * Insert the method's description here.
135 * Creation date: (10-05-2001 13:18:11)
136 * @param newNextCardURL java.lang.String
137 */
138 public void setNextCardURL(String nextCardURL) {
139 this.nextCardURL = nextCardURL;
140 }
141
142
143 /**
144 * Insert the method's description here.
145 * Creation date: (10-05-2001 13:18:11)
146 * @param newSoftkeyLabel java.lang.String
147 */
148 public void setSoftkeyLabel(String softkeyLabel) {
149 this.softkeyLabel = softkeyLabel;
150 }
151
152
153 /**
154 * Insert the method's description here.
155 * Creation date: (10-05-2001 13:18:11)
156 * @param newText java.lang.String
157 */
158 public void setText(String text) {
159 this.text = text;
160 }
161
162
163 /**
164 * Insert the method's description here.
165 * Creation date: (10-05-2001 13:18:11)
166 * @param newVarName java.lang.String
167 */
168 public void setVarName(String varName) {
169 this.varName = varName;
170 }
171
172
173 public void visit(WaomVisitor wv){
174 wv.visit(this);
175 }
176 }