You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by chinedu efoagui <ch...@gmail.com> on 2010/01/18 13:58:18 UTC

list view

Hello,

I have a table that stores menutabs. In the list of tabs are main tabs
On the page there are main tabs and subtabs that would appear if the
tab that is click in the active one
for example "home", "applications","admin".
there could be subtabs under "applications" menu such as "leave", "loans" etc.
there if "applications" menu is clicked and become the active tab
/page. i would like leave, loans tabs shown underneath it.

I have written something but the problem is when the subtabs do not show
i do not know if my approach is correct or maybe there is a better way
of achieveing the same thing.

<code>
 menuListView=new ListView("menulist",menulist){
  @Override
    protected void populateItem(ListItem item) {
     final   AuthTabs menuitem = (AuthTabs)item.getModelObject();
      // BookmarkablePageLink link =new
BookmarkablePageLink("link",PortalReflection.getClass(menuitem.getUrl()));
        AjaxFallbackLink link =new AjaxFallbackLink ("link") {
          /*  Link link =new Link ("link") {
       @Override
       public void onClick() {



        childreanList=getMenuList(menuitem.getTabid());
         getChildListView( childreanList);
         datatableContainer.replace(childListView);
//this navigates the page to the page class
         setResponsePage(PortalReflection.getClass(menuitem.getUrl()));
                    }*/

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                   // setClicked(true);
        System.out.println("menuitem.getTabid() is:"+menuitem.getTabid());
        childreanList=getMenuList(menuitem.getTabid());
        add(new AttributeModifier("class", true, new Model("hover")));
        target.addComponent(this);
//this navigates the page to the page class
              setResponsePage(PortalReflection.getClass(menuitem.getUrl()));

          }
                };

/*
    link.add(new AttributeModifier("class", true, new
LoadableDetachableModel() {

             private static final long serialVersionUID = 1L;
	@Override

        public final Object load() {

            if(clicked ){
                clicked=false;
		return "hover";
            }
            else {
                return "";
            }
	}
    }));
 * */
    link.setOutputMarkupId(true);
    //link.add(new MenuLinkVisualBehavior("onclick", link));
        link.add(new Label("caption", menuitem.getTabname()));

        item.add(link);
 }};
      menuListView.setOutputMarkupId(true);
    add(menuListView);

}
public ListView getChildListView(List childlist){

    childListView=new ListView("childmenulist",childlist){

          @Override
            protected void populateItem(ListItem item) {
               final   AuthTabs menuitem = (AuthTabs)item.getModelObject();
               BookmarkablePageLink zalink =new
BookmarkablePageLink("childlink",PortalReflection.getClass(menuitem.getUrl()));
                zalink.add(new Label("childcaption", menuitem.getTabname()));
            }
     };

childListView.setOutputMarkupId(true);
  return childListView;
}
</code>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org