You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2015/10/15 10:16:56 UTC
svn commit: r1708737 - in
/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench:
actions/DownloadPanel.java details/ActionsPanel.java
Author: fmui
Date: Thu Oct 15 08:16:56 2015
New Revision: 1708737
URL: http://svn.apache.org/viewvc?rev=1708737&view=rev
Log:
Workbench: added download action
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java?rev=1708737&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java Thu Oct 15 08:16:56 2015
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench.actions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.ClientHelper;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class DownloadPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField streamIdField;
+
+ public DownloadPanel(ClientModel model) {
+ super("Download Content", "Download", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ JPanel streamIdPanel = new JPanel(new BorderLayout());
+ streamIdPanel.setBackground(Color.WHITE);
+
+ streamIdPanel.add(new JLabel("Stream Id:"), BorderLayout.LINE_START);
+
+ streamIdField = new JTextField(30);
+ streamIdPanel.add(streamIdField, BorderLayout.CENTER);
+
+ addActionComponent(streamIdPanel);
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().hasAllowableAction(Action.CAN_GET_CONTENT_STREAM);
+ }
+
+ @Override
+ public boolean doAction() {
+ String streamId = streamIdField.getText().trim();
+ if (streamId.length() == 0) {
+ streamId = null;
+ }
+
+ ClientHelper.download(this, getObject(), streamId);
+ return true;
+ }
+}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java?rev=1708737&r1=1708736&r2=1708737&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java Thu Oct 15 08:16:56 2015
@@ -36,6 +36,7 @@ import org.apache.chemistry.opencmis.wor
import org.apache.chemistry.opencmis.workbench.actions.DeleteContentStreamPanel;
import org.apache.chemistry.opencmis.workbench.actions.DeletePanel;
import org.apache.chemistry.opencmis.workbench.actions.DeleteTreePanel;
+import org.apache.chemistry.opencmis.workbench.actions.DownloadPanel;
import org.apache.chemistry.opencmis.workbench.actions.MovePanel;
import org.apache.chemistry.opencmis.workbench.actions.PropertyUpdatePanel;
import org.apache.chemistry.opencmis.workbench.actions.RemoveObjectFromFolderPanel;
@@ -67,6 +68,7 @@ public class ActionsPanel extends JPanel
private AclUpdatePanel aclUpdatePanel;
private ApplyPolicyPanel applyPolicyPanel;
private RemovePolicyPanel removePolicyPanel;
+ private DownloadPanel downloadPanel;
public ActionsPanel(ClientModel model) {
super();
@@ -117,6 +119,9 @@ public class ActionsPanel extends JPanel
deleteContentStreamPanel.setObject(object);
deleteContentStreamPanel.setVisible(deleteContentStreamPanel.isAllowed());
+ downloadPanel.setObject(object);
+ downloadPanel.setVisible(downloadPanel.isAllowed());
+
addObjectToFolderPanel.setObject(object);
addObjectToFolderPanel.setVisible(addObjectToFolderPanel.isAllowed());
@@ -172,6 +177,9 @@ public class ActionsPanel extends JPanel
deleteContentStreamPanel = new DeleteContentStreamPanel(model);
add(deleteContentStreamPanel);
+ downloadPanel = new DownloadPanel(model);
+ add(downloadPanel);
+
addObjectToFolderPanel = new AddObjectToFolderPanel(model);
add(addObjectToFolderPanel);