01: /*
02: * Created on Jul 28, 2005
03: */
04: package uk.org.ponder.rsf.components;
05:
06: /**
07: * Input of a single String-typed value. May
08: * peer, in HTML, for example, with <input type="text" or with
09: * <textarea>.
10: *
11: * @since RSF-0.5
12: * @author Antranig Basman (antranig@caret.cam.ac.uk)
13: *
14: */
15: public class UIInput extends UIBoundString {
16: public UIInput() {
17: fossilize = true;
18: willinput = true;
19: }
20:
21: /**
22: * Construct a new UIInput component with the specified container as parent.
23: *
24: * @param parent Parent container to which the component is to be added.
25: * @param ID (RSF) ID of this component.
26: * @param binding An EL expression to be used as the value binding for the
27: * contained String value. May be <code>null</code>.
28: * @param initvalue An initial value for the bound value. May be left
29: * <code>null</code>. If neither this field nor
30: * <code>binding</code> is set. the value present in the template
31: * will be used.
32: * @return The constructed UIInput component.
33: */
34: public static UIInput make(UIContainer parent, String ID,
35: String binding, String initvalue) {
36: UIInput togo = new UIInput();
37: togo.valuebinding = ELReference.make(binding);
38: if (initvalue != null) {
39: togo.setValue(initvalue);
40: }
41: togo.ID = ID;
42: parent.addComponent(togo);
43: return togo;
44: }
45:
46: public static UIInput make(UIContainer parent, String ID,
47: String binding) {
48: return make(parent, ID, binding, null);
49: }
50:
51: /**
52: * A "bare" constructor suitable for the selection member of a single
53: * selection control (UIInput);
54: */
55: public static UIInput make(String valuebinding) {
56: UIInput togo = new UIInput();
57: togo.valuebinding = ELReference.make(valuebinding);
58: return togo;
59: }
60: }
|