This project has retired. For details please refer to its
Attic page.
ACLTable xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.workbench.details;
20
21 import java.awt.Cursor;
22 import java.awt.event.MouseEvent;
23 import java.util.Collection;
24
25 import org.apache.chemistry.opencmis.commons.data.Ace;
26 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
27 import org.apache.chemistry.opencmis.commons.enums.Action;
28 import org.apache.chemistry.opencmis.workbench.AclEditorFrame;
29 import org.apache.chemistry.opencmis.workbench.ClientHelper;
30 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
31
32 public class ACLTable extends AbstractDetailsTable {
33
34 private static final long serialVersionUID = 1L;
35
36 private static final String[] COLUMN_NAMES = { "Principal", "Permissions", "Direct" };
37 private static final int[] COLUMN_WIDTHS = { 200, 400, 50 };
38
39 public ACLTable(ClientModel model) {
40 super();
41 init(model, COLUMN_NAMES, COLUMN_WIDTHS);
42 }
43
44 @Override
45 public void doubleClickAction(MouseEvent e, int rowIndex) {
46 AllowableActions aa = getObject().getAllowableActions();
47
48 if ((aa == null) || (aa.getAllowableActions() == null)
49 || aa.getAllowableActions().contains(Action.CAN_APPLY_ACL)) {
50 new AclEditorFrame(getClientModel(), getObject());
51
52 try {
53 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
54 getClientModel().reloadObject();
55 getClientModel().reloadFolder();
56 } catch (Exception ex) {
57 ClientHelper.showError(null, ex);
58 } finally {
59 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
60 }
61 }
62 }
63
64 public int getDetailRowCount() {
65 if ((getObject().getAcl() == null) || (getObject().getAcl().getAces() == null)) {
66 return 0;
67 }
68
69 return getObject().getAcl().getAces().size();
70 }
71
72 public Object getDetailValueAt(int rowIndex, int columnIndex) {
73 Ace ace = getObject().getAcl().getAces().get(rowIndex);
74
75 switch (columnIndex) {
76 case 0:
77 return ace.getPrincipalId();
78 case 1:
79 return ace.getPermissions();
80 case 2:
81 return ace.isDirect();
82 }
83
84 return null;
85 }
86
87 @Override
88 public Class<?> getDetailColumClass(int columnIndex) {
89 if (columnIndex == 1) {
90 return Collection.class;
91 } else if (columnIndex == 2) {
92 return Boolean.class;
93 }
94
95 return super.getDetailColumClass(columnIndex);
96 }
97 }