chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1762181 [1/3] - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: ./ actions/ details/ model/ swing/ types/ worker/
Date Sun, 25 Sep 2016 10:29:03 GMT
Author: fmui
Date: Sun Sep 25 10:29:02 2016
New Revision: 1762181

URL: http://svn.apache.org/viewvc?rev=1762181&view=rev
Log:
added a bunch of new Workbench features and improvements

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/WorkbenchFileChooser.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/DeleteWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/InfoWorkbenchWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/LoadFolderWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/LoadObjectWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/OpenContentWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/StoreWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/TempFileContentWorker.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/worker/WorkbenchWorker.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateItemDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreatePolicyDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateRelationshipDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AclUpdatePanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/ApplyPolicyPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckInPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckOutPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CopyPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteContentStreamPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeletePanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteTreePanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DownloadPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/MovePanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemovePolicyPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/SetContentStreamPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ACLTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/TypeDefinitionInfoPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/TypesFrame.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java Sun Sep 25 10:29:02 2016
@@ -66,6 +66,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.AddIcon;
 import org.apache.chemistry.opencmis.workbench.icons.RemoveIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class AclEditorFrame extends JFrame {
 
@@ -294,7 +295,7 @@ public class AclEditorFrame extends JFra
                 }
 
                 object.applyAcl(adds, removes, aclPropagation);
-                model.reloadObject();
+                LoadObjectWorker.reloadObject(this, model);
             }
 
             return true;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java Sun Sep 25 10:29:02 2016
@@ -19,14 +19,15 @@
 package org.apache.chemistry.opencmis.workbench;
 
 import java.awt.BorderLayout;
-import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.Toolkit;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.GregorianCalendar;
 import java.util.List;
 
@@ -49,6 +50,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
 import org.apache.chemistry.opencmis.workbench.swing.GregorianCalendarRenderer;
+import org.apache.chemistry.opencmis.workbench.worker.InfoWorkbenchWorker;
 
 public class ChangeLogFrame extends JFrame {
 
@@ -101,20 +103,7 @@ public class ChangeLogFrame extends JFra
                     changeLogToken = null;
                 }
 
-                ChangeEvents events = null;
-                try {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                    events = model.getClientSession().getSession().getContentChanges(changeLogToken, true, 1000);
-                } catch (Exception ex) {
-                    ClientHelper.showError(null, ex);
-                    return;
-                } finally {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                }
-
-                changeLogTable.setChangeEvents(events.getChangeEvents());
-                changeLogTokenField.setText(events.getLatestChangeLogToken() == null ? "" : events
-                        .getLatestChangeLogToken());
+                (new ChangeLogWorker(ChangeLogFrame.this, changeLogToken)).executeTask();
             }
         });
         inputPanel.add(loadButton, BorderLayout.LINE_END);
@@ -134,7 +123,7 @@ public class ChangeLogFrame extends JFra
         setVisible(true);
     }
 
-    static class ChangeLogTable extends JTable {
+    private static class ChangeLogTable extends JTable {
 
         private static final long serialVersionUID = 1L;
 
@@ -271,4 +260,47 @@ public class ChangeLogFrame extends JFra
             }
         }
     }
+
+    private class ChangeLogWorker extends InfoWorkbenchWorker {
+
+        // in
+        private String changeLogToken;
+
+        // out
+        private ChangeEvents events;
+
+        public ChangeLogWorker(Window parent, String changeLogToken) {
+            super(parent);
+            this.changeLogToken = changeLogToken;
+        }
+
+        @Override
+        protected String getTitle() {
+            return "Retrieving Change Log";
+        }
+
+        @Override
+        protected String getMessage() {
+            return "Retrieving Change Log...";
+        }
+
+        @Override
+        protected Object doInBackground() throws Exception {
+            events = model.getClientSession().getSession().getContentChanges(changeLogToken, true, 1000);
+
+            return null;
+        }
+
+        @Override
+        protected void finializeTask() {
+            if (isCancelled() || events == null) {
+                changeLogTable.setChangeEvents(Collections.<ChangeEvent> emptyList());
+                changeLogTokenField.setText("");
+            } else {
+                changeLogTable.setChangeEvents(events.getChangeEvents());
+                changeLogTokenField.setText(events.getLatestChangeLogToken() == null ? "" : events
+                        .getLatestChangeLogToken());
+            }
+        }
+    }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java Sun Sep 25 10:29:02 2016
@@ -62,6 +62,8 @@ import org.apache.chemistry.opencmis.wor
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.model.ClientSession;
 import org.apache.chemistry.opencmis.workbench.types.TypesFrame;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -419,8 +421,8 @@ public class ClientFrame extends JFrame
             try {
                 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
-                model.loadFolder(clientSession.getStartFolderId(), false);
-                model.loadObject(clientSession.getStartFolderId());
+                LoadFolderWorker.loadFolderById(ClientFrame.this, model, clientSession.getStartFolderId());
+                LoadObjectWorker.loadObject(ClientFrame.this, model, clientSession.getStartFolderId());
 
                 toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true);
                 toolbarButton[BUTTON_TYPES].setEnabled(true);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java Sun Sep 25 10:29:02 2016
@@ -65,7 +65,6 @@ import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.InputMap;
 import javax.swing.JComponent;
-import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
@@ -78,18 +77,18 @@ import javax.swing.text.AttributeSet;
 import javax.swing.text.DefaultEditorKit;
 
 import org.apache.chemistry.opencmis.client.api.CmisObject;
-import org.apache.chemistry.opencmis.client.api.Document;
 import org.apache.chemistry.opencmis.client.api.ObjectId;
