Sure there a dozens of ways todo this, mine is just one of them. Im starting a new thread since it'll be more exposed then.

The idea is following:

Parent:

public class BasePage extends WebPage {

  protected final String LINK_LABEL_ID = "linkText";
  protected final String LINK_ID = "link";

  protected final String FOOTER_ID = "item";
  protected final String HEADER_ID = "item";

protected List<WebMarkupContainer> generalAccordionItem = new ArrayList<WebMarkupContainer>();

protected List<WebMarkupContainer> footer = new ArrayList<WebMarkupContainer>(); protected List<WebMarkupContainer> header = new ArrayList<WebMarkupContainer>();

  private AccordionPanel accordionPanel;

  /**
   * Constructor that is invoked when page is invoked without a session.
   *
   * @param parameters
   *            Page parameters
   */
  public BasePage() {
      accordionPanel = new AccordionPanel("accordionMenu");
      add(accordionPanel);

      add(new ListView("footerContent", footer) {
          @Override
          protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer = (WebMarkupContainer) item
                      .getModelObject();
              item.add(webMarkupContainer);

          }
      });
      add(new ListView("headerContent", header) {
          @Override
          protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer = (WebMarkupContainer) item
                      .getModelObject();
              item.add(webMarkupContainer);

          }
      });

}
  protected void addMenu(AccordionPanelItem accordionPanelItem) {
      accordionPanel.addMenu(accordionPanelItem);
  };

  protected void addFooter(WebMarkupContainer webMarkupContainer) {
      footer.add(webMarkupContainer);
  };
  protected void addHeader(WebMarkupContainer webMarkupContainer) {
      header.add(webMarkupContainer);
  };

Subs/Children then calls the methods... Problem with this technique is that you need to use the right markup id's.. To make sure they are always set, and giving full control to the child/sub on what to add, I'd suggest that you create a BasePanel which encapsules the id, and then required that instead of a markupcontainer, that way subs/child only need to have panels that extend the basepanel...

But it depends on your needs, mine weren't that tricky..


regards Nino

--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to