1 | /** |
---|
2 | * MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface. |
---|
3 | * Copyright (C) 2012 Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior |
---|
4 | * |
---|
5 | * This program is free software: you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU Affero General Public License as |
---|
7 | * published by the Free Software Foundation, either version 3 of the |
---|
8 | * License, or (at your option) any later version. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | * GNU Affero General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Affero General Public License |
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | */ |
---|
18 | |
---|
19 | /******************************************************************************\ |
---|
20 | * |
---|
21 | * This product was developed by |
---|
22 | * |
---|
23 | * SERVIÃO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), |
---|
24 | * |
---|
25 | * a government company established under Brazilian law (5.615/70), |
---|
26 | * at Department of Development of Porto Alegre. |
---|
27 | * |
---|
28 | \******************************************************************************/ |
---|
29 | |
---|
30 | package serpro.mailarchiver.view.admin; |
---|
31 | |
---|
32 | import serpro.mailarchiver.view.BaseComponent; |
---|
33 | |
---|
34 | import com.eventrouter.message.Message1; |
---|
35 | |
---|
36 | import com.vaadin.terminal.ThemeResource; |
---|
37 | import com.vaadin.ui.Alignment; |
---|
38 | import com.vaadin.ui.Button; |
---|
39 | import com.vaadin.ui.Button.ClickEvent; |
---|
40 | import com.vaadin.ui.Button.ClickListener; |
---|
41 | import com.vaadin.ui.Embedded; |
---|
42 | import com.vaadin.ui.themes.BaseTheme; |
---|
43 | |
---|
44 | class Toolbar extends BaseComponent.HorizontalLayout { |
---|
45 | |
---|
46 | private Button config; |
---|
47 | private Button importGears; |
---|
48 | private Button upload; |
---|
49 | private Button explore; |
---|
50 | private Button search; |
---|
51 | private Button help; |
---|
52 | private Button terminal; |
---|
53 | |
---|
54 | private Button logout; |
---|
55 | |
---|
56 | private Embedded logo; |
---|
57 | |
---|
58 | Toolbar() { |
---|
59 | new ToolbarController(getDisplayId()); |
---|
60 | } |
---|
61 | |
---|
62 | @Override |
---|
63 | public final String getDisplayId() { |
---|
64 | return "toolbar"; |
---|
65 | } |
---|
66 | |
---|
67 | @Override |
---|
68 | public Toolbar init() { |
---|
69 | |
---|
70 | setStyleName("toolbar"); |
---|
71 | setMargin(true); |
---|
72 | setSpacing(true); |
---|
73 | setWidth("100%"); |
---|
74 | |
---|
75 | //---------------------------------------------------------------------- |
---|
76 | // config = new Button("Config"); |
---|
77 | // config.setIcon(new ThemeResource("toolbar/icons/48/config.png")); |
---|
78 | // config.addListener(new ClickListener() { |
---|
79 | // @Override |
---|
80 | // public void buttonClick(ClickEvent event) { |
---|
81 | // new Message1<ClickEvent>(event){} |
---|
82 | // .publish("/mailarchiver/action/config_selected") |
---|
83 | // .await(); |
---|
84 | // } |
---|
85 | // }); |
---|
86 | // addComponent(config); |
---|
87 | |
---|
88 | //---------------------------------------------------------------------- |
---|
89 | importGears = new Button("Gears"); |
---|
90 | importGears.setIcon(new ThemeResource("toolbar/icons/48/gears.png")); |
---|
91 | importGears.addListener(new ClickListener() { |
---|
92 | @Override |
---|
93 | public void buttonClick(ClickEvent event) { |
---|
94 | new Message1<ClickEvent>(event){} |
---|
95 | .publish("/mailarchiver/action/importGears_selected") |
---|
96 | .await(); |
---|
97 | } |
---|
98 | }); |
---|
99 | addComponent(importGears); |
---|
100 | |
---|
101 | //---------------------------------------------------------------------- |
---|
102 | upload = new Button("Upload"); |
---|
103 | upload.setIcon(new ThemeResource("toolbar/icons/48/upload.png")); |
---|
104 | upload.addListener(new ClickListener() { |
---|
105 | @Override |
---|
106 | public void buttonClick(ClickEvent event) { |
---|
107 | new Message1<ClickEvent>(event){} |
---|
108 | .publish("/mailarchiver/action/upload_selected") |
---|
109 | .await(); |
---|
110 | } |
---|
111 | }); |
---|
112 | addComponent(upload); |
---|
113 | |
---|
114 | //---------------------------------------------------------------------- |
---|
115 | // explore = new Button("Explore"); |
---|
116 | // explore.setIcon(new ThemeResource("toolbar/icons/48/explore.png")); |
---|
117 | // explore.addListener(new ClickListener() { |
---|
118 | // @Override |
---|
119 | // public void buttonClick(ClickEvent event) { |
---|
120 | // new Message1<ClickEvent>(event){} |
---|
121 | // .publish("/mailarchiver/action/explore_selected") |
---|
122 | // .await(); |
---|
123 | // } |
---|
124 | // }); |
---|
125 | // addComponent(explore); |
---|
126 | |
---|
127 | //---------------------------------------------------------------------- |
---|
128 | search = new Button("Search"); |
---|
129 | search.setIcon(new ThemeResource("toolbar/icons/48/search.png")); |
---|
130 | search.addListener(new ClickListener() { |
---|
131 | @Override |
---|
132 | public void buttonClick(ClickEvent event) { |
---|
133 | new Message1<ClickEvent>(event){} |
---|
134 | .publish("/mailarchiver/action/search_selected") |
---|
135 | .await(); |
---|
136 | } |
---|
137 | }); |
---|
138 | addComponent(search); |
---|
139 | |
---|
140 | //---------------------------------------------------------------------- |
---|
141 | // help = new Button("Help"); |
---|
142 | // help.setIcon(new ThemeResource("toolbar/icons/48/help.png")); |
---|
143 | // help.addListener(new ClickListener() { |
---|
144 | // @Override |
---|
145 | // public void buttonClick(ClickEvent event) { |
---|
146 | // new Message1<ClickEvent>(event){} |
---|
147 | // .publish("/mailarchiver/action/help_selected") |
---|
148 | // .await(); |
---|
149 | // } |
---|
150 | // }); |
---|
151 | // addComponent(help); |
---|
152 | |
---|
153 | //---------------------------------------------------------------------- |
---|
154 | terminal = new Button("Terminal"); |
---|
155 | terminal.setIcon(new ThemeResource("toolbar/icons/48/terminal.png")); |
---|
156 | terminal.addListener(new ClickListener() { |
---|
157 | @Override |
---|
158 | public void buttonClick(ClickEvent event) { |
---|
159 | new Message1<ClickEvent>(event){} |
---|
160 | .publish("/mailarchiver/action/terminal_selected") |
---|
161 | .await(); |
---|
162 | } |
---|
163 | }); |
---|
164 | addComponent(terminal); |
---|
165 | |
---|
166 | //---------------------------------------------------------------------- |
---|
167 | logout = new Button("Logout"); |
---|
168 | logout.setHeight("20px"); |
---|
169 | logout.setStyleName(BaseTheme.BUTTON_LINK); |
---|
170 | logout.addListener(new ClickListener() { |
---|
171 | @Override |
---|
172 | public void buttonClick(ClickEvent event) { |
---|
173 | new Message1<ClickEvent>(event){} |
---|
174 | .publish("/mailarchiver/action/logout_selected") |
---|
175 | .await(); |
---|
176 | } |
---|
177 | }); |
---|
178 | addComponent(logout); |
---|
179 | setComponentAlignment(logout, Alignment.BOTTOM_RIGHT); |
---|
180 | setExpandRatio(logout, 1.0f); |
---|
181 | |
---|
182 | //---------------------------------------------------------------------- |
---|
183 | logo = new Embedded("", new ThemeResource("toolbar/img/mailarchiver_logo.png")); |
---|
184 | addComponent(logo); |
---|
185 | setComponentAlignment(logo, Alignment.MIDDLE_RIGHT); |
---|
186 | |
---|
187 | //---------------------------------------------------------------------- |
---|
188 | return this; |
---|
189 | } |
---|
190 | |
---|
191 | } |
---|