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  package org.apache.myfaces.trinidad.event;
20  
21  import javax.faces.component.UIComponent;
22  import javax.faces.event.FacesListener;
23  
24  import org.apache.myfaces.trinidad.model.RowKeySet;
25  
26  /**
27   * Event that is generated when the selection of a component changes.
28   */
29  public class SelectionEvent extends RowKeySetChangeEvent
30  {
31    /**
32     * Creates a new SelectionEvent
33     * @param unselected the set of rowKeys that have just been unselected.
34     * @param selected the set of rowKeys that have just been selected.
35     */
36    // FIXME: What is the parametrized type inside RowKeySet?
37    public SelectionEvent(
38        UIComponent source, 
39        RowKeySet   unselected, 
40        RowKeySet   selected)
41    {
42      super(source, unselected, selected);
43    }
44  
45    /**
46     * Creates a new SelectionEvent
47     * @param oldSet the set of rowKeys before any changes.
48     * @param newSet the set of rowKeys after any changes.
49     */
50    public SelectionEvent(
51        RowKeySet   oldSet, 
52        RowKeySet   newSet, 
53        UIComponent source)
54    {
55      super(oldSet, newSet, source);
56    }
57  
58    @Override
59    public void processListener(FacesListener listener)
60    {
61      ((SelectionListener) listener).processSelection(this);
62    }
63  
64    @Override
65    public boolean isAppropriateListener(FacesListener listener)
66    {
67      return (listener instanceof SelectionListener);
68    }
69  
70    private static final long serialVersionUID = 1L;
71  }