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