View Javadoc

1   package pl.caltha.forms.internal.ui;
2   
3   import org.xml.sax.Attributes;
4   
5   import pl.caltha.forms.ConstructionException;
6   
7   /*** A base implementation for a node of the UI tree structure.
8    *
9    * @author <a href="mailto:zwierzem@ngo.pl">Damian Gajda</a>
10   * @version $Id: NodeCaptionReference.java,v 1.1 2005/01/19 06:55:28 pablo Exp $
11   */
12  public class NodeCaptionReference extends NodeCaption
13  implements ReferenceNode
14  {
15      /*** Basic constuctor, extracts Node properties from SAX Attributes object.
16       *
17       * @param type name of the defining XML element.
18       * @param atts attributes of node's XML definition.
19       * @throws ConstructionException Thrown on problems with this Node's construction.
20       */
21      public NodeCaptionReference(String type, Attributes atts)
22      throws ConstructionException
23      {
24          super(type, atts);
25          ref = new ReferenceSingle(atts, this);
26      }
27  
28      /*** Used when copying parts of UI tree for repeat nodes processing.
29       * <p>Fields which are deep copied:</p>
30       * <ul>
31       *  <li>{@link #ref} - ref is also set a new container Node, see
32       *  {@link Reference#clone()}</li>
33       * </ul>
34       */
35      protected Object clone()
36      {
37          NodeCaptionReference next = (NodeCaptionReference)(super.clone());
38          // References must be copied
39          next.ref = (Reference)(ref.clone());
40          // set a new container node
41          next.ref.setContainerNode(next);
42          return next;
43      }
44  
45      //------------------------------------------------------------------------
46      //attributes
47      protected Reference ref;
48  
49      //------------------------------------------------------------------------
50      // ReferenceNode methods
51      public Reference getRef()
52      {
53          return ref;
54      }
55  
56      //------------------------------------------------------------------------
57      // methods used by UIBuilder
58  
59      protected void init(UI ui)
60      throws ConstructionException
61      {
62          super.init(ui);
63          ref.init(ui);
64      }
65  }
66