-import org.apache.chemistry.opencmis.client.api.Rendition;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.IOUtils;
-import org.apache.chemistry.opencmis.commons.impl.MimeTypes;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.WorkbenchFileChooser;
+import org.apache.chemistry.opencmis.workbench.worker.OpenContentWorker;
+import org.apache.chemistry.opencmis.workbench.worker.StoreWorker;
+import org.apache.chemistry.opencmis.workbench.worker.TempFileContentWorker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -104,7 +103,6 @@ public final class ClientHelper {
     public static final int ICON_BUTTON_ICON_SIZE = 16;
 
     private static final Logger LOG = LoggerFactory.getLogger(ClientHelper.class);
-    private static final int BUFFER_SIZE = 64 * 1024;
 
     private static final ImageIcon CMIS_ICON = getIcon("icon256.png");
     private static final List<BufferedImage> CMIS_ICON_LIST = new ArrayList<BufferedImage>();
@@ -125,12 +123,12 @@ public final class ClientHelper {
     private ClientHelper() {
     }
 
-    public static void logError(Exception ex) {
+    public static void logError(Throwable t) {
         if (LOG.isErrorEnabled()) {
-            LOG.error(ex.getClass().getSimpleName() + ": " + ex.getMessage(), ex);
+            LOG.error(t.getClass().getSimpleName() + ": " + t.getMessage(), t);
 
-            if (ex instanceof CmisBaseException) {
-                CmisBaseException cex = (CmisBaseException) ex;
+            if (t instanceof CmisBaseException) {
+                CmisBaseException cex = (CmisBaseException) t;
 
                 if (cex.getCode() != null) {
                     LOG.error("Error code: " + cex.getCode());
@@ -147,12 +145,12 @@ public final class ClientHelper {
         }
     }
 
-    public static void showError(Component parent, Exception ex) {
-        logError(ex);
+    public static void showError(Component parent, Throwable t) {
+        logError(t);
 
         JFrame frame = (parent == null ? null : (JFrame) SwingUtilities.getRoot(parent));
 
-        new ExceptionDialog(frame, ex);
+        new ExceptionDialog(frame, t);
     }
 
     public static boolean isMacOSX() {
@@ -243,45 +241,21 @@ public final class ClientHelper {
     }
 
     public static void download(Component component, CmisObject object, String streamId) {
-        ContentStream content = getContentStream(object, streamId);
-        if (content == null) {
-            return;
-        }
-
-        String filename = content.getFileName();
-        if (filename == null) {
-            if (object instanceof Document) {
-                filename = ((Document) object).getContentStreamFileName();
-            } else {
-                filename = object.getName();
-            }
-        }
-
-        JFileChooser fileChooser = new JFileChooser();
-        fileChooser.setSelectedFile(new File(filename));
-
-        int chooseResult = fileChooser.showDialog(component, "Download");
-        if (chooseResult == JFileChooser.APPROVE_OPTION) {
-            try {
-                storeStream(content.getStream(), fileChooser.getSelectedFile());
-            } catch (Exception e) {
-                showError(component, e);
-            }
-        }
-    }
-
-    public static void copy(Component component, File file) {
-        JFileChooser fileChooser = new JFileChooser();
-        fileChooser.setSelectedFile(new File(file.getName()));
-
-        int chooseResult = fileChooser.showDialog(component, "Download");
-        if (chooseResult == JFileChooser.APPROVE_OPTION) {
-            try {
-                storeStream(new FileInputStream(file), fileChooser.getSelectedFile());
-            } catch (Exception e) {
-                showError(component, e);
+        OpenContentWorker worker = new OpenContentWorker(null, object, streamId) {
+            @Override
+            protected void processStream(Component comp, ContentStream contentStream, String filename) {
+                WorkbenchFileChooser fileChooser = new WorkbenchFileChooser();
+                fileChooser.setSelectedFile(new File(filename));
+
+                int chooseResult = fileChooser.showDialog(comp, "Download");
+                if (chooseResult == WorkbenchFileChooser.APPROVE_OPTION) {
+                    (new StoreWorker(contentStream, fileChooser.getSelectedFile(), filename)).executeTask();
+                } else {
+                    IOUtils.closeQuietly(contentStream);
+                }
             }
-        }
+        };
+        worker.executeTask();
     }
 
     public static void open(Component component, CmisObject object, String streamId) {
@@ -290,31 +264,51 @@ public final class ClientHelper {
             return;
         }
 
-        Desktop desktop = Desktop.getDesktop();
+        final Desktop desktop = Desktop.getDesktop();
 
         if (!desktop.isSupported(Desktop.Action.OPEN)) {
             download(component, object, streamId);
             return;
         }
 
-        File file = null;
-
-        try {
-            file = createTempFileFromDocument(object, streamId);
-        } catch (Exception e) {
-            showError(component, e);
-            return;
-        }
+        TempFileContentWorker worker = new TempFileContentWorker(component, object, streamId) {
+            @Override
+            protected void processTempFile(File file) {
+                try {
+                    desktop.open(file);
+                } catch (Exception e) {
+                    if (e instanceof IOException) {
+                        copy(file);
+                    } else {
+                        showError(e);
+                    }
+                }
+            }
 
-        try {
-            desktop.open(file);
-        } catch (Exception e) {
-            if (e instanceof IOException) {
-                copy(component, file);
-            } else {
-                showError(component, e);
+            private void copy(File file) {
+                WorkbenchFileChooser fileChooser = new WorkbenchFileChooser();
+                fileChooser.setSelectedFile(new File(file.getName()));
+
+                int chooseResult = fileChooser.showDialog(getComponent(), "Download");
+                if (chooseResult == WorkbenchFileChooser.APPROVE_OPTION && !file.equals(fileChooser.getSelectedFile())) {
+                    try {
+                        InputStream in = null;
+                        OutputStream out = null;
+                        try {
+                            in = new FileInputStream(file);
+                            out = new FileOutputStream(fileChooser.getSelectedFile());
+                            IOUtils.copy(in, out, 64 * 1024);
+                        } finally {
+                            IOUtils.closeQuietly(in);
+                            IOUtils.closeQuietly(out);
+                        }
+                    } catch (Exception e) {
+                        showError(e);
+                    }
+                }
             }
-        }
+        };
+        worker.executeTask();
     }
 
     public static File createTempFile(String filename) {
@@ -331,78 +325,6 @@ public final class ClientHelper {
         return tempFile;
     }
 
-    public static File createTempFileFromDocument(CmisObject object, String streamId) throws IOException {
-        ContentStream content = getContentStream(object, streamId);
-        if (content == null) {
-            throw new IllegalArgumentException("No content!");
-        }
-
-        String filename = content.getFileName();
-        if ((filename == null) || (filename.length() == 0)) {
-            if (object instanceof Document) {
-                filename = ((Document) object).getContentStreamFileName();
-            }
-        }
-        if ((filename == null) || (filename.length() == 0)) {
-            filename = object.getName();
-        }
-        if ((filename == null) || (filename.length() == 0)) {
-            filename = "content";
-        }
-
-        String ext = MimeTypes.getExtension(content.getMimeType());
-        if (ext.length() > 0 && !filename.endsWith(ext)) {
-            filename = filename + ext;
-        }
-
-        File tempFile = ClientHelper.createTempFile(filename);
-        try {
-            storeStream(content.getStream(), tempFile);
-        } catch (CmisConstraintException e) {
-            // there is no content - leave the temp file empty
-        }
-
-        return tempFile;
-    }
-
-    private static void storeStream(InputStream in, File file) throws IOException {
-        OutputStream out = null;
-        try {
-            out = new FileOutputStream(file);
-            IOUtils.copy(new LoggingInputStream(in, file.getName()), out, BUFFER_SIZE);
-        } finally {
-            IOUtils.closeQuietly(in);
-            IOUtils.closeQuietly(out);
-        }
-    }
-
-    private static ContentStream getContentStream(CmisObject object, String streamId) {
-        if (object == null) {
-            return null;
-        }
-
-        if (object instanceof Document) {
-            return ((Document) object).getContentStream(streamId);
-        } else {
-            if (streamId == null) {
-                return null;
-            }
-
-            List<Rendition> renditions = object.getRenditions();
-            if (renditions == null) {
-                return null;
-            }
-
-            for (Rendition rendition : renditions) {
-                if (streamId.equals(rendition.getStreamId())) {
-                    return rendition.getContentStream();
-                }
-            }
-        }
-
-        return null;
-    }
-
     public static void copyTableToClipboard(JTable table, boolean onlySelected) {
         final String newline = System.getProperty("line.separator");
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java Sun Sep 25 10:29:02 2016
@@ -41,8 +41,6 @@ public class ClientWriterAppender extend
         super(name, filter, layout);
     }
 
-    private static final long serialVersionUID = 1L;
-
     private static JTextArea logTextArea = null;
 
     public static void setTextArea(JTextArea textArea) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java Sun Sep 25 10:29:02 2016
@@ -38,7 +38,6 @@ import javax.swing.ButtonGroup;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
 import javax.swing.JFormattedTextField;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -60,6 +59,9 @@ import org.apache.chemistry.opencmis.wor
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.model.ClientSession;
 import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+import org.apache.chemistry.opencmis.workbench.swing.WorkbenchFileChooser;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class CreateDocumentDialog extends CreateDialog {
 
@@ -177,9 +179,9 @@ public class CreateDocumentDialog extend
         browseButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent event) {
-                JFileChooser fileChooser = new JFileChooser();
+                WorkbenchFileChooser fileChooser = new WorkbenchFileChooser();
                 int chooseResult = fileChooser.showDialog(filenameField, "Select");
-                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                if (chooseResult == WorkbenchFileChooser.APPROVE_OPTION) {
                     if (fileChooser.getSelectedFile().isFile()) {
                         setFile(fileChooser.getSelectedFile());
                     }
@@ -292,7 +294,7 @@ public class CreateDocumentDialog extend
                     }
 
                     if (objectId != null) {
-                        getClientModel().loadObject(objectId.getId());
+                        LoadObjectWorker.loadObject(getOwner(), getClientModel(), objectId.getId());
                     }
 
                     thisDialog.setVisible(false);
@@ -301,12 +303,7 @@ public class CreateDocumentDialog extend
                     ClientHelper.showError(null, e);
                 } finally {
                     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-
-                    try {
-                        getClientModel().reloadFolder();
-                    } catch (Exception e) {
-                        ClientHelper.showError(null, e);
-                    }
+                    LoadFolderWorker.reloadFolder(getOwner(), getClientModel());
                 }
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java Sun Sep 25 10:29:02 2016
@@ -37,6 +37,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.NewFolderIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class CreateFolderDialog extends CreateDialog {
 
@@ -100,7 +102,7 @@ public class CreateFolderDialog extends
                             getMandatoryOrOnCreatePropertyValues(type));
 
                     if (objectId != null) {
-                        getClientModel().loadObject(objectId.getId());
+                        LoadObjectWorker.loadObject(getOwner(), getClientModel(), objectId.getId());
                     }
 
                     thisDialog.setVisible(false);
@@ -109,12 +111,7 @@ public class CreateFolderDialog extends
                     ClientHelper.showError(null, e);
                 } finally {
                     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-
-                    try {
-                        getClientModel().reloadFolder();
-                    } catch (Exception e) {
-                        ClientHelper.showError(null, e);
-                    }
+                    LoadFolderWorker.reloadFolder(getOwner(), getClientModel());
                 }
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateItemDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateItemDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateItemDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateItemDialog.java Sun Sep 25 10:29:02 2016
@@ -41,6 +41,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.NewItemIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class CreateItemDialog extends CreateDialog {
 
@@ -119,7 +121,7 @@ public class CreateItemDialog extends Cr
                             getMandatoryOrOnCreatePropertyValues(type), unfiledButton.isSelected());
 
                     if (objectId != null) {
-                        getClientModel().loadObject(objectId.getId());
+                        LoadObjectWorker.loadObject(getOwner(), getClientModel(), objectId.getId());
                     }
 
                     thisDialog.setVisible(false);
@@ -128,12 +130,7 @@ public class CreateItemDialog extends Cr
                     ClientHelper.showError(null, e);
                 } finally {
                     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-
-                    try {
-                        getClientModel().reloadFolder();
-                    } catch (Exception e) {
-                        ClientHelper.showError(null, e);
-                    }
+                    LoadFolderWorker.reloadFolder(getOwner(), getClientModel());
                 }
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreatePolicyDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreatePolicyDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreatePolicyDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreatePolicyDialog.java Sun Sep 25 10:29:02 2016
@@ -41,6 +41,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.NewPolicyIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class CreatePolicyDialog extends CreateDialog {
 
@@ -124,7 +126,7 @@ public class CreatePolicyDialog extends
                             getMandatoryOrOnCreatePropertyValues(type), unfiledButton.isSelected());
 
                     if (objectId != null) {
-                        getClientModel().loadObject(objectId.getId());
+                        LoadObjectWorker.loadObject(getOwner(), getClientModel(), objectId.getId());
                     }
 
                     thisDialog.setVisible(false);
@@ -133,12 +135,7 @@ public class CreatePolicyDialog extends
                     ClientHelper.showError(null, e);
                 } finally {
                     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-
-                    try {
-                        getClientModel().reloadFolder();
-                    } catch (Exception e) {
-                        ClientHelper.showError(null, e);
-                    }
+                    LoadFolderWorker.reloadFolder(getOwner(), getClientModel());
                 }
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateRelationshipDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateRelationshipDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateRelationshipDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateRelationshipDialog.java Sun Sep 25 10:29:02 2016
@@ -37,6 +37,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.NewRelationshipIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class CreateRelationshipDialog extends CreateDialog {
 
@@ -106,7 +108,7 @@ public class CreateRelationshipDialog ex
                             getMandatoryOrOnCreatePropertyValues(type));
 
                     if (objectId != null) {
-                        getClientModel().loadObject(objectId.getId());
+                        LoadObjectWorker.loadObject(getOwner(), getClientModel(), objectId.getId());
                     }
 
                     thisDialog.setVisible(false);
@@ -115,12 +117,7 @@ public class CreateRelationshipDialog ex
                     ClientHelper.showError(null, e);
                 } finally {
                     setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-
-                    try {
-                        getClientModel().reloadFolder();
-                    } catch (Exception e) {
-                        ClientHelper.showError(null, e);
-                    }
+                    LoadFolderWorker.reloadFolder(getOwner(), getClientModel());
                 }
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ExceptionDialog.java Sun Sep 25 10:29:02 2016
@@ -42,41 +42,41 @@ public class ExceptionDialog extends JDi
 
     private static final long serialVersionUID = 1L;
 
-    private final Exception exception;
+    private final Throwable throwable;
 
-    public ExceptionDialog(Frame owner, Exception exception) {
+    public ExceptionDialog(Frame owner, Throwable throwable) {
         super(owner, "Exception", true);
-        this.exception = exception;
+        this.throwable = throwable;
 
         createGUI();
     }
 
     private void createGUI() {
-        setMinimumSize(new Dimension(WorkbenchScale.scaleInt(600), WorkbenchScale.scaleInt(150)));
-        setPreferredSize(new Dimension(WorkbenchScale.scaleInt(600), WorkbenchScale.scaleInt(200)));
+        setMinimumSize(WorkbenchScale.scaleDimension(new Dimension(600, 150)));
+        setPreferredSize(WorkbenchScale.scaleDimension(new Dimension(600, 200)));
 
         setLayout(new BorderLayout());
 
         // exception name
         String exceptionName;
-        if (exception instanceof CmisBaseException) {
-            exceptionName = "CMIS Exception: <em>" + ((CmisBaseException) exception).getExceptionName() + "</em>";
+        if (throwable instanceof CmisBaseException) {
+            exceptionName = "CMIS Exception: <em>" + ((CmisBaseException) throwable).getExceptionName() + "</em>";
         } else {
-            exceptionName = "Exception: <em>" + exception.getClass().getSimpleName() + "</em>";
+            exceptionName = "Exception: <em>" + throwable.getClass().getSimpleName() + "</em>";
         }
 
         StringBuilder exceptionText = new StringBuilder(1024);
         exceptionText.append("<h2><font color=\"red\">" + exceptionName + "</font><br>");
-        ClientHelper.encodeHtml(exceptionText, exception.getMessage());
+        ClientHelper.encodeHtml(exceptionText, throwable.getMessage());
         exceptionText.append("</h2>");
-        if (exception.getCause() != null) {
+        if (throwable.getCause() != null) {
             exceptionText.append("<h3><font color=\"red\">Cause: <em>"
-                    + exception.getCause().getClass().getSimpleName() + "</em></font><br>");
-            ClientHelper.encodeHtml(exceptionText, exception.getCause().getMessage());
+                    + throwable.getCause().getClass().getSimpleName() + "</em></font><br>");
+            ClientHelper.encodeHtml(exceptionText, throwable.getCause().getMessage());
             exceptionText.append("</h3>");
         }
-        if (exception instanceof CmisBaseException) {
-            Map<String, String> additionalData = ((CmisBaseException) exception).getAdditionalData();
+        if (throwable instanceof CmisBaseException) {
+            Map<String, String> additionalData = ((CmisBaseException) throwable).getAdditionalData();
             if (additionalData != null && !additionalData.isEmpty()) {
                 exceptionText.append("<hr><br><b>Additional data:</b><br><table>");
                 for (Map.Entry<String, String> e : additionalData.entrySet()) {
@@ -89,7 +89,7 @@ public class ExceptionDialog extends JDi
                 exceptionText.append("</table>");
             }
 
-            String errorContent = ((CmisBaseException) exception).getErrorContent();
+            String errorContent = ((CmisBaseException) throwable).getErrorContent();
             if (errorContent != null && errorContent.length() > 0) {
                 exceptionText.append("<hr><br><b>Error Content:</b><br>");
                 ClientHelper.encodeHtml(exceptionText, errorContent);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java Sun Sep 25 10:29:02 2016
@@ -19,7 +19,6 @@
 package org.apache.chemistry.opencmis.workbench;
 
 import java.awt.BorderLayout;
-import java.awt.Cursor;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
@@ -34,12 +33,12 @@ import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
 
 import org.apache.chemistry.opencmis.client.api.Folder;
-import org.apache.chemistry.opencmis.client.api.ObjectId;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
 import org.apache.chemistry.opencmis.workbench.model.FolderListener;
 import org.apache.chemistry.opencmis.workbench.model.ObjectListener;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
 
 public class FolderPanel extends JPanel implements FolderListener, ObjectListener {
 
@@ -97,21 +96,27 @@ public class FolderPanel extends JPanel
     }
 
     @Override
-    public void objectLoaded(ClientModelEvent event) {
-        int selectedRow = folderTable.getSelectedRow();
-        if (selectedRow > -1 && event.getClientModel().getCurrentObject() != null) {
-            if (selectedRow < folderTable.getRowCount()) {
-
-                String selId = folderTable.getValueAt(folderTable.getSelectedRow(), FolderTable.ID_COLUMN).toString();
-                String curId = event.getClientModel().getCurrentObject().getId();
-
-                if (!curId.equals(selId)) {
-                    folderTable.clearSelection();
+    public void objectLoaded(final ClientModelEvent event) {
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                int selectedRow = folderTable.getSelectedRow();
+                if (selectedRow > -1 && event.getClientModel().getCurrentObject() != null) {
+                    if (selectedRow < folderTable.getRowCount()) {
+
+                        String selId = folderTable.getValueAt(folderTable.getSelectedRow(), FolderTable.ID_COLUMN)
+                                .toString();
+                        String curId = event.getClientModel().getCurrentObject().getId();
+
+                        if (!curId.equals(selId)) {
+                            folderTable.clearSelection();
+                        }
+                    } else {
+                        folderTable.clearSelection();
+                    }
                 }
-            } else {
-                folderTable.clearSelection();
             }
-        }
+        });
     }
 
     private void createGUI() {
@@ -126,16 +131,7 @@ public class FolderPanel extends JPanel
         upButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                try {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                    ObjectId objectId = model.loadFolder(parentId, false);
-                    model.loadObject(objectId.getId());
-                } catch (Exception ex) {
-                    ClientHelper.showError(null, ex);
-                    return;
-                } finally {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                }
+                loadParentFolder();
             }
         });
         panel.add(upButton);
@@ -178,24 +174,10 @@ public class FolderPanel extends JPanel
     }
 
     private void loadFolder() {
-        SwingUtilities.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                    String id = pathField.getText().trim();
-                    if (id.length() == 0) {
-                        id = "/";
-                    }
-                    ObjectId objectId = model.loadFolder(id, id.charAt(0) == '/');
-                    model.loadObject(objectId.getId());
-                } catch (Exception ex) {
-                    ClientHelper.showError(null, ex);
-                    return;
-                } finally {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                }
-            }
-        });
+        LoadFolderWorker.loadFolder(this, model, pathField.getText().trim());
+    }
+
+    private void loadParentFolder() {
+        LoadFolderWorker.loadFolderById(this, model, parentId);
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java Sun Sep 25 10:29:02 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
-import java.awt.Cursor;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 import java.awt.datatransfer.UnsupportedFlavorException;
@@ -57,7 +56,6 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.commons.enums.Action;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
 import org.apache.chemistry.opencmis.workbench.icons.CheckedOutIcon;
 import org.apache.chemistry.opencmis.workbench.icons.DocumentIcon;
 import org.apache.chemistry.opencmis.workbench.icons.FolderIcon;
@@ -69,6 +67,10 @@ import org.apache.chemistry.opencmis.wor
 import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
 import org.apache.chemistry.opencmis.workbench.model.FolderListener;
 import org.apache.chemistry.opencmis.workbench.swing.GregorianCalendarRenderer;
+import org.apache.chemistry.opencmis.workbench.worker.DeleteWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
+import org.apache.chemistry.opencmis.workbench.worker.TempFileContentWorker;
 
 public class FolderTable extends JTable implements FolderListener {
 
@@ -86,6 +88,9 @@ public class FolderTable extends JTable
     private Icon checkedOutIcon;
     private Icon pwcIcon;
 
+    private JMenuItem downloadItem;
+    private JMenuItem deleteItem;
+
     public FolderTable(final ClientModel model) {
         super();
 
@@ -135,7 +140,7 @@ public class FolderTable extends JTable
         popup.addSeparator();
 
         // popup menu: delete
-        final JMenuItem deleteItem = new JMenuItem("Delete");
+        deleteItem = new JMenuItem("Delete");
         deleteItem.setEnabled(false);
         popup.add(deleteItem);
 
@@ -148,43 +153,21 @@ public class FolderTable extends JTable
                             JOptionPane.WARNING_MESSAGE);
 
                     if (answer == JOptionPane.YES_OPTION) {
-                        try {
-                            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                            if (model.getCurrentObject() instanceof Folder) {
-                                List<String> ids = ((Folder) model.getCurrentObject()).deleteTree(true,
-                                        UnfileObject.DELETE, true);
-
-                                if (ids != null && !ids.isEmpty()) {
-                                    StringBuilder sb = new StringBuilder(128);
-
-                                    sb.append("Delete tree failed! At least the following objects could not be deleted:\n");
-
-                                    for (String id : ids) {
-                                        sb.append('\n');
-                                        sb.append(id);
-                                    }
-
-                                    JOptionPane.showMessageDialog(FolderTable.this, sb.toString(), "Delete Tree",
-                                            JOptionPane.ERROR_MESSAGE);
-                                }
-                            } else {
-                                model.getCurrentObject().delete();
+                        DeleteWorker worker = new DeleteWorker(FolderTable.this, model.getCurrentObject()) {
+                            @Override
+                            protected void done() {
+                                super.done();
+                                LoadFolderWorker.reloadFolder(FolderTable.this, model);
                             }
-
-                            model.reloadFolder();
-                        } catch (Exception ex) {
-                            ClientHelper.showError(FolderTable.this, ex);
-                            return;
-                        } finally {
-                            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                        }
+                        };
+                        worker.executeTask();
                     }
                 }
             }
         });
 
         // popup menu: download
-        final JMenuItem downloadItem = new JMenuItem("Download");
+        downloadItem = new JMenuItem("Download");
         downloadItem.setEnabled(false);
         popup.add(downloadItem);
 
@@ -208,26 +191,24 @@ public class FolderTable extends JTable
                 if (row > -1) {
                     String id = getModel().getValueAt(getRowSorter().convertRowIndexToModel(row), ID_COLUMN).toString();
 
-                    try {
-                        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                        model.loadObject(id);
+                    LoadObjectWorker worker = new LoadObjectWorker(FolderTable.this, model, id) {
+                        @Override
+                        protected void done() {
+                            super.done();
 
-                        // enable or disable popup menu items
-                        if (model.getCurrentObject() != null && model.getCurrentObject().getAllowableActions() != null) {
-                            CmisObject object = model.getCurrentObject();
-                            deleteItem.setEnabled(object.hasAllowableAction(Action.CAN_DELETE_OBJECT)
-                                    || object.hasAllowableAction(Action.CAN_DELETE_TREE));
-                            downloadItem.setEnabled(object.hasAllowableAction(Action.CAN_GET_CONTENT_STREAM));
-                        } else {
-                            deleteItem.setEnabled(false);
-                            downloadItem.setEnabled(false);
+                            if (model.getCurrentObject() != null
+                                    && model.getCurrentObject().getAllowableActions() != null) {
+                                CmisObject object = model.getCurrentObject();
+                                deleteItem.setEnabled(object.hasAllowableAction(Action.CAN_DELETE_OBJECT)
+                                        || object.hasAllowableAction(Action.CAN_DELETE_TREE));
+                                downloadItem.setEnabled(object.hasAllowableAction(Action.CAN_GET_CONTENT_STREAM));
+                            } else {
+                                deleteItem.setEnabled(false);
+                                downloadItem.setEnabled(false);
+                            }
                         }
-                    } catch (Exception ex) {
-                        ClientHelper.showError(null, ex);
-                        return;
-                    } finally {
-                        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                    }
+                    };
+                    worker.executeTask();
                 }
             }
         });
@@ -318,15 +299,7 @@ public class FolderTable extends JTable
                     ClientHelper.open(this.getParent(), object, null);
                 }
             } else if (object instanceof Folder) {
-                try {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                    model.loadFolder(object.getId(), false);
-                } catch (Exception ex) {
-                    ClientHelper.showError(null, ex);
-                    return;
-                } finally {
-                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-                }
+                LoadFolderWorker.loadFolderById(FolderTable.this, model, object.getId());
             }
         }
     }
@@ -418,7 +391,7 @@ public class FolderTable extends JTable
         }
     }
 
