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 java.util.List;
25  import org.apache.myfaces.trinidad.bean.FacesBean;
26  
27  /**
28   *
29   * <h4>Events:</h4>
30   * <table border="1" width="100%" cellpadding="3" summary="">
31   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
32   * <th align="left">Type</th>
33   * <th align="left">Phases</th>
34   * <th align="left">Description</th>
35   * </tr>
36   * <tr class="TableRowColor">
37   * <td valign="top"><code>javax.faces.event.ValueChangeEvent</code></td>
38   * <td valign="top" nowrap>Process<br>Validations<br>Apply<br>Request<br>Values</td>
39   * <td valign="top">The valueChange event is delivered when the value
40                         attribute is changed.</td>
41   * </tr>
42   * <tr class="TableRowColor">
43   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
44   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
45   * <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>
46   * </tr>
47   * </table>
48   */
49  public class UIXSelectOrder extends UIXSelectMany
50  {
51    static public final FacesBean.Type TYPE = new FacesBean.Type(
52      UIXSelectMany.TYPE);
53  
54    static public final String COMPONENT_FAMILY =
55      "org.apache.myfaces.trinidad.SelectOrder";
56    static public final String COMPONENT_TYPE =
57      "org.apache.myfaces.trinidad.SelectOrder";
58  
59    /**
60     * Construct an instance of the UIXSelectOrder.
61     */
62    public UIXSelectOrder()
63    {
64      super("org.apache.myfaces.trinidad.Shuttle");
65    }
66      
67    /**
68     * Compares two values, paying attention to the order of the elements.
69     * @return true if the values are different
70     */
71    // TODO improve efficiency for the array case?
72    @Override
73    @SuppressWarnings("unchecked")
74    protected boolean compareValues(Object previous, Object value)
75    {
76      int prevSize = __getSize(previous);
77      int newSize = __getSize(value);
78  
79      // If the sizes are different, no need to bother with further work
80      if (prevSize != newSize)
81        return true;
82  
83      // If the sizes are the same, and they're empty, we're also done.
84      if (prevSize == 0)
85        return false;
86  
87      List<Object> prevList = (previous instanceof List)
88                        ? (List<Object>) previous : __toList(previous);
89      List<Object> newList = (value instanceof List)
90                        ? (List<Object>) value : __toList(value);
91  
92      // Since List has explicit rules about how equals() works, we
93      // can just use that method.
94      return !prevList.equals(newList);
95    }
96  
97    @Override
98    public String getFamily()
99    {
100     return COMPONENT_FAMILY;
101   }
102 
103   @Override
104   protected FacesBean.Type getBeanType()
105   {
106     return TYPE;
107   }
108 
109   /**
110    * Construct an instance of the UIXSelectOrder.
111    */
112   protected UIXSelectOrder(
113     String rendererType
114     )
115   {
116     super(rendererType);
117   }
118 
119   static
120   {
121     TYPE.lockAndRegister("org.apache.myfaces.trinidad.SelectOrder","org.apache.myfaces.trinidad.Shuttle");
122   }
123 }