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.Behavior;
23  import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
24  import org.apache.myfaces.tobago.apt.annotation.Tag;
25  import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
26  import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
27  import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
28  import org.apache.myfaces.tobago.component.ClientBehaviors;
29  import org.apache.myfaces.tobago.component.RendererTypes;
30  import org.apache.myfaces.tobago.internal.taglib.declaration.HasAccessKey;
31  import org.apache.myfaces.tobago.internal.taglib.declaration.HasConverter;
32  import org.apache.myfaces.tobago.internal.taglib.declaration.HasConverterMessage;
33  import org.apache.myfaces.tobago.internal.taglib.declaration.HasHelp;
34  import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
35  import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
36  import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabelLayout;
37  import org.apache.myfaces.tobago.internal.taglib.declaration.HasRequiredMessage;
38  import org.apache.myfaces.tobago.internal.taglib.declaration.HasTabIndex;
39  import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
40  import org.apache.myfaces.tobago.internal.taglib.declaration.HasValidator;
41  import org.apache.myfaces.tobago.internal.taglib.declaration.HasValidatorMessage;
42  import org.apache.myfaces.tobago.internal.taglib.declaration.HasValue;
43  import org.apache.myfaces.tobago.internal.taglib.declaration.HasValueChangeListener;
44  import org.apache.myfaces.tobago.internal.taglib.declaration.IsDisabled;
45  import org.apache.myfaces.tobago.internal.taglib.declaration.IsFocus;
46  import org.apache.myfaces.tobago.internal.taglib.declaration.IsReadonly;
47  import org.apache.myfaces.tobago.internal.taglib.declaration.IsRequired;
48  import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
49  
50  import javax.faces.component.UIInput;
51  
52  /**
53   * Renders a star rating component.
54   */
55  @Tag(name = "stars")
56  @UIComponentTag(
57      uiComponent = "org.apache.myfaces.tobago.component.UIStars",
58      uiComponentFacesClass = "javax.faces.component.UIInput",
59      componentFamily = UIInput.COMPONENT_FAMILY,
60      rendererType = RendererTypes.STARS,
61      allowedChildComponenents = "NONE",
62      behaviors = {
63          @Behavior(
64              name = ClientBehaviors.CHANGE,
65              isDefault = true),
66          @Behavior(
67              name = ClientBehaviors.CLICK),
68          @Behavior(
69              name = ClientBehaviors.DBLCLICK)
70      }
71  )
72  
73  public interface StarsTagDeclaration extends HasIdBindingAndRendered, HasConverter, HasConverterMessage, IsDisabled,
74      IsFocus, HasTabIndex, HasLabel, HasLabelLayout, IsReadonly, IsRequired, HasRequiredMessage, HasTip,
75      HasValidator, HasValidatorMessage, HasValue, HasValueChangeListener, IsVisual, HasAccessKey, HasHelp {
76  
77    /**
78     * The current value of this component. May be a java.lang.Number or a javax.swing.BoundedRangeModel
79     */
80    @TagAttribute
81    @UIComponentTagAttribute(
82        type = {"javax.swing.BoundedRangeModel", "java.lang.Integer"},
83        expression = DynamicExpression.VALUE_EXPRESSION_REQUIRED)
84    void setValue(String value);
85  
86    /**
87     * The maximum value must be > '0'. Default is '5'.
88     * To split stars, set a higher maximum value.
89     * E.g. set '10' for half stars, set '20' for quarter stars.
90     */
91    @TagAttribute
92    @UIComponentTagAttribute(
93        type = {"java.lang.Integer"})
94    void setMax(String max);
95  
96    /**
97     * The placeholder value is displayed if no star is set by the user.
98     * Value must be between '0' and '5'.
99     * The placeholder can show values which are not selectable by the user.
100    * E.g. if only full stars are available for the user, the placeholder can show a 4.6 star rating.
101    */
102   @TagAttribute
103   @UIComponentTagAttribute(
104       type = {"java.lang.Double"}
105   )
106   void setPlaceholder(String placeholder);
107 }