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 java.util.EventObject;
22 import org.apache.myfaces.trinidad.context.Window;
23
24 /**
25 * Represents an event delivered with a Window as the source.
26 * @see org.apache.myfaces.trinidad.context.Window
27 * @see org.apache.myfaces.trinidad.event.WindowLifecycleListener
28 */
29 public abstract class WindowEvent extends EventObject
30 {
31 /**
32 * Constructs a WindowEvent for the specified Window
33 * @param source the Window that tis the source of this event.
34 */
35 protected WindowEvent(Window source)
36 {
37 super(source);
38
39 if (source == null)
40 throw new NullPointerException();
41 }
42
43 /**
44 * @return the Window that this event ocurred on.
45 */
46 @Override
47 public Window getSource()
48 {
49 return (Window)super.getSource();
50 }
51
52 /**
53 * Called by subclass <code>equals</code> implementation to check the WindowEvent
54 * portion of equivalence.
55 * @param e Non-null WindowEvent to compare for equality
56 * @return <code>true</code> if the the WindowEvent satisfies the WindowEvent portion
57 * of equivalence.
58 */
59 protected final boolean subclassEquals(WindowEvent e)
60 {
61 return getSource().equals(e.getSource());
62 }
63
64 private static final long serialVersionUID = 1L;
65 }