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  
20  package org.apache.myfaces.tobago.internal.taglib.component;
21  
22  import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
23  import org.apache.myfaces.tobago.apt.annotation.Tag;
24  import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
25  import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
26  import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
27  import org.apache.myfaces.tobago.component.RendererTypes;
28  import org.apache.myfaces.tobago.internal.component.AbstractUIToolBar;
29  
30  import javax.faces.component.UIPanel;
31  
32  /**
33   * Renders a toolbar.<br>
34   * Allowed subcomponents are subtypes of UICommand i.e.
35   * <code>'button'</code> and <code>'link'</code> tags.
36   * These are rendered by ToolbarRenderer, so the result has
37   * no difference.<br>
38   * To add an drop down menu to a button add a facet <code>'dropDownMenu'</code>
39   * containing a
40   * <a href="menu.html"><code>&lt;tc:menu&gt;</code></a>
41   * tag to the button. Label's and Image's on those menu tag's are ignored
42   * and replaced by the renderer.
43   * <pre>
44   *      &lt;tc:button onclick="alert('test 0')"
45   *          label="Alert 0" &gt;
46   *        &lt;f:facet name="dropDownMenu"&gt;
47   *          &lt;tc:menu&gt;
48   *            &lt;tc:menuCommand onclick="alert('test 1')" label="Alert 1"/&gt;
49   *            &lt;tc:menuCommand onclick="alert('test 2')" label="Alert 2"/&gt;
50   *            &lt;tc:menuCommand onclick="alert('test 3')" label="Alert 3"/&gt;
51   *          &lt;/tc:menu&gt;
52   *        &lt;/f:facet&gt;
53   *      &lt;/tc:button&gt;
54   *      </pre>
55   */
56  
57  @Tag(name = "toolBar")
58  @BodyContentDescription(anyTagOf = "(<tc:toolBarCommand>|<tc:toolBarSelectBoolean>|<tc:toolBarSelectOne>)* ")
59  @UIComponentTag(
60      uiComponent = "org.apache.myfaces.tobago.component.UIToolBar",
61      uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIToolBar",
62      uiComponentFacesClass = "javax.faces.component.UIPanel",
63      componentFamily = UIPanel.COMPONENT_FAMILY,
64      rendererType = RendererTypes.TOOL_BAR,
65      allowedChildComponenents = {
66          "org.apache.myfaces.tobago.SelectOneCommand",
67          "org.apache.myfaces.tobago.SelectBooleanCommand",
68          "org.apache.myfaces.tobago.Command"})
69  public interface ToolBarTagDeclaration extends PanelTagDeclaration {
70    /**
71     * Position of the button label, possible values are: right, bottom, off.
72     * If toolbar is facet of box: bottom is changed to right!
73     */
74    @TagAttribute
75    @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.LABEL_BOTTOM,
76        allowedValues = {AbstractUIToolBar.LABEL_BOTTOM, AbstractUIToolBar.LABEL_RIGHT, AbstractUIToolBar.LABEL_OFF})
77    void setLabelPosition(String labelPosition);
78  
79    /**
80     * Size of button images, possible values are: small, big, off.
81     */
82    @TagAttribute
83    @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.ICON_SMALL,
84        allowedValues = {AbstractUIToolBar.ICON_SMALL, AbstractUIToolBar.ICON_BIG, AbstractUIToolBar.ICON_OFF})
85    void setIconSize(String iconSize);
86  
87    /**
88     * Orientation of toolbar
89     */
90    @TagAttribute
91    @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.ORIENTATION_LEFT,
92        allowedValues = {AbstractUIToolBar.ORIENTATION_LEFT, AbstractUIToolBar.ORIENTATION_RIGHT})
93    void setOrientation(String orientation);
94  }