01: /* Label.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: May 31, 2007 6:09:02 PM, Created by henrichen
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19:
20: package org.zkoss.mil;
21:
22: import org.zkoss.lang.Objects;
23: import org.zkoss.xml.HTMLs;
24: import org.zkoss.zk.ui.WrongValueException;
25:
26: /**
27: * @author henrichen
28: */
29: public class Label extends Item {
30: private static final long serialVersionUID = 200706060913L;
31: private String _value;
32:
33: public Label() {
34: }
35:
36: public Label(String value) throws WrongValueException {
37: setValue(value);
38: }
39:
40: public void setValue(String value) {
41: if (value != null && value.length() == 0)
42: value = null;
43:
44: if (!Objects.equals(_value, value)) {
45: _value = value;
46: smartUpdate("tx", encodeString(value));
47: }
48: }
49:
50: public String getValue() {
51: return _value;
52: }
53:
54: protected int getAppearanceMode() {
55: return PLAIN;
56: }
57:
58: //-- super --//
59: public String getInnerAttrs() {
60: final StringBuffer sb = new StringBuffer(64).append(super
61: .getInnerAttrs());
62: HTMLs.appendAttribute(sb, "tx", encodeString(_value)); //text
63: HTMLs.appendAttribute(sb, "md", getAppearanceMode()); //appearanceMode
64:
65: return sb.toString();
66: }
67: }
|