2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   *
17   * $Id: Lifecycle1.java 490577 2006-12-27 22:19:21Z craigmcc $
18   */
19  
20  package org.apache.shale.examples.test.view;
21  
22  import javax.faces.context.FacesContext;
23  import org.apache.shale.view.AbstractViewController;
24  
25  /***
26   * <p>First page for lifecycle event tests.</p>
27   */
28  public class Lifecycle1 extends AbstractViewController {
29      
30  
31      // -------------------------------------------------------------- Properties
32  
33  
34      // The "Recorder" object for this request
35      private Recorder recorder = null;
36      public Recorder getRecorder() {
37          return this.recorder;
38      }
39      public void setRecorder(Recorder recorder) {
40          this.recorder = recorder;
41      }
42  
43  
44      // ------------------------------------------------------- Lifecycle Methods
45  
46  
47      /***
48       * <p>Record an init event.</p>
49       */
50      public void init() {
51          getRecorder().record("init1");
52          System.out.println("Lifecycle1.init()");
53          if (FacesContext.getCurrentInstance() == null) {
54              getRecorder().record("noContext");
55              System.out.println("  noContext");
56          }
57      }
58  
59  
60      /***
61       * <p>Record a preprocess event.</p>
62       */
63      public void preprocess() {
64          getRecorder().record("preprocess1");
65          System.out.println("Lifecycle1.preprocess()");
66      }
67  
68  
69      /***
70       * <p>Record a prerender event.</p>
71       */
72      public void prerender() {
73          getRecorder().record("prerender1");
74          System.out.println("Lifecycle1.prerender()");
75      }
76  
77  
78      /***
79       * <p>Record a destroy event.</p>
80       */
81      public void destroy() {
82          getRecorder().record("destroy1");
83          System.out.println("Lifecycle1.destroy()");
84          System.out.println("Lifecycle1.init()");
85          if (FacesContext.getCurrentInstance() == null) {
86              getRecorder().record("noContext");
87              System.out.println("   noContext");
88          }
89      }
90  
91  
92  }