01: /*
02: * Created on Jul 27, 2005
03: */
04: package uk.org.ponder.rsf.components;
05:
06: /**
07: * A UIOutput holds a single String value, which may or may not be bound to an
08: * EL value binding. It may peer with essentially any tag, since its operation
09: * is to replace the tag body with the <code>text</code> value it holds, if
10: * this value is not null.
11: * <p>
12: * The central prototype of all components.
13: *
14: * @author Antranig Basman (antranig@caret.cam.ac.uk)
15: *
16: */
17: public class UIOutput extends UIBoundString {
18: /**
19: * Constructs a text field which is bound to a particular path in the bean
20: * model. If the initial value is set to <code>null</code> (recommended), it
21: * will be fetched automatically from the bean model during fixup.
22: */
23: public static UIOutput make(UIContainer parent, String ID,
24: String initvalue, String binding) {
25: UIOutput togo = new UIOutput();
26: if (initvalue != null) {
27: togo.setValue(initvalue);
28: }
29: togo.valuebinding = ELReference.make(binding);
30: togo.ID = ID;
31: parent.addComponent(togo);
32: return togo;
33: }
34:
35: /**
36: * Constructs an unbound text field with the specified initial value. This
37: * will not interact with the bean model in any way.
38: */
39: public static UIOutput make(UIContainer parent, String ID,
40: String initvalue) {
41: return make(parent, ID, initvalue, null);
42: }
43:
44: /**
45: * This constructor creates an output component that will simply select a
46: * message already present in the template, free from any further interaction
47: * with the code.
48: */
49: public static UIOutput make(UIContainer parent, String ID) {
50: return make(parent, ID, null, null);
51: }
52:
53: /** Constructor for a standalone UIOutput that will be added to the tree
54: * later.
55: */
56: public static UIOutput make(String initvalue) {
57: UIOutput togo = new UIOutput();
58: if (initvalue != null) {
59: togo.setValue(initvalue);
60: }
61: return togo;
62: }
63: }
|