View Javadoc

1   // WARNING: This file was automatically generated. Do not edit it directly,
2   //          or you will lose your changes.
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21  */
22  package org.apache.myfaces.trinidad.component;
23  
24  import javax.faces.FacesException;
25  import javax.faces.component.ContextCallback;
26  import javax.faces.component.NamingContainer;
27  import javax.faces.context.FacesContext;
28  import org.apache.myfaces.trinidad.bean.FacesBean;
29  
30  /**
31   *
32   * <h4>Events:</h4>
33   * <table border="1" width="100%" cellpadding="3" summary="">
34   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
35   * <th align="left">Type</th>
36   * <th align="left">Phases</th>
37   * <th align="left">Description</th>
38   * </tr>
39   * <tr class="TableRowColor">
40   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
41   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
42   * <td valign="top">Event delivered to describe an attribute change.  Attribute change events are not delivered for any programmatic change to a property.  They are only delivered when a renderer changes a property without the application's specific request.  An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
43   * </tr>
44   * </table>
45   */
46  public class UIXDecorateCollection extends UIXComponentBase
47                                     implements NamingContainer
48  {
49    static public final FacesBean.Type TYPE = new FacesBean.Type(
50      UIXComponentBase.TYPE);
51  
52    static public final String COMPONENT_FAMILY =
53      "org.apache.myfaces.trinidad.DecorateCollection";
54    static public final String COMPONENT_TYPE =
55      "org.apache.myfaces.trinidad.DecorateCollection";
56  
57    /**
58     * Construct an instance of the UIXDecorateCollection.
59     */
60    public UIXDecorateCollection()
61    {
62      super("org.apache.myfaces.trinidad.DecorateCollection");
63    }
64      /**
65     * Gets the currency String for this decorate collection.
66     * @return the current established currency
67     * @see #setCurrencyString
68     */
69    public String getCurrencyString()
70    {
71      return _currencyString;
72    }
73  
74    /**
75     * Sets the currency String for this decorate collection. The decorator renders
76     * aggregated components that are not in the component tree. If any of the aggregated
77     * component is a naming container (for e.g. menubar), this method allows the currency to
78     * be set to that naming container so that it can successfully decode its children.
79     *
80     * @param currency the currency to be established
81     * @see #getCurrencyString
82     */
83    public void setCurrencyString(String currency)
84    {
85      _currencyString = currency;
86    }
87  
88    /**
89     * Gets the client-id of this component, without any NamingContainers.
90     * This id changes depending on the currency Object.
91     * Because this implementation uses currency strings, the local client ID is
92     * not stable for very long. Its lifetime is the same as that of a
93     * currency string.
94     * @see #getCurrencyString
95     * @return the local clientId
96     */
97    @Override
98    public final String getContainerClientId(FacesContext context)
99    {
100     String id = getClientId(context);
101     String key = getCurrencyString();
102     if (key != null)
103     {
104       StringBuilder bld = __getSharedStringBuilder();
105       bld.append(id).append(NamingContainer.SEPARATOR_CHAR).append(key);
106       id = bld.toString();
107     }
108 
109     return id;
110   }
111 
112 
113 
114   @Override
115   public boolean invokeOnComponent(FacesContext context,
116                                    String clientId,
117                                    ContextCallback callback)
118     throws FacesException
119   {
120     // optimize case where clientId isn't in NamingContainer
121     return invokeOnNamingContainerComponent(context, clientId, callback);
122   }
123 
124 
125   private String _currencyString = null;
126 
127   @Override
128   public String getFamily()
129   {
130     return COMPONENT_FAMILY;
131   }
132 
133   @Override
134   protected FacesBean.Type getBeanType()
135   {
136     return TYPE;
137   }
138 
139   /**
140    * Construct an instance of the UIXDecorateCollection.
141    */
142   protected UIXDecorateCollection(
143     String rendererType
144     )
145   {
146     super(rendererType);
147   }
148 
149   static
150   {
151     TYPE.lockAndRegister("org.apache.myfaces.trinidad.DecorateCollection","org.apache.myfaces.trinidad.DecorateCollection");
152   }
153 }