/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.corejsf;

import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.event.MethodExpressionActionListener;
import javax.faces.webapp.UIComponentELTag;

/**
 *
 * @author Ivan
 */
public class TabbedPaneTag extends UIComponentELTag{

    
    public String getComponentType() {
        return "com.corejsf.TabbedPane";
    }


    public String getRendererType() {
        return "com.corejsf.TabbedPane";
    }
    
    private ValueExpression style;
    private ValueExpression styleClass;
    private ValueExpression tabClass;
    private ValueExpression selectedTabClass;
    private ValueExpression resourceBundle;
    private MethodExpression actionListener;

    public void setStyle(ValueExpression style) {
        this.style = style;
    }

    public void setStyleClass(ValueExpression styleClass) {
        this.styleClass = styleClass;
    }

    public void setTabClass(ValueExpression tabClass) {
        this.tabClass = tabClass;
    }

    public void setSelectedTabClass(ValueExpression selectedTabClass) {
        this.selectedTabClass = selectedTabClass;
    }

    public void setResourceBundle(ValueExpression resourceBundle) {
        this.resourceBundle = resourceBundle;
    }

    public void setActionListener(MethodExpression actionListener) {
        this.actionListener = actionListener;
    }
    
    protected void setProperties(UIComponent component){
        super.setProperties(component);//za id binding rendered atribute
        component.setValueExpression("style", style);
        component.setValueExpression("styleClass", styleClass);
        component.setValueExpression("tabClass", tabClass);
        component.setValueExpression("selectedTabClass",selectedTabClass);
        component.setValueExpression("resourceBundle", resourceBundle);
        if(actionListener!=null){
        ((ActionSource)component).addActionListener(new MethodExpressionActionListener(actionListener));
        }
        
    }
    
   public void release() {
      // always call the superclass method
      super.release();

      style = null;
      styleClass = null;
      tabClass = null;
      selectedTabClass = null;
      resourceBundle = null;
      actionListener = null;
   }
 

}
