73 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
182 |
ilm |
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
73 |
ilm |
5 |
*
|
|
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
9 |
* language governing permissions and limitations under the License.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.erp.config;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.sql.users.rights.LockAdminUserRight;
|
|
|
17 |
import org.openconcerto.sql.users.rights.UserRights;
|
144 |
ilm |
18 |
import org.openconcerto.sql.users.rights.UserRightsManager;
|
73 |
ilm |
19 |
import org.openconcerto.ui.group.Group;
|
|
|
20 |
|
|
|
21 |
public class MinimalMenuConfiguration implements MenuConfiguration {
|
144 |
ilm |
22 |
private ComptaPropsConfiguration configuration;
|
73 |
ilm |
23 |
|
144 |
ilm |
24 |
public MinimalMenuConfiguration(ComptaPropsConfiguration configuration) {
|
|
|
25 |
this.configuration = configuration;
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
public ComptaPropsConfiguration getConfiguration() {
|
|
|
29 |
return configuration;
|
|
|
30 |
}
|
|
|
31 |
|
73 |
ilm |
32 |
@Override
|
|
|
33 |
public final MenuAndActions createMenuAndActions() {
|
|
|
34 |
final MenuAndActions res = new MenuAndActions();
|
|
|
35 |
this.createMenuGroup(res.getGroup());
|
144 |
ilm |
36 |
new DefaultMenuConfiguration(configuration).registerMenuActions(res);
|
73 |
ilm |
37 |
return res;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
private void createMenuGroup(Group res) {
|
144 |
ilm |
41 |
final UserRights rights = UserRightsManager.getCurrentUserRights();
|
73 |
ilm |
42 |
|
|
|
43 |
final Group fileMenu = new Group(MainFrame.FILE_MENU);
|
|
|
44 |
fileMenu.addItem("backup");
|
182 |
ilm |
45 |
fileMenu.addItem(MainFrame.QUIT_MENU_ITEM);
|
73 |
ilm |
46 |
res.add(fileMenu);
|
|
|
47 |
|
|
|
48 |
if (rights.haveRight(LockAdminUserRight.LOCK_MENU_ADMIN)) {
|
|
|
49 |
final Group structMenu = new Group(MainFrame.STRUCTURE_MENU);
|
|
|
50 |
structMenu.addItem("user.list");
|
|
|
51 |
res.add(structMenu);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
final Group helpMenu = new Group(MainFrame.HELP_MENU);
|
182 |
ilm |
55 |
helpMenu.addItem(MainFrame.ABOUT_MENU_ITEM);
|
73 |
ilm |
56 |
|
|
|
57 |
res.add(helpMenu);
|
|
|
58 |
}
|
|
|
59 |
}
|