01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.integration.app1.pages;
16:
17: import org.apache.tapestry.ComponentResources;
18: import org.apache.tapestry.annotations.Inject;
19: import org.apache.tapestry.annotations.InjectPage;
20: import org.apache.tapestry.annotations.OnEvent;
21: import org.apache.tapestry.services.BindingSource;
22: import org.apache.tapestry.services.Request;
23:
24: public class InjectDemo {
25: // Named --- now demonstrating case insensitivity
26: // Now vestigal!
27: @Inject
28: private Request _request;
29:
30: // Via ComponentResourcesInjectionProvider
31: @Inject
32: private ComponentResources _resources;
33:
34: // Via ??? -- have to ensure that BindingSource
35: // stays unique.
36: @Inject
37: private BindingSource _bindingSource;
38:
39: @InjectPage
40: private Fred _fred;
41:
42: // Again, demonstrates case insensitivity
43: @InjectPage("barney")
44: private Runnable _barney;
45:
46: public BindingSource getBindingSource() {
47: return _bindingSource;
48: }
49:
50: public Request getRequest() {
51: return _request;
52: }
53:
54: public ComponentResources getResources() {
55: return _resources;
56: }
57:
58: @OnEvent(component="fred")
59: Object clickFred() {
60: return _fred;
61: }
62:
63: @OnEvent(component="barney")
64: Object clickBarney() {
65: return _barney;
66: }
67:
68: @OnEvent(component="wilma")
69: String clickWilma() {
70: return "Wilma";
71: }
72: }
|