This project has retired. For details please refer to its
Attic page.
PolicyTable xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.workbench.details;
2021import java.awt.event.MouseEvent;
2223import org.apache.chemistry.opencmis.client.api.ObjectId;
24import org.apache.chemistry.opencmis.client.api.Policy;
25import org.apache.chemistry.opencmis.workbench.ClientHelper;
26import org.apache.chemistry.opencmis.workbench.model.ClientModel;
2728publicclassPolicyTableextendsAbstractDetailsTable {
2930privatestaticfinallong serialVersionUID = 1L;
3132privatestaticfinal String[] COLUMN_NAMES = { "Name", "Id" };
33privatestaticfinalint[] COLUMN_WIDTHS = { 200, 400 };
3435publicPolicyTable(ClientModel model) {
36super();
37 init(model, COLUMN_NAMES, COLUMN_WIDTHS);
38 }
3940 @Override
41publicvoid singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
42if (getColumnClass(colIndex) != ObjectId.class) {
43return;
44 }
4546try {
47 getClientModel().loadObject(
48 getObject().getPolicies().get(getRowSorter().convertRowIndexToModel(rowIndex)).getId());
49 setTab(0);
50 } catch (Exception ex) {
51 ClientHelper.showError(this, ex);
52 }
53 }
5455publicint getDetailRowCount() {
56if (getObject().getPolicies() == null) {
57return 0;
58 }
5960return getObject().getPolicies().size();
61 }
6263public Object getDetailValueAt(int rowIndex, int columnIndex) {
64 Policy policy = getObject().getPolicies().get(rowIndex);
6566switch (columnIndex) {
67case 0:
68return policy.getName();
69case 1:
70return policy;
71 }
7273returnnull;
74 }
7576 @Override
77public Class<?> getDetailColumClass(int columnIndex) {
78if (columnIndex == 1) {
79return ObjectId.class;
80 }
8182returnsuper.getDetailColumClass(columnIndex);
83 }
84 }