This project has retired. For details please refer to its
Attic page.
RenditionTable 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.Rendition;
24import org.apache.chemistry.opencmis.workbench.ClientHelper;
25import org.apache.chemistry.opencmis.workbench.model.ClientModel;
2627publicclassRenditionTableextendsAbstractDetailsTable {
2829privatestaticfinallong serialVersionUID = 1L;
3031privatestaticfinal String[] COLUMN_NAMES = { "Title", "Kind", "MIME Type", "Size", "Stream Id" };
32privatestaticfinalint[] COLUMN_WIDTHS = { 200, 200, 80, 80, 200 };
3334publicRenditionTable(ClientModel model) {
35super();
36 init(model, COLUMN_NAMES, COLUMN_WIDTHS);
37 }
3839 @Override
40publicvoid doubleClickAction(MouseEvent e, int rowIndex) {
41 String streamId = getObject().getRenditions().get(getRowSorter().convertRowIndexToModel(rowIndex)).getStreamId();
4243if (e.isShiftDown()) {
44 ClientHelper.download(this.getParent(), getObject(), streamId);
45 } else {
46 ClientHelper.open(this.getParent(), getObject(), streamId);
47 }
48 }
4950 @Override
51publicint getDetailRowCount() {
52if (getObject().getRenditions() == null) {
53return 0;
54 }
5556return getObject().getRenditions().size();
57 }
5859 @Override
60public Object getDetailValueAt(int rowIndex, int columnIndex) {
61 Rendition rendition = getObject().getRenditions().get(rowIndex);
6263switch (columnIndex) {
64case 0:
65return rendition.getTitle();
66case 1:
67return rendition.getKind();
68case 2:
69return rendition.getMimeType();
70case 3:
71return rendition.getLength();
72case 4:
73return rendition.getStreamId();
74 }
7576returnnull;
77 }
78 }