PageRenderTime 6ms CodeModel.GetById 0ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://struts2yuiplugin.googlecode.com/
Java | 49 lines | 29 code | 10 blank | 10 comment | 2 complexity | adbfcd4f4153c47e798ef17b449cf54c MD5 | raw file
 1package com.googlecode.struts2yuiplugin.views.jsp.ui;
 2
 3import org.apache.struts2.components.Component;
 4import org.apache.struts2.dispatcher.Dispatcher;
 5import com.opensymphony.xwork2.util.ValueStack;
 6import com.opensymphony.xwork2.inject.Container;
 7import com.googlecode.struts2yuiplugin.components.Tab;
 8
 9import javax.servlet.http.HttpServletRequest;
10import javax.servlet.http.HttpServletResponse;
11import javax.servlet.jsp.JspException;
12
13/**
14 * A tab for a YUI TabView
15 *
16 */
17public class TabTag extends AbstractYUITag {
18
19    private boolean selected;
20
21    @Override
22    public Component getBean(ValueStack valueStack, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
23        return new Tab(valueStack, httpServletRequest, httpServletResponse);
24    }
25
26    @Override
27    protected void populateParams() {
28        super.populateParams();
29
30        Tab tab = (Tab) this.component;        
31        tab.setSelected(selected);
32
33        TabViewTag tabView = (TabViewTag) findAncestorWithClass(this, TabViewTag.class);
34        if (tabView != null) {
35            tabView.addTab(tab);
36        }
37    }
38
39//    @Override
40//    public int doEndTag() throws JspException {
41//        component.end(pageContext.getOut(), getBody());
42//        component = null;
43//        return SKIP_BODY;
44//    }
45
46    public void setSelected(boolean selected) {
47        this.selected = selected;
48    }
49}