1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.web.impl.ui.page.common;
20
21 import org.vaadin.navigator7.NavigableApplication;
22
23 import com.hack23.cia.service.api.ApplicationManager;
24 import com.hack23.cia.web.impl.ui.common.ApplicationUserState;
25 import com.hack23.cia.web.impl.ui.common.ApplicationUserStateHolder;
26 import com.vaadin.ui.Component;
27 import com.vaadin.ui.Panel;
28
29 /***
30 * The Class AbstractPanel.
31 */
32 public abstract class AbstractPanel extends Panel {
33
34 /*** The Constant serialVersionUID. */
35 private static final long serialVersionUID = 1L;
36
37 /*** The user state. */
38 private final ApplicationUserState userState;
39
40 /*** The application manager. */
41 private final ApplicationManager applicationManager;
42
43 /***
44 * Instantiates a new abstract panel.
45 */
46 public AbstractPanel() {
47 super();
48 userState= ApplicationUserStateHolder.getUserState();
49 applicationManager = ApplicationUserStateHolder.getUserState().getApplicationManager();
50 }
51
52 /***
53 * Gets the application manager.
54 *
55 * @return the application manager
56 */
57 public ApplicationManager getApplicationManager() {
58 return applicationManager;
59 }
60
61 /***
62 * Gets the user state.
63 *
64 * @return the user state
65 */
66 public ApplicationUserState getUserState() {
67 return userState;
68 }
69
70
71
72
73 /***
74 * Navigate to.
75 *
76 * @param page
77 * the page
78 */
79 public void navigateTo(final Class<? extends Component> page) {
80 NavigableApplication.getCurrentNavigableAppLevelWindow().getNavigator().navigateTo(page);
81
82 }
83
84
85
86
87 /***
88 * Navigate to.
89 *
90 * @param page
91 * the page
92 * @param params
93 * the params
94 */
95 public void navigateTo(final Class<? extends Component> page,final String params) {
96 NavigableApplication.getCurrentNavigableAppLevelWindow().getNavigator().navigateTo(page,params);
97 }
98
99 /***
100 * Translate from english.
101 *
102 * @param string
103 * the string
104 * @return the string
105 */
106 public String translateFromEnglish(final String string) {
107 return userState.translateFromEnglish(string);
108 }
109
110
111 }