View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    *
    10   *   http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing,
    13   * software distributed under the License is distributed on an
    14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   * KIND, either express or implied.  See the License for the
    16   * specific language governing permissions and limitations
    17   * under the License.
    18   */
    19  package org.apache.myfaces.shared_orchestra.taglib.core;
    20
    21  import org.apache.myfaces.shared_orchestra.renderkit.JSFAttr;
    22
    23  import javax.faces.component.UIComponent;
    24
    25  /**
    26   * @author Thomas Spiegl (latest modification by $Author: grantsmith $)
    27   * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Wed, 08 Nov 2006) $
    28   */
    29  public class SelectItemTagBase
    30      extends org.apache.myfaces.shared_orchestra.taglib.UIComponentTagBase
    31  {
    32      //private static final Log log = LogFactory.getLog(SelectItemTag.class);
    33
    34      public String getComponentType()
    35      {
    36          return "javax.faces.SelectItem";
    37      }
    38
    39      public String getRendererType()
    40      {
    41          return null;
    42      }
    43
    44      // UISelectItem attributes
    45      private String _itemDisabled;
    46      private String _itemDescription;
    47      private String _itemLabel;
    48      private String _itemValue;
    49
    50      protected void setProperties(UIComponent component)
    51      {
    52          super.setProperties(component);
    53
    54          setBooleanProperty(component, JSFAttr.ITEM_DISABLED_ATTR, _itemDisabled);
    55          setStringProperty(component, JSFAttr.ITEM_DESCRIPTION_ATTR, _itemDescription);
    56          setStringProperty(component, org.apache.myfaces.shared_orchestra.renderkit.JSFAttr.ITEM_LABEL_ATTR, _itemLabel);
    57          setStringProperty(component, JSFAttr.ITEM_VALUE_ATTR, _itemValue);
    58
    59          if (_itemValue == null &&
    60              component.getValueBinding("binding") == null &&
    61              component.getValueBinding("value") == null)
    62          {
    63              throw new IllegalArgumentException("SelectItem with no value");
    64          }
    65      }
    66
    67      public void setItemDisabled(String itemDisabled)
    68      {
    69          _itemDisabled = itemDisabled;
    70      }
    71
    72      public void setItemDescription(String itemDescription)
    73      {
    74          _itemDescription = itemDescription;
    75      }
    76
    77      public void setItemLabel(String itemLabel)
    78      {
    79          _itemLabel = itemLabel;
    80      }
    81
    82      public void setItemValue(String itemValue)
    83      {
    84          _itemValue = itemValue;
    85      }
    86
    87      public String getItemValue()
    88      {
    89          return _itemValue;
    90      }
    91
    92  }