package org.apache.karaf.webconsole.core.internal;

import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.util.ListModel;

public class SidebarPanel extends Panel {

    public SidebarPanel(String id, Class<? extends Page> basePage, ListModel<Class<? extends Page>> listModel) {
        super(id, listModel);

        add(new BookmarkablePageLink<Page>("masterPageLink", basePage).add(new Label("masterPageLabel", basePage.getName())));

        add(new ListView<Class<? extends Page>>("subPageLinks", listModel) {
            @Override
            protected void populateItem(ListItem<Class<? extends Page>> item) {
                BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("subPageLink", item.getModelObject());
                link.add(new Label("subPageLabel", item.getModelObject().getName()));
                item.add(link);
            }
        });
    }

}

package org.apache.karaf.webconsole.core.internal;

import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.util.ListModel;

public class SidebarPanel extends Panel {

    public SidebarPanel(String id, Class<? extends Page> basePage, ListModel<Class<? extends Page>> listModel) {
        super(id, listModel);

        add(new BookmarkablePageLink<Page>("masterPageLink", basePage).add(new Label("masterPageLabel", basePage.getSimpleName())));

        add(new ListView<Class<? extends Page>>("subPageLinks", listModel) {
            @Override
            protected void populateItem(ListItem<Class<? extends Page>> item) {
                Class<? extends Page> page = item.getModelObject();
                BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("subPageLink", page);
                link.add(new Label("subPageLabel", page.getSimpleName()));
                item.add(link);
            }
        });
    }

}

Improve sidebar a bit - remove long class names from navigation
Improve sidebar a bit - remove long class names from navigation

git-svn-id: e2c3038d01fb1e63d9a6e7e9a258c7088cd26e08@1160300 13f79535-47bb-0310-9956-ffa450edef68
