01: /*
02: * Created on 24 Oct 2006
03: */
04: package uk.org.ponder.rsf.components.decorators;
05:
06: import uk.org.ponder.rsf.components.UIComponent;
07:
08: /** Specifies that the decorated component is a label which targets another
09: * component. In HTML, this would be represented by a <label for=" tag.
10: * @author Antranig Basman (antranig@caret.cam.ac.uk)
11: */
12:
13: public class UILabelTargetDecorator implements UIDecorator {
14: public String targetFullID;
15:
16: public UILabelTargetDecorator(UIComponent target) {
17: targetFullID = target.getFullID();
18: }
19:
20: /** A utility method to register in one step one component as the label
21: * for another.
22: * @param label The component to be registered as a label
23: * @param target The target of the label
24: */
25: public static void targetLabel(UIComponent label, UIComponent target) {
26: UIDecorator dec = new UILabelTargetDecorator(target);
27: if (label.decorators == null) {
28: label.decorators = new DecoratorList(dec);
29: } else {
30: label.decorators.add(dec);
31: }
32: }
33: }
|