chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1728680 - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: ./ details/ types/
Date Fri, 05 Feb 2016 15:18:38 GMT
Author: fmui
Date: Fri Feb  5 15:18:37 2016
New Revision: 1728680

URL: http://svn.apache.org/viewvc?rev=1728680&view=rev
Log:
Workbench: clipboard improvements

Modified:
    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/ClientHelper.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/QueryFrame.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java

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=1728680&r1=1728679&r2=1728680&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
Fri Feb  5 15:18:37 2016
@@ -161,13 +161,24 @@ public class ChangeLogFrame extends JFra
             setFillsViewportHeight(true);
 
             final JPopupMenu popup = new JPopupMenu();
-            JMenuItem menuItem = new JMenuItem("Copy to clipboard");
-            popup.add(menuItem);
 
-            menuItem.addActionListener(new ActionListener() {
+            final JMenuItem clipboardAllItem = new JMenuItem("Copy all rows to clipboard");
+            popup.add(clipboardAllItem);
+
+            clipboardAllItem.addActionListener(new ActionListener() {
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    ClientHelper.copyTableToClipboard(ChangeLogTable.this, false);
+                }
+            });
+
+            final JMenuItem clipboardSelectedItem = new JMenuItem("Copy selected rows to
clipboard");
+            popup.add(clipboardSelectedItem);
+
+            clipboardSelectedItem.addActionListener(new ActionListener() {
                 @Override
                 public void actionPerformed(ActionEvent e) {
-                    ClientHelper.copyTableToClipboard(ChangeLogTable.this);
+                    ClientHelper.copyTableToClipboard(ChangeLogTable.this, 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=1728680&r1=1728679&r2=1728680&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
Fri Feb  5 15:18:37 2016
@@ -50,6 +50,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.GregorianCalendar;
@@ -60,6 +61,7 @@ import javax.imageio.ImageIO;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.swing.AbstractAction;
+import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.InputMap;
 import javax.swing.JComponent;
@@ -401,7 +403,7 @@ public final class ClientHelper {
         return null;
     }
 
-    public static void copyTableToClipboard(JTable table) {
+    public static void copyTableToClipboard(JTable table, boolean onlySelected) {
         final String newline = System.getProperty("line.separator");
 
         final StringBuilder sb = new StringBuilder(1024);
@@ -418,7 +420,17 @@ public final class ClientHelper {
 
         sb.append(newline);
 
+        int[] seletedRows = table.getSelectedRows();
+        Arrays.sort(seletedRows);
+
         for (int row = 0; row < rows; row++) {
+
+            if (onlySelected) {
+                if (Arrays.binarySearch(seletedRows, row) < 0) {
+                    continue;
+                }
+            }
+
             for (int col = 0; col < cols; col++) {
                 if (col > 0) {
                     sb.append(',');
@@ -498,7 +510,7 @@ public final class ClientHelper {
             return sb.toString();
         } else if (value instanceof ObjectId) {
             return formatCSVValue(((ObjectId) value).getId());
-        } else if (value instanceof ImageIcon) {
+        } else if (value instanceof Icon) {
             return "<icon>";
         }
 

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=1728680&r1=1728679&r2=1728680&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
Fri Feb  5 15:18:37 2016
@@ -112,13 +112,23 @@ public class FolderTable extends JTable
         final JPopupMenu popup = new JPopupMenu();
 
         // popup menu: clipboard
-        JMenuItem clipboardItem = new JMenuItem("Copy table to clipboard");
-        popup.add(clipboardItem);
+        final JMenuItem clipboardAllItem = new JMenuItem("Copy all rows to clipboard");
+        popup.add(clipboardAllItem);
 
-        clipboardItem.addActionListener(new ActionListener() {
+        clipboardAllItem.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                ClientHelper.copyTableToClipboard(FolderTable.this);
+                ClientHelper.copyTableToClipboard(FolderTable.this, false);
+            }
+        });
+
+        final JMenuItem clipboardSelectedItem = new JMenuItem("Copy selected rows to clipboard");
+        popup.add(clipboardSelectedItem);
+
+        clipboardSelectedItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                ClientHelper.copyTableToClipboard(FolderTable.this, 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=1728680&r1=1728679&r2=1728680&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
Fri Feb  5 15:18:37 2016
@@ -204,13 +204,23 @@ public class QueryFrame extends JFrame {
         resultsTable = new ResultTable();
 
         final JPopupMenu popup = new JPopupMenu();
-        JMenuItem menuItem = new JMenuItem("Copy to clipboard");
-        popup.add(menuItem);
+        final JMenuItem clipboardAllItem = new JMenuItem("Copy all rows to clipboard");
+        popup.add(clipboardAllItem);
 
-        menuItem.addActionListener(new ActionListener() {
+        clipboardAllItem.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                ClientHelper.copyTableToClipboard(resultsTable);
+                ClientHelper.copyTableToClipboard(resultsTable, false);
+            }
+        });
+
+        final JMenuItem clipboardSelectedItem = new JMenuItem("Copy selected rows to clipboard");
+        popup.add(clipboardSelectedItem);
+
+        clipboardSelectedItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                ClientHelper.copyTableToClipboard(resultsTable, true);
             }
         });
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.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/AbstractDetailsTable.java?rev=1728680&r1=1728679&r2=1728680&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java
Fri Feb  5 15:18:37 2016
@@ -78,13 +78,24 @@ public abstract class AbstractDetailsTab
         setFillsViewportHeight(true);
 
         final JPopupMenu popup = new JPopupMenu();
-        final JMenuItem menuItem = new JMenuItem("Copy to clipboard");
-        popup.add(menuItem);
 
-        menuItem.addActionListener(new ActionListener() {
+        final JMenuItem clipboardAllItem = new JMenuItem("Copy all rows to clipboard");
+        popup.add(clipboardAllItem);
+
+        clipboardAllItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                ClientHelper.copyTableToClipboard(AbstractDetailsTable.this, false);
+            }
+        });
+
+        final JMenuItem clipboardSelectedItem = new JMenuItem("Copy selected rows to clipboard");
+        popup.add(clipboardSelectedItem);
+
+        clipboardSelectedItem.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                ClientHelper.copyTableToClipboard(AbstractDetailsTable.this);
+                ClientHelper.copyTableToClipboard(AbstractDetailsTable.this, true);
             }
         });
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java?rev=1728680&r1=1728679&r2=1728680&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/types/PropertyDefinitionsSplitPane.java
Fri Feb  5 15:18:37 2016
@@ -132,13 +132,13 @@ public class PropertyDefinitionsSplitPan
             setRowHeight((int) (getFontMetrics(getFont()).getHeight() * 1.1));
 
             final JPopupMenu popup = new JPopupMenu();
-            JMenuItem menuItem = new JMenuItem("Copy to clipboard");
+            JMenuItem menuItem = new JMenuItem("Copy table to clipboard");
             popup.add(menuItem);
 
             menuItem.addActionListener(new ActionListener() {
                 @Override
                 public void actionPerformed(ActionEvent e) {
-                    ClientHelper.copyTableToClipboard(PropertyDefinitionsTable.this);
+                    ClientHelper.copyTableToClipboard(PropertyDefinitionsTable.this, false);
                 }
             });
 



Mime
View raw message