PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/src/main/java/com/googlecode/struts2yuiplugin/views/jsp/ui/TabViewTag.java

http://struts2yuiplugin.googlecode.com/
Java | 42 lines | 27 code | 10 blank | 5 comment | 0 complexity | 7d8e83a22c2bc56460d953ef9fb4f543 MD5 | raw file
 1package com.googlecode.struts2yuiplugin.views.jsp.ui;
 2
 3import org.apache.struts2.components.Component;
 4import com.opensymphony.xwork2.util.ValueStack;
 5import com.googlecode.struts2yuiplugin.components.TabView;
 6import com.googlecode.struts2yuiplugin.components.Tab;
 7
 8import javax.servlet.http.HttpServletRequest;
 9import javax.servlet.http.HttpServletResponse;
10
11/**
12 * A YUI TabbedView
13 */
14public class TabViewTag extends AbstractYUITag {
15
16    private String selectedTab;
17
18    @Override
19    public Component getBean(ValueStack valueStack, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
20        return new TabView(valueStack, httpServletRequest, httpServletResponse);
21    }
22
23    @Override
24    protected void populateParams() {
25        super.populateParams();
26
27        TabView tabView = (TabView) this.component;
28        tabView.setSelectedTab(selectedTab);
29    }
30
31    /** Add a tab to this tab view */
32    public boolean addTab(Tab tab) {
33        TabView tabView = (TabView) this.component;
34        return tabView.addTab(tab);
35    }
36
37
38    /** Optional id of the tab to make initially selected */
39    public void setSelectedTab(String selectedTab) {
40        this.selectedTab = selectedTab;
41    }
42}