Refactored the progressInfoComposite and resultsInfoComposite into their own classes
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / ProgressInfoComposite.java
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java
new file mode 100644 (file)
index 0000000..7d779e4
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Created on Jul 31, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package net.sourceforge.phpeclipse.phpunit;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ProgressBar;
+
+/**
+ * @author Ali Echihabi
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ProgressInfoComposite extends Composite {
+
+
+       private Label labelRuns, labelRunsVal; // Runs: 12
+       private Label labelErrors, labelErrorsVal;
+       private Label labelFailures, labelFailuresVal;
+       
+       private ProgressBar progressBar;
+
+       /**
+        * @param arg0
+        * @param arg1
+        */
+       public ProgressInfoComposite(Composite parent) {
+               
+               super(parent, SWT.NONE);
+               
+               GridLayout gridLayout = new GridLayout();
+               gridLayout.numColumns = 1;
+               
+               // set title and layout
+               setLayout(gridLayout);
+               
+
+               // set the progress bar
+               progressBar = new ProgressBar(this, SWT.HORIZONTAL);
+               progressBar.setLayoutData(
+                       new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+               progressBar.setMinimum(0);
+                       
+
+               Composite labelsComposite =
+                       new Composite(this, SWT.NONE);
+               labelsComposite.setLayoutData(
+                       new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+               labelsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
+
+               labelRuns = new Label(labelsComposite, SWT.NONE);
+               labelRuns.setText("Runs: ");
+               labelRunsVal = new Label(labelsComposite, SWT.NONE);
+               labelRunsVal.setText("0 / 0");
+
+               labelFailures = new Label(labelsComposite, SWT.NONE);
+               labelFailures.setText("Failures: ");
+               labelFailuresVal = new Label(labelsComposite, SWT.NONE);
+               labelFailuresVal.setText("0");
+
+               labelErrors = new Label(labelsComposite, SWT.NONE);
+               labelErrors.setText("Errors: ");
+               labelErrorsVal = new Label(labelsComposite, SWT.NONE);
+               labelErrorsVal.setText("0");            
+       }
+
+       public void updateInfo(int numTests, int numTestsRun, int numFailures, int numErrors) {
+               
+               //update progress bar
+               progressBar.setMaximum(numTests);
+               progressBar.setSelection(numTestsRun);
+               
+               System.out.println("numTestsRun: " + numTestsRun);
+       
+               //update labels
+               labelRunsVal.setText(numTestsRun + " / " + numTests);
+               labelFailuresVal.setText("" + numFailures);
+               labelErrorsVal.setText("" + numErrors);
+               
+               //TODO: change Failures label to red if some exist.
+               
+               
+               
+       }
+
+}