Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
109 lines (94 loc) · 2.5 KB

File metadata and controls

109 lines (94 loc) · 2.5 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package org.lcdproc.lcdjava;
/**
* IpMenuItem.
* <p>Allows the user to input an IP number (v4 or v6). When selected, a
* screen comes up that shows an IP number that can be edited - digit by digit
* - via left/right (switch digit) and up/down keys (increase/decrease).
* @author StefanKrupop
*/
public class IpMenuItem extends AbstractMenuItem
{
private String _value;
private boolean _v6;
/**
* Constructor.
* @param id the of the action.
* @param menu the Submenu that knows about this MenuItem.
*/
protected IpMenuItem(String id, Submenu menu)
{
super(id, menu);
_value = "";
_v6 = false;
}
/**
* Get the menu item type.
* @return the menu item type.
*/
public String getType()
{
return MenuItem.MENUITEM_IP;
}
/**
* Sets current value of the entry
* @param value current value
*/
public void setValue(String value) {
_value = value;
update();
}
/**
* Sets current value of the entry but does not send the change to LCDd
* @param value current value
*/
public void setValueNoUpdate(String value) {
_value = value;
}
/**
* Gets the currently set ip
* @return value IP in string format
*/
public String getValue() {
return _value;
}
/**
* Sets if this entry is for v6 IP addresses
* @param isV6 current value
*/
public void setV6(boolean isV6) {
_v6 = isV6;
update();
}
@Override
public String getData() {
StringBuilder strb = new StringBuilder();
strb.append(super.getData());
strb.append(" -value \"");
strb.append(_value);
strb.append("\" -v6 ");
strb.append(_v6 ? "true" : "false");
return strb.toString();
}
/**
* Construct a new IpMenuItem.
* @param menu the Submenu that owns the menu item.
* @param text the menu text.
* @param current the current IP
* @return a new IpMenuItem.
*/
public static IpMenuItem construct(Submenu menu, String text, String current)
{
IpMenuItem menuItem = null;
try
{
menuItem = (IpMenuItem)menu.constructMenuItem(MenuItem.MENUITEM_IP);
menuItem.setValue(current);
menuItem.setText(text);
}
catch (LCDException e) //NOPMD
{
// Supress, would only get one if we asked for an invalid menu item.
}
return menuItem;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.