001    package org.apache.myfaces.tobago.taglib.component;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ICON_SIZE;
021    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_POSITION;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ORIENTATION;
023    import org.apache.myfaces.tobago.component.ComponentUtil;
024    import org.apache.myfaces.tobago.component.UIToolBar;
025    
026    import javax.faces.component.UIComponent;
027    
028    /*
029     * Created 29.07.2003 at 15:09:53.
030     * $Id: ToolBarTag.java 601107 2007-12-04 22:12:14Z bommel $
031    */
032    public class ToolBarTag extends PanelTag
033        implements ToolBarTagDeclaration {
034    
035      public static final String LABEL_BOTTOM = UIToolBar.LABEL_BOTTOM;
036      public static final String LABEL_RIGHT = UIToolBar.LABEL_RIGHT;
037      public static final String LABEL_OFF = UIToolBar.LABEL_OFF;
038    
039      public static final String ICON_SMALL = UIToolBar.ICON_SMALL;
040      public static final String ICON_BIG = UIToolBar.ICON_BIG;
041      public static final String ICON_OFF = UIToolBar.ICON_OFF;
042    
043      private String labelPosition = LABEL_BOTTOM;
044      private String iconSize = ICON_SMALL;
045      private String orientation = UIToolBar.ORIENTATION_LEFT;
046    
047    
048      public String getComponentType() {
049        return UIToolBar.COMPONENT_TYPE;
050      }
051    
052      protected void setProperties(UIComponent component) {
053        super.setProperties(component);
054        ComponentUtil.setStringProperty(component, ATTR_LABEL_POSITION, labelPosition);
055        ComponentUtil.setStringProperty(component, ATTR_ICON_SIZE, iconSize);
056        ComponentUtil.setStringProperty(component, ATTR_ORIENTATION, orientation);
057      }
058    
059      public void release() {
060        super.release();
061        labelPosition = LABEL_BOTTOM;
062        iconSize = ICON_SMALL;
063      }
064    
065      public void setLabelPosition(String labelPosition) {
066        this.labelPosition = labelPosition;
067      }
068    
069      public void setIconSize(String iconSize) {
070        this.iconSize = iconSize;
071      }
072    
073      public void setOrientation(String orientation) {
074        this.orientation = orientation;
075      }
076    }