01: /* Input.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Tue Nov 29 21:59:11 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.zhtml;
20:
21: import java.lang.Object; //since we have org.zkoss.zhtml.Object
22:
23: import org.zkoss.lang.Objects;
24:
25: import org.zkoss.zk.ui.WrongValueException;
26: import org.zkoss.zk.ui.ext.client.InputableX;
27: import org.zkoss.zhtml.impl.AbstractTag;
28:
29: /**
30: * The input tag.
31: *
32: * @author tomyeh
33: */
34: public class Input extends AbstractTag {
35:
36: public Input() {
37: this ("input");
38: }
39:
40: protected Input(String tagnm) {
41: super (tagnm);
42: setValue("");
43: }
44:
45: /** Returns the value of this input.
46: */
47: public String getValue() {
48: return (String) getDynamicProperty("value");
49: }
50:
51: /** Sets the vallue of this input.
52: */
53: public void setValue(String value) throws WrongValueException {
54: setDynamicProperty("value", value);
55: }
56:
57: //-- super --//
58: public Object newExtraCtrl() {
59: return new InputableX() {
60: //-- InputableX --//
61: public boolean setTextByClient(String value)
62: throws WrongValueException {
63: if (!Objects.equals(value, getValue())) {
64: setValue(value);
65: return true;
66: }
67: return false;
68: }
69: };
70: }
71: }
|