Source code: com/openwave/oui/waomelements/Deck.java
1 package com.openwave.oui.waomelements;
2
3 import com.openwave.oui.framework.*;
4 import com.sun.java.util.collections.*;
5
6
7 /**
8 *
9 * The Deck Object is a high-level object. It is useful as a container of multiple templates
10 * and cards. <br/>
11 * Plain WML and WML with Openwave extensions have different DTDs. Encapsulating the deck into
12 * an object makes sure that the most appropriate DTD is delivered to the user agent.
13 * Creation date: (4/4/2001 12:57:28 PM)
14 * @author: Lars Gunder Knudsen
15 */
16 public class Deck extends AbsDeck {
17
18 private int nextCCIndex; // conditional card index
19 private String charSet = null;
20
21 private boolean nokiaBackNavigation = true;
22
23 private final static long serialVersionUID = -1151108506023361859L;
24 /**
25 * Deck constructor comment.
26 */
27 public Deck() {
28 super();
29 //waomElementName = "Deck";
30 setWaomElementName("Deck");
31 nextCCIndex=0;
32 }
33
34 /**
35 * A Head object is associated to the deck
36 */
37 public void addHead(Head head) {
38 this.addElement(head);
39 }
40
41 /**
42 * A Template object is associated to the deck.
43 */
44 public void addTemplate(Template template) {
45 this.addElement(template);
46 }
47
48
49 /**
50 * A Card object is associated to the deck.
51 */
52 public void addCard(AbsCard absCard) {
53 this.addElement(absCard);
54 }
55
56
57 public Head detectHead() {
58 boolean isFound = false;
59 Head headElem = null;
60 for (Iterator i = this.getChildren().iterator();(i.hasNext() && !isFound);) {
61 WaomElement elem = (WaomElement) i.next();
62 if (elem.isHead()) {
63 isFound = true;
64 headElem = (Head) elem;
65 }
66 }
67 return headElem;
68 }
69
70
71 public void disableNokiaBackNavigation(){
72 this.nokiaBackNavigation = false;
73 }
74
75
76 public String getCharSet(){
77 return this.charSet;
78 }
79
80
81 public int getNextCCIndex(){
82 return this.nextCCIndex++;
83 }
84
85
86 public boolean isDeck(){
87 return true;
88 }
89
90
91 public boolean isNokiaBackNavigationEnabled(){
92 return this.nokiaBackNavigation;
93 }
94
95
96 /**
97 * Add the charset string to the XML processing instruction.
98 */
99 public void setCharSet(String charSet) {
100 this.charSet = charSet;
101 }
102
103
104 public void visit(WaomVisitor wv){
105 wv.visit(this);
106 }
107 }