chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1164857 - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: TckDialog.java actions/DeleteTreePanel.java
Date Sat, 03 Sep 2011 12:42:45 GMT
Author: fmui
Date: Sat Sep  3 12:42:44 2011
New Revision: 1164857

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

Modified:
    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/DeleteTreePanel.java

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=1164857&r1=1164856&r2=1164857&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
Sat Sep  3 12:42:44 2011
@@ -69,6 +69,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.tck.CmisTest;
 import org.apache.chemistry.opencmis.tck.CmisTestGroup;
 import org.apache.chemistry.opencmis.tck.CmisTestProgressMonitor;
+import org.apache.chemistry.opencmis.tck.CmisTestResult;
+import org.apache.chemistry.opencmis.tck.CmisTestResultStatus;
 import org.apache.chemistry.opencmis.tck.impl.TestParameters;
 import org.apache.chemistry.opencmis.tck.runner.AbstractRunner;
 import org.apache.chemistry.opencmis.workbench.checks.SwingReport;
@@ -85,14 +87,25 @@ public class TckDialog {
     private final ClientModel model;
     private final TckDialogRunner runner;
 
+    private Map<CmisTestResultStatus, Integer> status;
+
     private JProgressBar groupsProgressBar;
     private JProgressBar testsProgressBar;
+    private JLabel statusLabel;
 
     public TckDialog(Frame owner, ClientModel model) {
         this.owner = owner;
         this.model = model;
         this.runner = new TckDialogRunner(model, this);
 
+        status = new HashMap<CmisTestResultStatus, Integer>();
+        status.put(CmisTestResultStatus.INFO, 0);
+        status.put(CmisTestResultStatus.SKIPPED, 0);
+        status.put(CmisTestResultStatus.OK, 0);
+        status.put(CmisTestResultStatus.WARNING, 0);
+        status.put(CmisTestResultStatus.FAILURE, 0);
+        status.put(CmisTestResultStatus.UNEXPECTED_EXCEPTION, 0);
+
         try {
             runner.loadDefaultTckGroups();
         } catch (Exception e) {
@@ -242,13 +255,13 @@ public class TckDialog {
                 }
             });
 
-            final JPanel runbuttonPanel = new JPanel();
-            runbuttonPanel.setLayout(new BoxLayout(runbuttonPanel, BoxLayout.PAGE_AXIS));
-            runbuttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
+            final JPanel runButtonPanel = new JPanel();
+            runButtonPanel.setLayout(new BoxLayout(runButtonPanel, BoxLayout.PAGE_AXIS));
+            runButtonPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
             runButton.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
-            runbuttonPanel.add(runButton);
+            runButtonPanel.add(runButton);
 
-            add(runbuttonPanel, BorderLayout.PAGE_END);
+            add(runButtonPanel, BorderLayout.PAGE_END);
 
             setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
             pack();
@@ -508,6 +521,9 @@ public class TckDialog {
 
             progressPanel.add(Box.createRigidArea(new Dimension(0, 10)));
 
+            statusLabel = new JLabel();
+            progressPanel.add(statusLabel);
+
             add(progressPanel, BorderLayout.CENTER);
 
             JButton cancelButton = new JButton("Cancel");
@@ -518,7 +534,13 @@ public class TckDialog {
                 }
             });
 
-            add(cancelButton, BorderLayout.PAGE_END);
+            final JPanel cancelButtonPanel = new JPanel();
+            cancelButtonPanel.setLayout(new BoxLayout(cancelButtonPanel, BoxLayout.PAGE_AXIS));
+            cancelButtonPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
+            cancelButton.setMaximumSize(new Dimension(Short.MAX_VALUE, 30));
+            cancelButtonPanel.add(cancelButton);
+
+            add(cancelButtonPanel, BorderLayout.PAGE_END);
 
             setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
             pack();
