Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Lifecycle1 |
|
| 1.3333333333333333;1.333 |
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 | 0 | public class Lifecycle1 extends AbstractViewController { |
29 | ||
30 | ||
31 | // -------------------------------------------------------------- Properties | |
32 | ||
33 | ||
34 | // The "Recorder" object for this request | |
35 | 0 | private Recorder recorder = null; |
36 | public Recorder getRecorder() { | |
37 | 0 | return this.recorder; |
38 | } | |
39 | public void setRecorder(Recorder recorder) { | |
40 | 0 | this.recorder = recorder; |
41 | 0 | } |
42 | ||
43 | ||
44 | // ------------------------------------------------------- Lifecycle Methods | |
45 | ||
46 | ||
47 | /** | |
48 | * <p>Record an init event.</p> | |
49 | */ | |
50 | public void init() { | |
51 | 0 | getRecorder().record("init1"); |
52 | 0 | System.out.println("Lifecycle1.init()"); |
53 | 0 | if (FacesContext.getCurrentInstance() == null) { |
54 | 0 | getRecorder().record("noContext"); |
55 | 0 | System.out.println(" noContext"); |
56 | } | |
57 | 0 | } |
58 | ||
59 | ||
60 | /** | |
61 | * <p>Record a preprocess event.</p> | |
62 | */ | |
63 | public void preprocess() { | |
64 | 0 | getRecorder().record("preprocess1"); |
65 | 0 | System.out.println("Lifecycle1.preprocess()"); |
66 | 0 | } |
67 | ||
68 | ||
69 | /** | |
70 | * <p>Record a prerender event.</p> | |
71 | */ | |
72 | public void prerender() { | |
73 | 0 | getRecorder().record("prerender1"); |
74 | 0 | System.out.println("Lifecycle1.prerender()"); |
75 | 0 | } |
76 | ||
77 | ||
78 | /** | |
79 | * <p>Record a destroy event.</p> | |
80 | */ | |
81 | public void destroy() { | |
82 | 0 | getRecorder().record("destroy1"); |
83 | 0 | System.out.println("Lifecycle1.destroy()"); |
84 | 0 | System.out.println("Lifecycle1.init()"); |
85 | 0 | if (FacesContext.getCurrentInstance() == null) { |
86 | 0 | getRecorder().record("noContext"); |
87 | 0 | System.out.println(" noContext"); |
88 | } | |
89 | 0 | } |
90 | ||
91 | ||
92 | } |