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.EventListener;
22
23 import javax.faces.context.ExternalContext;
24
25 /**
26 * <p>
27 * A listener called when the Lifecyle of a Window changes.
28 * </p>
29 * <p>
30 * Window listeners may be registered automatically by adding a file
31 * containing the names of the classes implementing the WindowLifecycleListener in a file named
32 * <code>org.apache.myfaces.trinidad.event.WindowLifecycleListener</code> inside of
33 * the <code>META_INF/services</code> directory or manually by calling
34 * <code>WindowManager.addWindowLifecycleListener</code>
35 * @see org.apache.myfaces.trinidad.context.WindowManager
36 */
37 public interface WindowLifecycleListener extends EventListener
38 {
39 /**
40 * <p>
41 * Called when the LifecycleState of a Window changes.
42 * </p>
43 * <p>
44 * The current lifecycle state of a Window is the framework's best guess and may not be accurate.
45 * In particular, the last remaining open window may never move into the <code>CLOSED</code> state
46 * once it has moved into the <code>UNLOADED</code> state. In addition, no Window lifecycle events
47 * are delivered if the Session ceases to exist.
48 * </p>
49 * <p>
50 * The FacesContext may not be available at the time that this event is delivered.
51 * </p>
52 * @param extContext ExternalContext available for this event
53 * @param event WindowLifecycleEvent indicating the cause of the change to the Window's
54 * LifecycleState
55 */
56 public abstract void processWindowLifecylce(
57 ExternalContext extContext, WindowLifecycleEvent event);
58 }