-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTitleWidget.java
More file actions
94 lines (82 loc) · 1.94 KB
/
TitleWidget.java
File metadata and controls
94 lines (82 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package org.lcdproc.lcdjava;
/**
* Title Widget.
* <p>Displays a title on the LCD display.
* <p>Copyright (c) 2004-2005 Darren Greaves.
* @author Darren Greaves
* @version $Id: TitleWidget.java,v 1.3 2008-07-06 15:38:34 boncey Exp $
*/
public class TitleWidget extends AbstractWidget
{
/**
* Version details.
*/
public static final String CVSID =
"$Id: TitleWidget.java,v 1.3 2008-07-06 15:38:34 boncey Exp $";
/**
* The Widget text.
*/
private String _text;
/**
* Constructor.
* @param id the of the Widget.
* @param screen the Screen that knows about this Widget.
*/
protected TitleWidget(int id, Screen screen)
{
super(id, screen);
}
/**
* Get the Widget type.
* @return the Widget type.
*/
public String getType()
{
return WIDGET_TITLE;
}
/**
* Set the Widget text.
* @param text the Widget text.
*/
public void setText(String text)
{
_text = text;
update();
}
/**
* Get the Widget text.
* @return the Widget text.
*/
public String getText()
{
return _text;
}
/**
* Return the data this Widget needs to update itself.
* @return the data to update this Widget.
*/
public String getData()
{
return "\"" + stripQuotes(_text) + "\"";
}
/**
* Construct a new TitleWidget.
* @param screen the Screen that owns the Widget.
* @param text the widget text.
* @return a new TitleWidget.
*/
public static TitleWidget construct(Screen screen, String text)
{
TitleWidget widget = null;
try
{
widget = (TitleWidget)screen.constructWidget(WIDGET_TITLE);
widget.setText(text);
}
catch (LCDException e)
{
// Supress, would only get one if we asked for an invalid Widget.
}
return widget;
}
}