Community articlegetParent method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


This method, along with getChildren, is used to traverse vertically along the form hierarchy. getParent returns the parent of a node. If the node has no parent, null is returned. A form's structure can be traversed up to the root node using an iterator such as a while loop.


   public FormNodeP getParent( ) throws UWIException;


There are no parameters for this method.


The FormNodeP that represents the parent node or null if no such parent exists. If an error occurs, a generic (UWIException) is thrown.


In the following example the root node of a form is represented by a FormNodeP called theForm. The method dereferenceEx is used to retrieve an option node from the form called PAGE1.AGEFIELD.size.
   public class getFunctions
   private static FormNodeP theForm;
   private static FormNodeP tempNode;
   private static FormNodeP parentNode;
      /* Additional Code Removed */
      public static void main(String argv[])
         /* Additional Code Removed */
         if ((tempNode = theForm.dereferenceEx(null, 
            "PAGE1.AGEFIELD.size", 0, FormNodeP.UFL_OPTION_REFERENCE | 
            FormNodeP.UFL_SEARCH, null)) == null)
            throw new UWIException("Could not locate AgeField size 
               label node.");
         parentNode = tempNode.getParent( );
         /* Additional Code Removed */

Parent topic:
FormNodeP class