KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > event > PhaseId


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.faces.event;
17
18 import java.util.ArrayList JavaDoc;
19 import java.util.Collections JavaDoc;
20
21 /**
22  * @author Thomas Spiegl (latest modification by $Author: mwessendorf $)
23  * @version $Revision: 1.4 $ $Date: 2004/07/01 22:01:14 $
24  * $Log: PhaseId.java,v $
25  * Revision 1.4 2004/07/01 22:01:14 mwessendorf
26  * ASF switch
27  *
28  * Revision 1.3 2004/05/21 10:38:01 manolito
29  * trivial change in toString
30  *
31  */

32 public class PhaseId {
33
34     // FIELDS
35
public static final javax.faces.event.PhaseId ANY_PHASE;
36     public static final javax.faces.event.PhaseId APPLY_REQUEST_VALUES;
37     public static final javax.faces.event.PhaseId INVOKE_APPLICATION;
38     public static final javax.faces.event.PhaseId PROCESS_VALIDATIONS;
39     public static final javax.faces.event.PhaseId RENDER_RESPONSE;
40     public static final javax.faces.event.PhaseId RESTORE_VIEW;
41     public static final javax.faces.event.PhaseId UPDATE_MODEL_VALUES;
42     public static final java.util.List JavaDoc VALUES;
43
44     static
45     {
46         int i = 0;
47         ArrayList JavaDoc list = new ArrayList JavaDoc(6);
48
49         ANY_PHASE = new PhaseId("ANY_PHASE",i++);
50         list.add(ANY_PHASE);
51         RESTORE_VIEW = new PhaseId("RESTORE_VIEW",i++);
52         list.add(RESTORE_VIEW);
53         APPLY_REQUEST_VALUES = new PhaseId("APPLY_REQUEST_VALUES",i++);
54         list.add(APPLY_REQUEST_VALUES);
55         PROCESS_VALIDATIONS = new PhaseId("PROCESS_VALIDATIONS",i++);
56         list.add(PROCESS_VALIDATIONS);
57         UPDATE_MODEL_VALUES = new PhaseId("UPDATE_MODEL_VALUES",i++);
58         list.add(UPDATE_MODEL_VALUES);
59         INVOKE_APPLICATION = new PhaseId("INVOKE_APPLICATION",i++);
60         list.add(INVOKE_APPLICATION);
61         RENDER_RESPONSE = new PhaseId("RENDER_RESPONSE",i++);
62         list.add(RENDER_RESPONSE);
63         VALUES = Collections.unmodifiableList(list);
64     }
65
66
67     private final String JavaDoc _name;
68     private final int _ordinal;
69
70     // CONSTRUCTORS
71
public PhaseId(String JavaDoc name, int ordinal)
72     {
73         this._name = name;
74         this._ordinal = ordinal;
75     }
76
77     // METHODS
78
public int compareTo(Object JavaDoc other)
79     {
80         return _ordinal - ((PhaseId)other)._ordinal;
81     }
82
83     public int getOrdinal()
84     {
85         return _ordinal;
86     }
87
88     public String JavaDoc toString()
89     {
90         return _name + "(" + _ordinal + ")";
91     }
92
93 }
94
Popular Tags