title: Wicket Component hierarchy - getParent()
body: <p>I did an experiment. First I want to state the html:</p>
  
  <pre><code>&lt;form wicket:id="form"&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;table style="border: 1px solid;" cellspacing="0" cellpadding="0"&gt;
                  &lt;tr wicket:id="row"&gt;
                      &lt;td wicket:id="column" style="border: 1px solid #3A6395"&gt;
                          &lt;div wicket:id="div"&gt;
                              &lt;span wicket:id="panel"&gt;&lt;/span&gt;
                              &lt;span wicket:id="tooltip"&gt;&lt;span wicket:id="tooltipPanel"&gt;&lt;/span&gt;&lt;/span&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &amp;nbsp;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;wicket:fragment wicket:id="labelFragment"&gt;
      &lt;span wicket:id="value"&gt;&lt;/span&gt;
  &lt;/wicket:fragment&gt;
  &lt;wicket:fragment wicket:id="linkFragment"&gt;
      &lt;a href="" wicket:id="link"&gt;
          &lt;span wicket:id="value"&gt;&lt;/span&gt;
      &lt;/a&gt;
  &lt;/wicket:fragment&gt;
  </code></pre>
  
  <p>The java:</p>
  
  <pre><code>private class ReportDisplayByUserWithTaskTypeSortForm extends Form {
  
          private static final long serialVersionUID = 10162L;
  
          public ReportDisplayByUserWithTaskTypeSortForm(String id) {
              super(id);
              setOutputMarkupId(true);
              addComponent();
          }
  
          private void addComponent() {           
              ListView row = new ListView("row", new LoadableDetachableModel() {
  
                  private static final long serialVersionUID = 10164L;
  
                  @Override
                  protected Object load() {
                      return getUserMonitorMap();
                  }
              }) {
  
                  private static final long serialVersionUID = 10165L;
  
                  @Override
                  protected void populateItem(ListItem rowItem) {
                      @SuppressWarnings("unchecked")
                      List&lt;? extends Element&gt; columnMap = (List&lt;Element&gt;) rowItem.getModelObject();
                      ListView column = new ListView("column", columnMap) {
  
                          private static final long serialVersionUID = 10166L;
  
                          @Override
                          protected void populateItem(ListItem columnItem) {
                              Element element = (Element) columnItem.getModelObject();
  
                              WebMarkupContainer div = new WebMarkupContainer("div");
                              Label value = new Label("value");
                              Fragment fragment = null;
  
                              if (element instanceof TaskTypeLabelElement) {
                                  fragment = new Fragment("panel", "linkFragment", this);
  
                                  AjaxLink link = new AjaxLink("link") {
  
                                      private static final long serialVersionUID = 10163L;
  
                                      @Override
                                      public void onClick(AjaxRequestTarget target) {
                                          sortAsc = !sortAsc;
                                          doSort();                                       
                                          target.addComponent(this.getParent().getParent().getParent().getParent().getParent().getParent().getParent());                                      
                                      }
                                  };
                                  link.add(value);
                                  fragment.add(link);
                              } else {
                                  fragment = new Fragment("panel", "labelFragment", this);
                                  fragment.add(value);
                              }
  
                              // some other code goes here
  
                              columnItem.add(div);
                          }
                      };
                      rowItem.add(column);
                  }
              };
  
              add(row);
          }
      }
  }
  </code></pre>
  
  <p>The link within the fragment is instantiating as:</p>
  
  <pre><code>AjaxLink link = new AjaxLink("link") {
  
          private static final long serialVersionUID = 10163L;
  
          @Override
          public void onClick(AjaxRequestTarget target) {
              System.out.println(this);
              System.out.println(this.getParent());
              System.out.println(this.getParent().getParent());
              System.out.println(this.getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent().getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent().getParent().getParent().getParent().getParent());
              System.out.println(this.getParent().getParent().getParent().getParent().getParent().getParent().getParent().getParent().getParent());
          }
      };
  </code></pre>
  
  <p>The output for System.out.println :</p>
  
  <pre><code>15:58:17,476 INFO  [STDOUT] [MarkupContainer [Component id = link]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = panel]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = div]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = 0]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = column]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = 0]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = row]]
  15:58:17,477 INFO  [STDOUT] [MarkupContainer [Component id = form]]
  15:58:17,477 INFO  [STDOUT] [Page class = info.release.wicket.ReportDisplayByUserWithTaskTypeSort, id = 4, version = 0]
  15:58:17,477 INFO  [STDOUT] null
  </code></pre>
  
  <p>My questions are:</p>
  
  <ul>
  <li>What is the meaning of "Component id = 0" after "Component id = div" and "Component id = column", what is this component?</li>
  <li>What is the meaning of "id = 4, version = 0" of the second last line?</li>
  </ul>