01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package info.jtrac.wicket;
18:
19: import info.jtrac.Jtrac;
20: import info.jtrac.domain.ItemSearch;
21: import info.jtrac.domain.Space;
22: import info.jtrac.domain.User;
23: import org.apache.wicket.markup.html.panel.Panel;
24: import org.slf4j.Logger;
25: import org.slf4j.LoggerFactory;
26:
27: /**
28: * base class for all wicket panels, this provides
29: * a way to access the spring managed service layer
30: */
31: public class BasePanel extends Panel {
32:
33: protected static final Logger logger = LoggerFactory
34: .getLogger(BasePanel.class);
35:
36: protected Jtrac getJtrac() {
37: return ComponentUtils.getJtrac(this );
38: }
39:
40: protected User getPrincipal() {
41: return ComponentUtils.getPrincipal(this );
42: }
43:
44: protected void setCurrentSpace(Space space) {
45: ComponentUtils.setCurrentSpace(this , space);
46: }
47:
48: protected Space getCurrentSpace() {
49: return ComponentUtils.getCurrentSpace(this );
50: }
51:
52: protected void setCurrentItemSearch(ItemSearch itemSearch) {
53: ComponentUtils.setCurrentItemSearch(this , itemSearch);
54: }
55:
56: protected ItemSearch getCurrentItemSearch() {
57: return ComponentUtils.getCurrentItemSearch(this );
58: }
59:
60: protected String localize(String key) {
61: return ComponentUtils.localize(this , key);
62: }
63:
64: protected String localize(String key, Object... params) {
65: return ComponentUtils.localize(this , key, params);
66: }
67:
68: protected void refreshPrincipal(User user) {
69: ComponentUtils.refreshPrincipal(this , user);
70: }
71:
72: protected void refreshPrincipal() {
73: ComponentUtils.refreshPrincipal(this );
74: }
75:
76: public BasePanel(String id) {
77: super(id);
78: }
79:
80: }
|