Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
Line 12... |
Line 12... |
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.sql.users.rights;
|
14 |
package org.openconcerto.sql.users.rights;
|
15 |
|
15 |
|
16 |
import static java.util.Arrays.asList;
|
16 |
import static java.util.Arrays.asList;
|
17 |
|
- |
|
18 |
import org.openconcerto.sql.element.GlobalMapper;
|
17 |
import org.openconcerto.sql.element.GlobalMapper;
|
19 |
import org.openconcerto.sql.element.SQLComponent;
|
18 |
import org.openconcerto.sql.element.SQLComponent;
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
19 |
import org.openconcerto.sql.element.SQLElement;
|
- |
|
20 |
import org.openconcerto.sql.element.SQLElementDirectory;
|
21 |
import org.openconcerto.sql.model.DBRoot;
|
21 |
import org.openconcerto.sql.model.DBRoot;
|
22 |
import org.openconcerto.sql.model.SQLTable;
|
22 |
import org.openconcerto.sql.model.SQLTable;
|
23 |
import org.openconcerto.sql.utils.SQLCreateTable;
|
23 |
import org.openconcerto.sql.utils.SQLCreateTable;
|
- |
|
24 |
import org.openconcerto.sql.view.list.action.ListEvent;
|
- |
|
25 |
import org.openconcerto.sql.view.list.action.SQLRowValuesAction;
|
- |
|
26 |
import org.openconcerto.sql.view.list.action.SQLRowValuesAction.PredicateRowAction;
|
24 |
|
27 |
|
- |
|
28 |
import java.awt.Toolkit;
|
- |
|
29 |
import java.awt.datatransfer.Clipboard;
|
25 |
import java.util.ArrayList;
|
30 |
import java.util.ArrayList;
|
26 |
import java.util.Collections;
|
31 |
import java.util.Collections;
|
27 |
import java.util.List;
|
32 |
import java.util.List;
|
28 |
import java.util.Set;
|
33 |
import java.util.Set;
|
29 |
|
34 |
|
Line 53... |
Line 58... |
53 |
res.add(create);
|
58 |
res.add(create);
|
54 |
|
59 |
|
55 |
return res;
|
60 |
return res;
|
56 |
}
|
61 |
}
|
57 |
|
62 |
|
- |
|
63 |
static private final SQLRowValuesAction COPY_ACTION = new PredicateRowAction(true, (le) -> {
|
- |
|
64 |
final Toolkit toolkit = Toolkit.getDefaultToolkit();
|
- |
|
65 |
final Clipboard systemClipboard = toolkit.getSystemClipboard();
|
- |
|
66 |
systemClipboard.setContents(new UserRightCopySelection(le.getSelectedRowAccessors()), null);
|
- |
|
67 |
}).setPredicate(ListEvent.getNonEmptySelectionPredicate()).setName("Copier");
|
- |
|
68 |
|
58 |
public UserRightSQLElement(final DBRoot r) {
|
69 |
public UserRightSQLElement(final DBRoot r) {
|
59 |
super(r.findTable(TABLE_NAME), null, "sql.user-right");
|
70 |
super(r.findTable(TABLE_NAME), null, "sql.user-right");
|
- |
|
71 |
|
60 |
final UserRightGroup group = new UserRightGroup();
|
72 |
final UserRightGroup group = new UserRightGroup();
|
61 |
GlobalMapper.getInstance().map(UserRightSQLComponent.ID, group);
|
73 |
GlobalMapper.getInstance().map(UserRightSQLComponent.ID, group);
|
62 |
setDefaultGroup(group);
|
74 |
setDefaultGroup(group);
|
- |
|
75 |
getRowValuesActions().add(COPY_ACTION);
|
63 |
}
|
76 |
}
|
64 |
|
77 |
|
65 |
protected List<String> getListFields() {
|
78 |
protected List<String> getListFields() {
|
66 |
// don't display USER to avoid undefined
|
79 |
// don't display USER to avoid undefined
|
67 |
return asList("ID_RIGHT", "OBJECT", "HAVE_RIGHT");
|
80 |
return asList("ID_RIGHT", "OBJECT", "HAVE_RIGHT");
|