Example usage for org.apache.wicket.extensions.markup.html.tabs AbstractTab getTitle

List of usage examples for org.apache.wicket.extensions.markup.html.tabs AbstractTab getTitle

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.markup.html.tabs AbstractTab getTitle.

Prototype

@Override
    public IModel<String> getTitle() 

Source Link

Usage

From source file:org.sakaiproject.sitestats.tool.wicket.widget.WidgetTabs.java

License:Educational Community License

public WidgetTabs(String id, List<AbstractTab> tabs, int selectedTab) {
    super(id, new Model(Integer.valueOf(-1)));
    setOutputMarkupId(true);/*from w  ww. j a  va2  s. c o  m*/
    setVersioned(false);
    this.setTabs(tabs);
    if (this.tabs == null) {
        this.tabs = new ArrayList<AbstractTab>();
    }

    // tabs   
    Loop tabLoop = new Loop("tabs", tabs.size()) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(LoopItem item) {
            int index = item.getIndex();
            AbstractTab tab = ((AbstractTab) WidgetTabs.this.tabs.get(index));

            int selected = getSelectedTab();
            if (index == selected) {
                item.add(new AttributeModifier("class", new Model("tabsel")));
            }

            final WebMarkupContainer titleLink = newLink("link", index);
            titleLink.add(new Label("title", tab.getTitle()));
            item.add(titleLink);
        }
    };
    add(tabLoop);

    // add ajax behavior
    loadSelectedTabBehavior = new LoadSelectedTabBehavior();
    add(loadSelectedTabBehavior);

    // select initial tab
    setSelectedTab(selectedTab, false);
}