KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > annotations > AnnotatedPage


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

15 package org.apache.tapestry.annotations;
16
17 import java.lang.annotation.Target JavaDoc;
18 import java.util.HashMap JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import org.apache.tapestry.IAsset;
22 import org.apache.tapestry.IComponent;
23 import org.apache.tapestry.IPage;
24 import org.apache.tapestry.IScript;
25 import org.apache.tapestry.form.Checkbox;
26 import org.apache.tapestry.form.TextField;
27 import org.apache.tapestry.html.BasePage;
28
29 /**
30  * Used by {@link org.apache.tapestry.annotations.TestAnnotationEnhancementWorker}. Also a chance
31  * to try each of the annotations out.
32  *
33  * @author Howard M. Lewis Ship
34  * @since 4.0
35  */

36 public abstract class AnnotatedPage extends BasePage
37 {
38     @Asset("/style/global.css")
39     public abstract IAsset getGlobalStylesheet();
40
41     @InjectObject("barney")
42     public abstract Object JavaDoc getInjectedObject();
43
44     @Bean
45     public abstract HashMap JavaDoc getHashMapBean();
46
47     @Bean(HashMap JavaDoc.class)
48     public abstract Map JavaDoc getMapBean();
49
50     @Bean(initializer = "intValue=10")
51     public abstract Target getBeanWithInitializer();
52
53     @Bean(value = HashMap JavaDoc.class, lifecycle = Lifecycle.RENDER)
54     public abstract Map JavaDoc getRenderLifecycleBean();
55
56     @Persist
57     public abstract int getPersistentProperty();
58
59     @Persist("client")
60     public abstract String JavaDoc getClientPersistentProperty();
61
62     @InjectAsset("stylesheet")
63     public abstract IAsset getStylesheetAsset();
64
65     @InjectComponent("fred")
66     public abstract TextField getFredField();
67
68     @InjectState("barneyASO")
69     public abstract Map JavaDoc getBarney();
70
71     @Parameter
72     public abstract String JavaDoc getSimpleParameter();
73
74     @Parameter(required = true)
75     public abstract String JavaDoc getRequiredParameter();
76
77     @Parameter(defaultBinding = "bean")
78     public abstract Object JavaDoc getBeanDefaultParameter();
79
80     @Parameter(cache = false)
81     public abstract Object JavaDoc getNonCachedParameter();
82
83     @Parameter(aliases = "fred")
84     public abstract String JavaDoc getAliasedParameter();
85
86     @Parameter
87     @Deprecated JavaDoc
88     public abstract int getDeprecatedParameter();
89
90     @Parameter(name = "fred")
91     public abstract double getNamedParameter();
92
93     @InjectPage("SomePageName")
94     public abstract IPage getMyPage();
95
96     @Component(type = "TextField")
97     public abstract TextField getTextField();
98
99     @Component(type = "Checkbox", id = "email")
100     public abstract Checkbox getEmailField();
101
102     @Component(type = "TextField", inheritInformalParameters = true)
103     public abstract IComponent getInherit();
104
105     @Component(type = "Conditional", bindings =
106     { "condition=message", "element=div" })
107     public abstract IComponent getComponentWithBindings();
108
109     @Component(type = "TextField", bindings =
110     { "value = email", "displayName = message:email-label" })
111     public abstract IComponent getWhitespace();
112
113     @Message
114     public abstract String JavaDoc noArgsMessage();
115
116     @Message("message-key")
117     public abstract String JavaDoc messageWithSpecificKey();
118
119     @Message
120     public abstract String JavaDoc messageWithParameters(String JavaDoc foo, Map JavaDoc bar);
121
122     @Message
123     public abstract String JavaDoc messageWithPrimitives(int foo, double bar);
124
125     @Message
126     public abstract void voidMessage();
127
128     @Message
129     public abstract String JavaDoc getLikeGetter();
130
131     @InjectMeta("fred")
132     public abstract String JavaDoc getMetaFred();
133
134     @InjectScript("foo.script")
135     public abstract IScript getScript();
136 }
137
Popular Tags