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.Tag;
23  import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
24  import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
25  import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
26  import org.apache.myfaces.tobago.component.RendererTypes;
27  import org.apache.myfaces.tobago.internal.taglib.declaration.HasFor;
28  import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
29  import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
30  import org.apache.myfaces.tobago.layout.OrderBy;
31  
32  import javax.faces.component.UIMessages;
33  
34  /**
35   * Renders error/validation messages.
36   */
37  @Tag(name = "messages")
38  @UIComponentTag(
39      uiComponent = "org.apache.myfaces.tobago.component.UIMessages",
40      uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIMessages",
41      uiComponentFacesClass = "javax.faces.component.UIMessages",
42      componentFamily = UIMessages.COMPONENT_FAMILY,
43      rendererType = RendererTypes.MESSAGES,
44      interfaces = {
45          // As long as no behavior event names are defined, ClientBehaviorHolder must be implemented for Majorra.
46          "javax.faces.component.behavior.ClientBehaviorHolder"
47      },
48      allowedChildComponenents = "NONE")
49  
50  public interface MessagesTagDeclaration
51      extends HasIdBindingAndRendered, HasFor, IsVisual {
52  
53    /**
54     * Flag indicating that only messages that are not associated to any
55     * particular UIComponent should be displayed. That are messages without clientId.
56     */
57    @TagAttribute
58    @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
59    void setGlobalOnly(String globalOnly);
60  
61    /**
62     * Flag indicating whether the detail should be included
63     */
64    @TagAttribute
65    @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
66    void setShowDetail(String showDetail);
67  
68    /**
69     * Flag indicating whether the summary should be included
70     */
71    @TagAttribute
72    @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
73    void setShowSummary(String showSummary);
74  
75     /**
76     * Sets the mininum severity to be shown. E. g. "warn" shows only "warn", "error" and "fatal".
77     */
78    @TagAttribute
79    @UIComponentTagAttribute(type = "javax.faces.application.FacesMessage$Severity", defaultValue = "info",
80        defaultCode = "javax.faces.application.FacesMessage.SEVERITY_INFO")
81    void setMinSeverity(String minSeverity);
82  
83     /**
84     * Sets the maximum severity to be shown. E. g. "warn" shows only "warn" and "info".
85      * When setting this attribute you usually shoud take care, that you have a second message tag to show the
86      * higher severity levels.
87     */
88    @TagAttribute
89    @UIComponentTagAttribute(type = "javax.faces.application.FacesMessage$Severity", defaultValue = "fatal",
90        defaultCode = "javax.faces.application.FacesMessage.SEVERITY_FATAL")
91    void setMaxSeverity(String maxSeverity);
92  
93     /**
94     * Sets the maximum number of messages to show.
95     */
96    @TagAttribute
97    @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "2147483647")
98    void setMaxNumber(String maxNumber);
99  
100    /**
101    * Sets the order of the messages.
102    */
103   @TagAttribute
104   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.OrderBy",
105       allowedValues = {OrderBy.OCCURRENCE, OrderBy.SEVERITY},
106       defaultValue = OrderBy.OCCURRENCE,
107       defaultCode = "org.apache.myfaces.tobago.layout.OrderBy.occurrence")
108   void setOrderBy(String orderBy);
109 
110   /**
111    * Has the user to confirm this message?
112    * This attributes handles the case, if the application wants to warn the user about a problem,
113    * and the user has to confirm the message before he/she can continue.
114    */
115   @TagAttribute
116   @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
117   void setConfirmation(String confirmation);
118 
119 }