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.layout.FillLayout;
13 import org.eclipse.swt.layout.GridData;
14 import org.eclipse.swt.layout.GridLayout;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.Label;
17 import org.eclipse.swt.widgets.ProgressBar;
20 * @author Ali Echihabi
22 * To change the template for this generated type comment go to
23 * Window>Preferences>Java>Code Generation>Code and Comments
25 public class ProgressInfoComposite extends Composite {
28 private Label labelRuns, labelRunsVal; // Runs: 12
29 private Label labelErrors, labelErrorsVal;
30 private Label labelFailures, labelFailuresVal;
32 private ProgressBar progressBar;
38 public ProgressInfoComposite(Composite parent) {
40 super(parent, SWT.NONE);
42 GridLayout gridLayout = new GridLayout();
43 gridLayout.numColumns = 1;
45 // set title and layout
46 setLayout(gridLayout);
49 // set the progress bar
50 progressBar = new ProgressBar(this, SWT.HORIZONTAL);
51 progressBar.setLayoutData(
52 new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
53 progressBar.setMinimum(0);
56 Composite labelsComposite =
57 new Composite(this, SWT.NONE);
58 labelsComposite.setLayoutData(
59 new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
61 labelsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
63 labelRuns = new Label(labelsComposite, SWT.NONE);
64 labelRuns.setText("Runs: ");
65 labelRunsVal = new Label(labelsComposite, SWT.NONE);
66 labelRunsVal.setText("0 / 0");
68 labelFailures = new Label(labelsComposite, SWT.NONE);
69 labelFailures.setText("Failures: ");
70 labelFailuresVal = new Label(labelsComposite, SWT.NONE);
71 labelFailuresVal.setText("0");
73 labelErrors = new Label(labelsComposite, SWT.NONE);
74 labelErrors.setText("Errors: ");
75 labelErrorsVal = new Label(labelsComposite, SWT.NONE);
76 labelErrorsVal.setText("0");
79 public void resetInfo() {
81 labelErrorsVal.setText("0");
82 labelFailuresVal.setText("0");
83 labelRunsVal.setText("0 / 0");
84 progressBar.setSelection(0);
88 public void updateInfo(TestPool testPool) {
90 int numTestsOverall = testPool.getNumTestsOverall();
91 int numTestsRun = testPool.getNumTestsRun();
94 progressBar.setMaximum(numTestsOverall);
95 progressBar.setSelection(numTestsRun);
99 labelRunsVal.setText(numTestsRun + " / " + numTestsOverall);
100 labelFailuresVal.setText("" + testPool.getNumFailures());
101 labelErrorsVal.setText("" + testPool.getNumErrors());
103 //TODO: change Failures label to red if some exist.