package org.apache.karaf.webconsole.core;

import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.PageLink;
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.Model;
import org.ops4j.pax.wicket.api.PaxWicketBean;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class BasePage extends WebPage {

    @PaxWicketBean(name = "tabs")
    private List<ConsoleTab> tabs;

    public BasePage() {
        add(CSSPackageResource.getHeaderContribution(BasePage.class, "style.css"));

        add(new Label("footer", "Apache Karaf Console"));

        add(new ListView<ConsoleTab>("tabs", tabs) {
            @Override
            protected void populateItem(ListItem<ConsoleTab> item) {
                final ConsoleTab tab = item.getModelObject();
                item.add(new PageLink("moduleLink", tab.getModuleHomePage()).add(new Label("moduleLabel", tab.getLabel())));

                List<String> subItems = new LinkedList<String>(tab.getItems().keySet());
                item.add(new ListView<String>("topLinks", subItems) {
                    @Override
                    protected void populateItem(ListItem<String> item) {
                        String subItem = item.getModelObject();
                        item.add(new PageLink("topLink", tab.getItems().get(subItem)).add(new Label("linkLabel", subItem)));
                    }
                });
            }
        });

        List tabPanels = new ArrayList();
        tabPanels.add(new AbstractTab(new Model("first tab")) {
            public Panel getPanel(String panelId) {
                return new TabPanel1(panelId);
            }
        });

        add(new TabbedPanel("tabPanels", tabPanels));


    }

    class TabPanel1 extends Panel {
        public TabPanel1(String id) {
            super(id);
        }
    }
}

@@ -317,24 +317,88 @@
 asic.Label;%0A
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;%0A
 import org.a
@@ -429,32 +429,32 @@
 .link.PageLink;%0A
-
 import org.apach
@@ -845,16 +845,26 @@
 private 
+transient 
 List%3CCon
@@ -1274,32 +1274,44 @@
    item.add(new 
+Bookmarkable
 PageLink(%22module
@@ -1709,32 +1709,32 @@
 tModelObject();%0A
-
                 
@@ -1754,16 +1754,28 @@
 add(new 
+Bookmarkable
 PageLink

Fix problem with serialization of @PaxWicketBean annotated field