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: Annotated.java 464373 2006-10-16 04:21:54Z rahul $
18   */
19  
20  package org.apache.shale.examples.test.tiger;
21  
22  import javax.faces.context.FacesContext;
23  import org.apache.shale.tiger.view.Destroy;
24  import org.apache.shale.tiger.view.Init;
25  import org.apache.shale.tiger.view.Preprocess;
26  import org.apache.shale.tiger.view.Prerender;
27  import org.apache.shale.tiger.view.View;
28  import org.apache.shale.view.faces.FacesConstants;
29  
30  /***
31   * <p>View Controller class for <code>/standard.jsp</code>.
32   * This class uses Tiger Extensions annotations, so it should
33   * receive lifecycle callbacks equivalent to a class that
34   * implements <code>ViewController</code>.</p>
35   */
36  @View
37  public class Annotated {
38      
39  
40      // ------------------------------------------------------ Instance Variables
41  
42  
43      /***
44       * <p>Sequence number for identifying order of event callbacks.</p>
45       */
46      private int sequence = 0;
47  
48  
49      // -------------------------------------------------------------- Properties
50  
51  
52      /***
53       * <p>Calling order for the init() method.</p>
54       */
55      private int initCalled = 0;
56  
57      public int getInitCalled() {
58          return initCalled;
59      }
60  
61  
62      /***
63       * <p>Calling order for the preprocess() method.</p>
64       */
65      private int preprocessCalled = 0;
66  
67      public int getPreprocessCalled() {
68          return preprocessCalled;
69      }
70  
71  
72      /***
73       * <p>Calling order for the prerender() method.</p>
74       */
75      private int prerenderCalled = 0;
76  
77      public int getPrerenderCalled() {
78          return prerenderCalled;
79      }
80  
81  
82      /***
83       * <p>Calling order for the destroy() method.</p>
84       */
85      private int destroyCalled = 0;
86  
87      public int getDestroyCalled() {
88          return destroyCalled;
89      }
90  
91  
92      // -------------------------------------------------------- Lifecycle Events
93  
94  
95      // Record the order in which each event was called
96  
97      @Init
98      public void myInit() {
99          initCalled = ++sequence;
100     }
101 
102     @Preprocess
103     public void myPreprocess() {
104         preprocessCalled = ++sequence;
105     }
106 
107     @Prerender
108     public void myPrerender() {
109         prerenderCalled = ++sequence;
110     }
111 
112     @Destroy
113     public void myDestroy() {
114         destroyCalled = ++sequence;
115     }
116 
117 
118     // ------------------------------------------------------------- View Events
119 
120 
121     // Process a click on the resubmit link
122     public String resubmit() {
123         return null;
124     }
125 
126 
127 }