@@ -568,6 +590,48 @@ public class TckDialog {
         public void endTest(CmisTest test) {
             testsProgressBar.setString("");
             testsProgressBar.setValue(testsProgressBar.getValue() + 1);
+
+            for (CmisTestResult tr : test.getResults()) {
+                int x = status.get(tr.getStatus());
+                status.put(tr.getStatus(), x + 1);
+            }
+
+            StringBuilder sb = new StringBuilder("<html>");
+            int x;
+
+            x = status.get(CmisTestResultStatus.INFO);
+            if (x > 0) {
+                sb.append("<font color='#000000'>[Info: " + x + "]</font>  ");
+            }
+
+            x = status.get(CmisTestResultStatus.SKIPPED);
+            if (x > 0) {
+                sb.append("<font color='#444444'>[Skipped: " + x + "]</font>
 ");
+            }
+
+            x = status.get(CmisTestResultStatus.OK);
+            if (x > 0) {
+                sb.append("<font color='#009900'>[Ok: " + x + "]</font>  ");
+            }
+
+            x = status.get(CmisTestResultStatus.WARNING);
+            if (x > 0) {
+                sb.append("<font color='#999900'>[Warning: " + x + "]</font>
 ");
+            }
+
+            x = status.get(CmisTestResultStatus.FAILURE);
+            if (x > 0) {
+                sb.append("<font color='#996000'>[Failure: " + x + "]</font>
 ");
+            }
+
+            x = status.get(CmisTestResultStatus.UNEXPECTED_EXCEPTION);
+            if (x > 0) {
+                sb.append("<font color='#990000'>[Exception: " + x + "]</font>
 ");
+            }
+
+            sb.append("</html>");
+
+            statusLabel.setText(sb.toString());
         }
 
         public void message(String msg) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteTreePanel.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/DeleteTreePanel.java?rev=1164857&r1=1164856&r2=1164857&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteTreePanel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteTreePanel.java
Sat Sep  3 12:42:44 2011
@@ -18,8 +18,11 @@
  */
 package org.apache.chemistry.opencmis.workbench.actions;
 
+import java.util.List;
+
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
+import javax.swing.JOptionPane;
 
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.commons.enums.Action;
@@ -29,49 +32,59 @@ import org.apache.chemistry.opencmis.wor
 
 public class DeleteTreePanel extends ActionPanel {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	private JCheckBox allVersionsBox;
-	private JComboBox unfileObjectsBox;
-	private JCheckBox continueOnFailureBox;
-
-	public DeleteTreePanel(ClientModel model) {
-		super("Delete Tree", "Delete", model);
-	}
-
-	@Override
-	protected void createActionComponents() {
-		allVersionsBox = new JCheckBox("delete all versions", true);
-		addActionComponent(allVersionsBox);
-
-		unfileObjectsBox = new JComboBox(new Object[] { UnfileObject.DELETE,
-				UnfileObject.DELETESINGLEFILED, UnfileObject.UNFILE });
-		unfileObjectsBox.setSelectedIndex(0);
-		addActionComponent(unfileObjectsBox);
-
-		continueOnFailureBox = new JCheckBox("continue on failure", true);
-		addActionComponent(allVersionsBox);
-	}
-
-	@Override
-	public boolean isAllowed() {
-		if ((getObject() == null) || !(getObject() instanceof Folder)) {
-			return false;
-		}
-
-		if ((getObject().getAllowableActions() == null)
-				|| (getObject().getAllowableActions().getAllowableActions() == null)) {
-			return true;
-		}
-
-		return getObject().getAllowableActions().getAllowableActions()
-				.contains(Action.CAN_DELETE_TREE);
-	}
-
-	@Override
-	public void doAction() throws Exception {
-		((Folder) getObject()).deleteTree(allVersionsBox.isSelected(),
-				(UnfileObject) unfileObjectsBox.getSelectedItem(),
-				continueOnFailureBox.isSelected());
-	}
+    private JCheckBox allVersionsBox;
+    private JComboBox unfileObjectsBox;
+    private JCheckBox continueOnFailureBox;
+
+    public DeleteTreePanel(ClientModel model) {
+        super("Delete Tree", "Delete", model);
+    }
+
+    @Override
+    protected void createActionComponents() {
+        allVersionsBox = new JCheckBox("delete all versions", true);
+        addActionComponent(allVersionsBox);
+
+        unfileObjectsBox = new JComboBox(new Object[] { UnfileObject.DELETE, UnfileObject.DELETESINGLEFILED,
+                UnfileObject.UNFILE });
+        unfileObjectsBox.setSelectedIndex(0);
+        addActionComponent(unfileObjectsBox);
+
+        continueOnFailureBox = new JCheckBox("continue on failure", true);
+        addActionComponent(allVersionsBox);
+    }
+
+    @Override
+    public boolean isAllowed() {
+        if ((getObject() == null) || !(getObject() instanceof Folder)) {
+            return false;
+        }
+
+        if ((getObject().getAllowableActions() == null)
+                || (getObject().getAllowableActions().getAllowableActions() == null)) {
+            return true;
+        }
+
+        return getObject().getAllowableActions().getAllowableActions().contains(Action.CAN_DELETE_TREE);
+    }
+
+    @Override
+    public void doAction() throws Exception {
+        List<String> ids = ((Folder) getObject()).deleteTree(allVersionsBox.isSelected(),
+                (UnfileObject) unfileObjectsBox.getSelectedItem(), continueOnFailureBox.isSelected());
+
+        if (ids != null && !ids.isEmpty()) {
+            StringBuilder sb = new StringBuilder(
+                    "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(this, sb.toString(), "Delete Tree", JOptionPane.ERROR_MESSAGE);
+        }
+    }
 }



Mime
View raw message