Home » tomahawk-1.1.6-src » org.apache.myfaces » custom » schedule » [javadoc | source]

    1   /*
    2    * Copyright 2004 The Apache Software Foundation.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   package org.apache.myfaces.custom.schedule;
   18   
   19   
   20   import javax.faces.context.FacesContext;
   21   import javax.faces.el.ValueBinding;
   22   
   23   import org.apache.myfaces.component.UserRoleAware;
   24   
   25   
   26   /**
   27    *
   28    * @author Bruno Aranda (latest modification by $Author$)
   29    * @version $Revision$
   30    */
   31   public class HtmlPlanner
   32       extends UIPlanner
   33       implements UserRoleAware 
   34       {
   35   
   36   //  ------------------ GENERATED CODE BEGIN (do not modify!) --------------------
   37   
   38       public static final String COMPONENT_TYPE = "org.apache.myfaces.Planner";
   39       public static final String COMPONENT_FAMILY = "javax.faces.Panel";
   40       private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Planner";
   41   
   42       private String _enabledOnUserRole = null;
   43       private String _visibleOnUserRole = null;
   44   
   45       public HtmlPlanner()
   46       {
   47           setRendererType(DEFAULT_RENDERER_TYPE);
   48       }
   49   
   50       public String getFamily()
   51       {
   52           return COMPONENT_FAMILY;
   53       }
   54   
   55       public void setEnabledOnUserRole(String enabledOnUserRole)
   56       {
   57           _enabledOnUserRole = enabledOnUserRole;
   58       }
   59   
   60       public String getEnabledOnUserRole()
   61       {
   62           if (_enabledOnUserRole != null) return _enabledOnUserRole;
   63           ValueBinding vb = getValueBinding("enabledOnUserRole");
   64           return vb != null ? (String)vb.getValue(getFacesContext()) : null;
   65       }
   66   
   67       public void setVisibleOnUserRole(String visibleOnUserRole)
   68       {
   69           _visibleOnUserRole = visibleOnUserRole;
   70       }
   71   
   72       public String getVisibleOnUserRole()
   73       {
   74           if (_visibleOnUserRole != null) return _visibleOnUserRole;
   75           ValueBinding vb = getValueBinding("visibleOnUserRole");
   76           return vb != null ? (String)vb.getValue(getFacesContext()) : null;
   77       }
   78   
   79   
   80   
   81       public Object saveState(FacesContext context)
   82       {
   83           Object values[] = new Object[3];
   84           values[0] = super.saveState(context);
   85           values[1] = _enabledOnUserRole;
   86           values[2] = _visibleOnUserRole;
   87           return ((Object) (values));
   88       }
   89   
   90       public void restoreState(FacesContext context, Object state)
   91       {
   92           Object values[] = (Object[])state;
   93           super.restoreState(context, values[0]);
   94           _enabledOnUserRole = (String)values[1];
   95           _visibleOnUserRole = (String)values[2];
   96       }
   97   //  ------------------ GENERATED CODE END ---------------------------------------
   98       
   99   }
  100   //The End

Home » tomahawk-1.1.6-src » org.apache.myfaces » custom » schedule » [javadoc | source]