01: /* LabelElement.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Jun 17 09:45:54 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 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: package org.zkoss.zul.impl;
20:
21: import org.zkoss.lang.Objects;
22:
23: /**
24: * A HTML element with a label.
25: *
26: * @author tomyeh
27: */
28: abstract public class LabelElement extends XulElement {
29: /** The label. */
30: private String _label = "";
31:
32: /** Returns the label (never null).
33: * <p>Default: "".
34: */
35: public String getLabel() {
36: return _label;
37: }
38:
39: /** Sets the label.
40: * <p>If label is changed, the whole component is invalidate.
41: * Thus, you want to smart-update, you have to override this method.
42: */
43: public void setLabel(String label) {
44: if (label == null)
45: label = "";
46: if (!Objects.equals(_label, label)) {
47: _label = label;
48: invalidate();
49: }
50: }
51: }
|