-    class FolderTransferHandler extends TransferHandler {
+    private class FolderTransferHandler extends TransferHandler {
 
         private static final long serialVersionUID = 1L;
 
@@ -451,8 +424,7 @@ public class FolderTable extends JTable
                 List<File> fileList = (List<File>) support.getTransferable().getTransferData(
                         DataFlavor.javaFileListFlavor);
 
-                if ((fileList == null) || (fileList.size() != 1) || (fileList.get(0) == null)
-                        || !fileList.get(0).isFile()) {
+                if (fileList == null || fileList.size() != 1 || fileList.get(0) == null || !fileList.get(0).isFile()) {
                     return false;
                 }
 
@@ -475,42 +447,38 @@ public class FolderTable extends JTable
         @Override
         protected Transferable createTransferable(JComponent c) {
             int row = getSelectedRow();
-            if ((row > -1) && (row < model.getCurrentChildren().size())) {
-                String id = getValueAt(row, ID_COLUMN).toString();
-                CmisObject object = model.getFromCurrentChildren(id);
+            if (row < 0 || row >= model.getCurrentChildren().size()) {
+                return null;
+            }
+
+            String id = getValueAt(row, ID_COLUMN).toString();
+            final CmisObject object = model.getFromCurrentChildren(id);
+            if (!(object instanceof Document)) {
+                return null;
+            }
 
-                if (object instanceof Document) {
-                    Document doc = (Document) object;
+            return new Transferable() {
+                @Override
+                public boolean isDataFlavorSupported(DataFlavor flavor) {
+                    return flavor == DataFlavor.javaFileListFlavor;
+                }
+
+                @Override
+                public DataFlavor[] getTransferDataFlavors() {
+                    return new DataFlavor[] { DataFlavor.javaFileListFlavor };
+                }
 
-                    File tempFile = null;
+                @Override
+                public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
                     try {
-                        tempFile = ClientHelper.createTempFileFromDocument(doc, null);
+                        TempFileContentWorker worker = new TempFileContentWorker(null, (Document) object);
+                        return Collections.singletonList(worker.executeSync());
                     } catch (Exception e) {
-                        ClientHelper.showError(null, e);
+                        ClientHelper.showError(FolderTable.this, e);
+                        return null;
                     }
-
-                    final File tempTransFile = tempFile;
-
-                    return new Transferable() {
-                        @Override
-                        public boolean isDataFlavorSupported(DataFlavor flavor) {
-                            return flavor == DataFlavor.javaFileListFlavor;
-                        }
-
-                        @Override
-                        public DataFlavor[] getTransferDataFlavors() {
-                            return new DataFlavor[] { DataFlavor.javaFileListFlavor };
-                        }
-
-                        @Override
-                        public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
-                            return Collections.singletonList(tempTransFile);
-                        }
-                    };
                 }
-            }
-
-            return null;
+            };
         }
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java Sun Sep 25 10:29:02 2016
@@ -76,6 +76,8 @@ import org.apache.chemistry.opencmis.wor
 import org.apache.chemistry.opencmis.workbench.icons.RemoveIcon;
 import org.apache.chemistry.opencmis.workbench.icons.UpIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.worker.LoadFolderWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 /**
  * Simple property editor.
@@ -106,8 +108,9 @@ public class PropertyEditorFrame extends
         setIconImages(ClientHelper.getCmisIconImages());
 
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-        setPreferredSize(new Dimension((int) (screenSize.getWidth() / 2), (int) (screenSize.getHeight() / 1.5)));
-        setMinimumSize(new Dimension(300, 120));
+        setPreferredSize(WorkbenchScale.scaleDimension(new Dimension((int) (screenSize.getWidth() / 2),
+                (int) (screenSize.getHeight() / 1.5))));
+        setMinimumSize(WorkbenchScale.scaleDimension(new Dimension(300, 120)));
 
         setLayout(new BorderLayout());
 
@@ -169,6 +172,10 @@ public class PropertyEditorFrame extends
             }
         }
 
+        final JPanel updateButtonPanel = new JPanel();
+        updateButtonPanel.setLayout(new BoxLayout(updateButtonPanel, BoxLayout.PAGE_AXIS));
+        updateButtonPanel.setBorder(WorkbenchScale.scaleBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3)));
+
         JButton updateButton = new JButton("Update");
         updateButton.setBorder(WorkbenchScale.scaleBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)));
         updateButton.setDefaultCapable(true);
@@ -181,7 +188,13 @@ public class PropertyEditorFrame extends
             }
         });
 
-        add(updateButton, BorderLayout.PAGE_END);
+        int height = 30;
+        height = Math.max(height, getFontMetrics(updateButton.getFont()).getHeight() + updateButton.getInsets().top
+                + updateButton.getInsets().bottom);
+        updateButton.setMaximumSize(WorkbenchScale.scaleDimension(new Dimension(Short.MAX_VALUE, height)));
+        updateButtonPanel.add(updateButton);
+
+        add(updateButtonPanel, BorderLayout.PAGE_END);
 
         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         pack();
@@ -210,12 +223,8 @@ public class PropertyEditorFrame extends
             ObjectId newId = object.updateProperties(properties, false);
 
             if ((newId != null) && newId.getId().equals(model.getCurrentObject().getId())) {
-                try {
-                    model.reloadObject();
-                    model.reloadFolder();
-                } catch (Exception ex) {
-                    ClientHelper.showError(null, ex);
-                }
+                LoadObjectWorker.reloadObject(this, model);
+                LoadFolderWorker.reloadFolder(getOwner(), model);
             }
 
             return true;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java Sun Sep 25 10:29:02 2016
@@ -24,6 +24,7 @@ import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Toolkit;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
@@ -68,6 +69,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.workbench.icons.QueryIcon;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 import org.apache.chemistry.opencmis.workbench.swing.IdRenderer;
+import org.apache.chemistry.opencmis.workbench.worker.InfoWorkbenchWorker;
+import org.apache.chemistry.opencmis.workbench.worker.LoadObjectWorker;
 
 public class QueryFrame extends JFrame {
 
@@ -149,7 +152,7 @@ public class QueryFrame extends JFrame {
         queryButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                doQuery();
+                (new QueryWorker(QueryFrame.this)).executeTask();
             }
         });
 
@@ -226,11 +229,8 @@ public class QueryFrame extends JFrame {
                 int row = resultsTable.rowAtPoint(e.getPoint());
                 int column = resultsTable.columnAtPoint(e.getPoint());
                 if (row > -1 && resultsTable.getColumnClass(column) == ObjectIdImpl.class) {
-                    try {
-                        model.loadObject(((ObjectId) resultsTable.getValueAt(row, column)).getId());
-                    } catch (Exception ex) {
-                        ClientHelper.showError(QueryFrame.this, ex);
-                    }
+                    LoadObjectWorker.loadObject(QueryFrame.this.getOwner(), model,
+                            ((ObjectId) resultsTable.getValueAt(row, column)).getId());
                 }
             }
 
@@ -323,84 +323,6 @@ public class QueryFrame extends JFrame {
         }
     }
 
-    private synchronized void doQuery() {
-        String text = queryText.getText();
-        text = text.replace('\n', ' ');
-
-        ItemIterable<QueryResult> results = null;
-
-        try {
-            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
-            int skipCount = 0;
-            try {
-                skipCountField.commitEdit();
-                skipCount = ((Number) skipCountField.getValue()).intValue();
-                if (skipCount < 0) {
-                    skipCount = 0;
-                    skipCountField.setValue(0);
-                }
-            } catch (Exception e) {
-                ClientHelper.showError(this, e);
-            }
-
-            int maxHits = 1000;
-            try {
-                maxHitsField.commitEdit();
-                maxHits = ((Number) maxHitsField.getValue()).intValue();
-                if (maxHits < 0) {
-                    maxHits = 0;
-                    maxHitsField.setValue(0);
-                }
-            } catch (Exception e) {
-                ClientHelper.showError(this, e);
-            }
-
-            results = model.query(text, searchAllVersionsCheckBox.isSelected(), maxHits);
-
-            ResultTableModel rtm = new ResultTableModel();
-
-            long startTime = System.currentTimeMillis();
-
-            int row = 0;
-            ItemIterable<QueryResult> page = results;
-            if (skipCount > 0) {
-                page = page.skipTo(skipCount);
-            }
-            page = page.getPage(maxHits);
-            for (QueryResult qr : page) {
-                rtm.setColumnCount(Math.max(rtm.getColumnCount(), qr.getProperties().size()));
-
-                for (PropertyData<?> prop : qr.getProperties()) {
-                    if (PropertyIds.OBJECT_ID.equals(prop.getId()) && (prop.getFirstValue() != null)) {
-                        rtm.setValue(row, prop.getQueryName(), new ObjectIdImpl(prop.getFirstValue().toString()));
-                    } else {
-                        rtm.setValue(row, prop.getQueryName(), prop.getValues());
-                    }
-                }
-
-                row++;
-            }
-            rtm.setRowCount(row);
-
-            long stopTime = System.currentTimeMillis();
-            float time = (stopTime - startTime) / 1000f;
-            String total = "<unknown>";
-            if (page.getTotalNumItems() >= 0) {
-                total = String.valueOf(page.getTotalNumItems());
-            }
-
-            queryTimeLabel.setText(" " + row + " hits, " + total + " total (" + time + " sec)");
-
-            resultsTable.setModel(rtm);
-        } catch (Exception ex) {
-            ClientHelper.showError(null, ex);
-            return;
-        } finally {
-            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-        }
-    }
-
     static class ResultTableModel extends AbstractTableModel {
 
         private static final long serialVersionUID = 1L;
@@ -594,4 +516,127 @@ public class QueryFrame extends JFrame {
             return prepareRenderer;
         }
     }
+
+    private class QueryWorker extends InfoWorkbenchWorker {
+
+        // in
+        private String queryStatement;
+        private int skipCount = 0;
+        private int maxHits = 1000;
+        private boolean searchAllVersions = false;
+
+        // out
+        private ResultTableModel resultTableModel;
+        private String queryTimeStr;
+
+        public QueryWorker(Window parent) {
+            super(parent);
+        }
+
+        @Override
+        protected String getTitle() {
+            return "Query";
+        }
+
+        @Override
+        protected String getMessage() {
+            return "Executing query...";
+        }
+
+        @Override
+        public void executeTask() {
+            queryStatement = queryText.getText();
+            queryStatement = queryStatement.replace('\n', ' ');
+
+            try {
+                skipCountField.commitEdit();
+                skipCount = ((Number) skipCountField.getValue()).intValue();
+                if (skipCount < 0) {
+                    skipCount = 0;
+                    skipCountField.setValue(0);
+                }
+            } catch (Exception e) {
+                showError(e);
+            }
+
+            try {
+                maxHitsField.commitEdit();
+                maxHits = ((Number) maxHitsField.getValue()).intValue();
+                if (maxHits < 0) {
+                    maxHits = 0;
+                    maxHitsField.setValue(0);
+                }
+            } catch (Exception e) {
+                showError(e);
+            }
+
+            searchAllVersions = searchAllVersionsCheckBox.isSelected();
+
+            super.executeTask();
+        }
+
+        @Override
+        protected Object doInBackground() throws Exception {
+            resultTableModel = new ResultTableModel();
+
+            long startTime = System.currentTimeMillis();
+
+            int row = 0;
+
+            ItemIterable<QueryResult> page = model.query(queryStatement, searchAllVersions, maxHits);
+            if (skipCount > 0) {
+                page = page.skipTo(skipCount);
+            }
+            page = page.getPage(maxHits);
+
+            if (isCancelled()) {
+                return null;
+            }
+
+            for (QueryResult qr : page) {
+                if (isCancelled()) {
+                    break;
+                }
+
+                resultTableModel.setColumnCount(Math.max(resultTableModel.getColumnCount(), qr.getProperties().size()));
+
+                for (PropertyData<?> prop : qr.getProperties()) {
+                    if (PropertyIds.OBJECT_ID.equals(prop.getId()) && (prop.getFirstValue() != null)) {
+                        resultTableModel.setValue(row, prop.getQueryName(), new ObjectIdImpl(prop.getFirstValue()
+                                .toString()));
+                    } else {
+                        resultTableModel.setValue(row, prop.getQueryName(), prop.getValues());
+                    }
+                }
+
+                row++;
+            }
+
+            if (!isCancelled()) {
+                resultTableModel.setRowCount(row);
+
+                long stopTime = System.currentTimeMillis();
+                float time = (stopTime - startTime) / 1000f;
+                String total = "<unknown>";
+                if (page.getTotalNumItems() >= 0) {
+                    total = String.valueOf(page.getTotalNumItems());
+                }
+
+                queryTimeStr = " " + row + " hits, " + total + " total (" + time + " sec)";
+            }
+
+            return null;
+        }
+
+        @Override
+        protected void finializeTask() {
+            if (isCancelled()) {
+                queryTimeLabel.setText(" canceled");
+                resultsTable.setModel(new ResultTableModel());
+            } else {
+                queryTimeLabel.setText(queryTimeStr);
+                resultsTable.setModel(resultTableModel);
+            }
+        }
+    }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java Sun Sep 25 10:29:02 2016
@@ -66,6 +66,7 @@ public class RepositoryInfoFrame extends
 
     private void createGUI() {
         setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+        setIconImages(ClientHelper.getCmisIconImages());
 
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         setPreferredSize(new Dimension((int) (screenSize.getWidth() / 2.5), (int) (screenSize.getHeight() / 1.5)));
@@ -108,6 +109,7 @@ public class RepositoryInfoFrame extends
             setupGUI();
 
             addLine("Name:", true).setText(repInfo.getName());
+            addSeparator();
             addLine("Id:").setText(repInfo.getId());
             addLine("Description:").setText(repInfo.getDescription());
             addLine("Vendor:").setText(repInfo.getVendorName());
@@ -131,6 +133,7 @@ public class RepositoryInfoFrame extends
             if (repInfo.getCapabilities() != null) {
                 RepositoryCapabilities cap = repInfo.getCapabilities();
 
+                addSeparator();
                 addLine("Capabilities:", true).setText("");
 
                 addYesNoLabel("Get descendants supported:").setValue(is(cap.isGetDescendantsSupported()));
@@ -220,6 +223,7 @@ public class RepositoryInfoFrame extends
             if (repInfo.getAclCapabilities() != null) {
                 AclCapabilities cap = repInfo.getAclCapabilities();
 
+                addSeparator();
                 addLine("ACL Capabilities:", true).setText("");
 
                 addLine("Supported permissions:").setText(str(cap.getSupportedPermissions()));
@@ -304,6 +308,8 @@ public class RepositoryInfoFrame extends
             if (isNotEmpty(repInfo.getExtensions())) {
                 addComponent("Extensions:", new JScrollPane(new ExtensionsTree(repInfo.getExtensions())));
             }
+
+            regenerateGUI();
         }
 
         private void appendToString(StringBuilder sb, String str) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java Sun Sep 25 10:29:02 2016
@@ -305,7 +305,7 @@ public class TckDialog {
             final JPanel runButtonPanel = new JPanel();
             runButtonPanel.setLayout(new BoxLayout(runButtonPanel, BoxLayout.PAGE_AXIS));
             runButtonPanel.setBorder(WorkbenchScale.scaleBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3)));
-            runButton.setMaximumSize(new Dimension(Short.MAX_VALUE, height));
+            runButton.setMaximumSize(WorkbenchScale.scaleDimension(new Dimension(Short.MAX_VALUE, height)));
             runButtonPanel.add(runButton);
 
             add(runButtonPanel, BorderLayout.PAGE_END);
@@ -542,8 +542,8 @@ public class TckDialog {
         }
 
         private void createGUI() {
-            setPreferredSize(new Dimension(500, 200));
-            setMinimumSize(new Dimension(500, 200));
+            setPreferredSize(WorkbenchScale.scaleDimension(new Dimension(500, 200)));
+            setMinimumSize(WorkbenchScale.scaleDimension(new Dimension(500, 200)));
 
             setLayout(new BorderLayout());
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AclUpdatePanel.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/AclUpdatePanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AclUpdatePanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AclUpdatePanel.java Sun Sep 25 10:29:02 2016
@@ -50,8 +50,7 @@ public class AclUpdatePanel extends Acti
     }
 
     @Override
-    public boolean doAction() {
+    public void doAction() {
         new AclEditorFrame(getClientModel(), getObject());
-        return false;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.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/AddObjectToFolderPanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java Sun Sep 25 10:29:02 2016
@@ -74,9 +74,10 @@ public class AddObjectToFolderPanel exte
     }
 
     @Override
-    public boolean doAction() {
+    public void doAction() {
         ObjectId folderId = getClientModel().getClientSession().getSession().createObjectId(folderField.getText());
         ((FileableCmisObject) getObject()).addToFolder(folderId, allVersionsBox.isSelected());
-        return true;
+
+        reload(true);
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.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/AppendContentStreamPanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java Sun Sep 25 10:29:02 2016
@@ -70,7 +70,7 @@ public class AppendContentStreamPanel ex
     }
 
     @Override
-    public boolean doAction() throws FileNotFoundException {
+    public void doAction() throws FileNotFoundException {
         ContentStream content = getClientModel().createContentStream(filenameField.getText());
 
         try {
@@ -78,6 +78,7 @@ public class AppendContentStreamPanel ex
         } finally {
             IOUtils.closeQuietly(content);
         }
-        return true;
+
+        reload(true);
     }
 }
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/ApplyPolicyPanel.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/ApplyPolicyPanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/ApplyPolicyPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/ApplyPolicyPanel.java Sun Sep 25 10:29:02 2016
@@ -68,8 +68,8 @@ public class ApplyPolicyPanel extends Ac
     }
 
     @Override
-    public boolean doAction() {
+    public void doAction() {
         getObject().applyPolicy(new ObjectIdImpl(policyField.getText()), false);
-        return true;
+        reload(true);
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.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/CancelCheckOutPanel.java?rev=1762181&r1=1762180&r2=1762181&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java Sun Sep 25 10:29:02 2016
@@ -50,8 +50,8 @@ public class CancelCheckOutPanel extends
     }
 
     @Override
-    public boolean doAction() {
+    public void doAction() {
         ((Document) getObject()).cancelCheckOut();
-        return false;
+        reload(false);
     }
 }




Mime
View raw message