Source code: com/openwave/oui/waomelements/TaskMenu.java
1 package com.openwave.oui.waomelements;
2 import com.openwave.oui.framework.*;
3 /**
4 * Menu navigation is better implemented with different constructs for different devices (or class of devices).<br/>
5 * The UP.Browser is better served by the <select>/<option> construct, while other browsers work
6 * more usably with variations of the classical list of hyperlinks.<br/>
7 * Creation date: (13-06-2001 12:40:25)
8 * @author: Lars Gunder Knudsen
9 */
10 public class TaskMenu extends WaomComposite {
11 private Deck deck = null;
12 private Menu menu = null;
13 private String taskMenuURL = null;
14 private String shortTitle = null;
15 private String longTitle = null;
16 private final static long serialVersionUID = 2779222992329161898L;
17
18 /**
19 * Menu constructor comment.
20 */
21 public TaskMenu(Deck deck, String shortTitle, String longTitle) {
22 super();
23 //waomElementName = "TaskMenu";
24 setWaomElementName("TaskMenu");
25 this.shortTitle = shortTitle;
26 this.longTitle = longTitle;
27
28 this.deck = deck;
29 this.menu = new Menu();
30
31
32 int nextCCIndex = deck.getNextCCIndex();
33 ConditionalCard ccard = new ConditionalCard("menucard"+nextCCIndex,"");
34 ccard.setDeviceList(OUISystemManager.getConditionalCardDeviceListFor(this));
35 this.taskMenuURL = "#menucard"+nextCCIndex;
36 deck.addCard(ccard);
37 ccard.beginParagraph();
38 ccard.addElement(this.menu);
39 ccard.endParagraph();
40 }
41
42
43 /**
44 * Adds a menu entry (without an icon).
45 *
46 */
47 public void addEntry(String url, String title, String text) {
48 this.menu.addEntry(url, title, text);
49 this.addElement(new DoElement(new Task("go",url,"get"),"options",text));
50 }
51
52
53 /**
54 * Adds a menu entry with an icon.
55 *
56 */
57 public void addEntry(String url, String title, String text, String localIcon) {
58 this.menu.addEntry(url, title, text, localIcon);
59 this.addElement(new DoElement(new Task("go",url,"get"),"options",text));
60 }
61
62
63 /**
64 * Add menu item without an icon. Navigation implies triggering a Task.
65 *
66 */
67 public void addTaskEntry(AbsTask absTask, String title, String text) {
68 this.menu.addTaskEntry(absTask, title, text);
69 this.addElement(new DoElement(absTask,"options",text));
70 }
71
72
73 /**
74 * Add menu item with an icon. Navigation implies triggering a Task.
75 *
76 */
77 public void addTaskEntry(AbsTask absTask, String title, String text, String localIcon) {
78 this.menu.addTaskEntry(absTask, title, text, localIcon);
79 this.addElement(new DoElement(absTask,"options",text));
80 }
81
82
83 public String getLongTitle(){
84 return this.longTitle;
85 }
86
87
88 public String getShortTitle(){
89 return this.shortTitle;
90 }
91
92
93 public String getURL(){
94 return this.taskMenuURL;
95 }
96
97
98 public boolean isTaskMenu() {
99 return true;
100 }
101
102
103 public void visit(WaomVisitor wv){
104 wv.visit(this);
105 }
106 }