This project has retired. For details please refer to its
Attic page.
PropertyTable 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.Cursor;
22import java.awt.event.MouseEvent;
23import java.util.Collection;
2425import org.apache.chemistry.opencmis.client.api.Property;
26import org.apache.chemistry.opencmis.commons.data.AllowableActions;
27import org.apache.chemistry.opencmis.commons.enums.Action;
28import org.apache.chemistry.opencmis.workbench.ClientHelper;
29import org.apache.chemistry.opencmis.workbench.PropertyEditorFrame;
30import org.apache.chemistry.opencmis.workbench.model.ClientModel;
3132publicclassPropertyTableextendsAbstractDetailsTable {
3334privatestaticfinallong serialVersionUID = 1L;
3536privatestaticfinal String[] COLUMN_NAMES = { "Name", "Id", "Type", "Value" };
37privatestaticfinalint[] COLUMN_WIDTHS = { 200, 200, 80, 300 };
3839publicPropertyTable(ClientModel model) {
40super();
41 init(model, COLUMN_NAMES, COLUMN_WIDTHS);
42 }
4344 @Override
45publicvoid doubleClickAction(MouseEvent e, int rowIndex) {
46 AllowableActions aa = getObject().getAllowableActions();
4748if ((aa == null) || (aa.getAllowableActions() == null)
49 || aa.getAllowableActions().contains(Action.CAN_UPDATE_PROPERTIES)) {
50newPropertyEditorFrame(getClientModel(), getObject());
51 }
52 }
5354publicint getDetailRowCount() {
55return getObject().getProperties().size();
56 }
5758public Object getDetailValueAt(int rowIndex, int columnIndex) {
59 Property<?> property = getObject().getProperties().get(rowIndex);
6061switch (columnIndex) {
62case 0:
63return property.getDefinition().getDisplayName();
64case 1:
65return property.getId();
66case 2:
67return property.getDefinition().getPropertyType().value();
68case 3:
69return property.getValues();
70 }
7172returnnull;
73 }
7475 @Override
76public Class<?> getDetailColumClass(int columnIndex) {
77if (columnIndex == 3) {
78return Collection.class;
79 }
8081returnsuper.getDetailColumClass(columnIndex);
82 }
83 }