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.component;
20  
21  import javax.faces.component.UIComponent;
22  import javax.faces.event.FacesEvent;
23  import javax.faces.event.FacesListener;
24  import javax.faces.event.PhaseId;
25  import org.apache.myfaces.trinidad.logging.TrinidadLogger;
26  
27  /**
28   * This class wraps a FacesEvent
29   */
30  public class WrapperEvent extends FacesEvent
31  {
32    public WrapperEvent(UIComponent source, FacesEvent wrappedEvent)
33    {
34      super(source);
35      // Event can't be null 
36      if (wrappedEvent == null)
37        throw new NullPointerException(_LOG.getMessage(
38          "WRAPPEDEVENT"));
39  
40      _event = wrappedEvent;
41    }
42  
43    @Override
44    public PhaseId getPhaseId()
45    {
46      return _event.getPhaseId();
47    }
48  
49    @Override
50    public void setPhaseId(PhaseId phaseId)
51    {
52      _event.setPhaseId(phaseId);
53    }
54  
55    @Override
56    public void processListener(FacesListener listener)
57    {
58      // This event is never delivered to a listener
59      throw new IllegalStateException();
60    }
61  
62    @Override
63    public boolean isAppropriateListener(FacesListener listener)
64    {
65      // This event is never delivered to a listener
66      return false;
67    }
68  
69    public FacesEvent getEvent()
70    {
71      return _event;
72    }
73    
74    private final FacesEvent _event;
75    private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
76      WrapperEvent.class);
77    private static final long serialVersionUID = 1L;
78  }