2 * Created on Jul 31, 2004
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package net.sourceforge.phpeclipse.phpunit;
9 import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
11 import org.eclipse.swt.SWT;
12 import org.eclipse.swt.graphics.Image;
13 import org.eclipse.swt.layout.FillLayout;
14 import org.eclipse.swt.layout.GridData;
15 import org.eclipse.swt.layout.GridLayout;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Label;
18 import org.eclipse.swt.widgets.ProgressBar;
21 * @author Ali Echihabi
23 * To change the template for this generated type comment go to
24 * Window>Preferences>Java>Code Generation>Code and Comments
26 public class ProgressInfoComposite extends Composite {
29 private Label labelRuns, labelRunsVal; // Runs: 12
30 private Label labelErrors, labelErrorsImage, labelErrorsVal;
31 private Label labelFailures, labelFailuresImage, labelFailuresVal;
34 private ProgressBar progressBar;
40 public ProgressInfoComposite(Composite parent) {
42 super(parent, SWT.NONE);
44 GridLayout gridLayout = new GridLayout();
45 gridLayout.numColumns = 1;
47 // set title and layout
48 setLayout(gridLayout);
51 // set the progress bar
52 progressBar = new ProgressBar(this, SWT.HORIZONTAL);
53 progressBar.setLayoutData(
54 new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
55 progressBar.setMinimum(0);
58 Composite labelsComposite =
59 new Composite(this, SWT.NONE);
61 labelsComposite.setLayoutData(
62 new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
64 labelsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
66 labelRuns = new Label(labelsComposite, SWT.NONE);
67 labelRuns.setText("Runs: ");
68 labelRunsVal = new Label(labelsComposite, SWT.NONE);
69 labelRunsVal.setText("0 / 0");
71 labelFailuresImage = new Label(labelsComposite, SWT.NONE);
72 labelFailuresImage.setImage(PHPUnitImages.DESC_FAILURE.createImage());
73 labelFailures = new Label(labelsComposite, SWT.NONE);
74 labelFailures.setText("Failures: ");
75 labelFailuresVal = new Label(labelsComposite, SWT.NONE);
76 labelFailuresVal.setText("0");
79 labelErrorsImage = new Label(labelsComposite, SWT.NONE);
80 labelErrorsImage.setImage(PHPUnitImages.DESC_ERROR.createImage());
81 labelErrors = new Label(labelsComposite, SWT.NONE);
82 labelErrors.setText("Errors: ");
83 labelErrorsVal = new Label(labelsComposite, SWT.NONE);
84 labelErrorsVal.setText("0");
87 public void resetInfo() {
89 labelErrorsVal.setText("0");
90 labelFailuresVal.setText("0");
91 labelRunsVal.setText("0 / 0");
92 progressBar.setSelection(0);
96 public void updateInfo(TestPool testPool) {
98 int numTestsOverall = testPool.getNumTestsOverall();
99 int numTestsRun = testPool.getNumTestsRun();
101 //update progress bar
102 progressBar.setMaximum(numTestsOverall);
103 progressBar.setSelection(numTestsRun);
107 labelRunsVal.setText(numTestsRun + " / " + numTestsOverall);
108 labelFailuresVal.setText("" + testPool.getNumFailures());
109 labelErrorsVal.setText("" + testPool.getNumErrors());
111 //TODO: change Failures label to red if some exist.