Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 59302 Details for
Bug 168580
[Vista] Progress bar's color is not updated in the Manual Test View.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch containing a simple but customizable progress bar.
org.eclipse.hyades.test.tools.core.src-manual-runner_patch.txt (text/plain), 9.45 KB, created by
Paul Slauenwhite
on 2007-02-19 14:38:48 EST
(
hide
)
Description:
Patch containing a simple but customizable progress bar.
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2007-02-19 14:38:48 EST
Size:
9.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.tools.core >Index: src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/ProgressBarPane.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.tools.core/src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/ProgressBarPane.java,v >retrieving revision 1.3 >diff -u -r1.3 ProgressBarPane.java >--- src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/ProgressBarPane.java 15 May 2006 02:51:40 -0000 1.3 >+++ src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/ProgressBarPane.java 19 Feb 2007 19:34:05 -0000 >@@ -6,11 +6,11 @@ > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.ProgressBar; > import org.eclipse.tptp.test.manual.runner.ui.internal.util.SWTUtilities; >+import org.eclipse.tptp.test.manual.runner.ui.internal.widgets.SimpleProgressBar; > > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -27,7 +27,7 @@ > * > * > * @author Paul E. Slauenwhite >- * @version May 14, 2006 >+ * @version February 19, 2007 > * @since September 19, 2005 > */ > public class ProgressBarPane extends Composite { >@@ -50,7 +50,7 @@ > > private int totalErrorTestInvocations = 0; > >- private ProgressBar progressBar = null; >+ private SimpleProgressBar progressBar = null; > > public ProgressBarPane(Composite parent){ > this(parent, SWT.BORDER); >@@ -162,7 +162,7 @@ > progressBar.setSelection(totalCompletedTestInvocations); > > //Step 3: Update the color: >- progressBar.setForeground(progressBarColor); >+ progressBar.setColor(progressBarColor); > } > > public void setTotalTestInvocations(int totalTestInvocations){ >@@ -194,8 +194,8 @@ > setLayout(SWTUtilities.getGridLayout(1,5,10)); > setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); > >- progressBar = new ProgressBar(this, SWT.SMOOTH); >- progressBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ progressBar = new SimpleProgressBar(this); >+ progressBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); > progressBar.setMinimum(0); > > Composite totalTestInvocationsLabelPane = new Composite(this, SWT.SHADOW_NONE); >Index: src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/widgets/SimpleProgressBar.java >=================================================================== >RCS file: src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/widgets/SimpleProgressBar.java >diff -N src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/widgets/SimpleProgressBar.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-manual-runner/org/eclipse/tptp/test/manual/runner/ui/internal/widgets/SimpleProgressBar.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,240 @@ >+package org.eclipse.tptp.test.manual.runner.ui.internal.widgets; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ControlEvent; >+import org.eclipse.swt.events.ControlListener; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Layout; >+ >+/********************************************************************** >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id$ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+/** >+ * Simple by customizable progress bar. The progress bar has the >+ * following customizable properties: >+ * <p> >+ * <ul> >+ * <li>Minimum value.</li> >+ * <li>Maximum value.</li> >+ * <li>Current selection value.</li> >+ * <li>Color.</li> >+ * </ul> >+ * <p> >+ * This progress bar should be used instead of the SWT >+ * {@link org.eclipse.swt.widgets.ProgressBar} when color customization is >+ * required (see {@link https://bugs.eclipse.org/bugs/show_bug.cgi?id=168738}. >+ * <p> >+ * Note: The layout can not be set on a this class. >+ * <p> >+ * >+ * >+ * @author Paul E. Slauenwhite >+ * @version February 19, 2007 >+ * @since February 16, 2007 >+ */ >+public class SimpleProgressBar extends Composite { >+ >+ private int minimum = 0; >+ >+ private int maximum = 0; >+ >+ private int selection = 0; >+ >+ private Composite progressBar = null; >+ >+ private static final Color DEFAULT_PROGRESS_BAR_COLOR = Display.getDefault().getSystemColor(SWT.COLOR_DARK_BLUE); >+ >+ public SimpleProgressBar(Composite parent) { >+ >+ super(parent, (SWT.BORDER | SWT.SMOOTH)); >+ >+ buildProgressBar(); >+ } >+ >+ /** >+ * Returns the maximum value of the progress bar. >+ * <p> >+ * >+ * @return Maximum value of the progress bar. >+ */ >+ public int getMaximum() { >+ return maximum; >+ } >+ >+ /** >+ * Returns the minimum value of the progress bar. >+ * <p> >+ * >+ * @return Minimum value of the progress bar. >+ */ >+ public int getMinimum() { >+ return minimum; >+ } >+ >+ /** >+ * Returns the current selected value of the progress bar. >+ * <p> >+ * >+ * @return Current selected value of the progress bar. >+ */ >+ public int getSelection() { >+ return selection; >+ } >+ >+ /** >+ * Returns the color of the progress bar. >+ * <p> >+ * >+ * @return Color of the progress bar. >+ */ >+ public Color getColor() { >+ return (progressBar.getBackground()); >+ } >+ >+ /** >+ * Sets the maximum value of the progress bar. The parameter value is >+ * ignored if any of the following conditions are true: >+ * <p> >+ * <ul> >+ * <li>The maximum value is less than the minimum value.</li> >+ * <li>The maximum value is less than zero.</li> >+ * <p> >+ * Note: Set the maximum value causes the current selected value to be reset >+ * to the minimum value. >+ * <p> >+ * >+ * @param maximum >+ * Maximum value of the progress bar. >+ */ >+ public void setMaximum(int maximum) { >+ >+ if ((maximum >= 0) && (maximum >= minimum)) { >+ >+ this.maximum = maximum; >+ this.selection = minimum; >+ } >+ } >+ >+ /** >+ * Sets the minimum value of the progress bar. The parameter value is >+ * ignored if any of the following conditions are true: >+ * <p> >+ * <ul> >+ * <li>The minimum value is greater than the maximum value.</li> >+ * <li>The minimum value is less than zero.</li> >+ * <p> >+ * Note: Set the minimum value causes the current selected value to be reset >+ * to the new minimum value. >+ * <p> >+ * >+ * @param minimum >+ * Minimum value of the progress bar. >+ */ >+ public void setMinimum(int minimum) { >+ >+ if ((minimum >= 0) && (minimum <= maximum)) { >+ >+ this.minimum = minimum; >+ this.selection = minimum; >+ } >+ } >+ >+ /** >+ * Sets the current selected value of the progress bar. The parameter value >+ * is ignored if any of the following conditions are true: >+ * <p> >+ * <ul> >+ * <li>The current selected value is less than the minimum value.</li> >+ * <li>The current selected value is greater than the maximum value.</li> >+ * <li>The current selected value is less than zero.</li> >+ * <p> >+ * >+ * @param selection >+ * Current selected value of the progress bar. >+ */ >+ public void setSelection(int selection) { >+ >+ if ((selection >= 0) && (selection >= minimum) && (selection <= maximum)) { >+ >+ this.selection = selection; >+ >+ updateProgress(); >+ } >+ } >+ >+ /** >+ * Sets the color of the progress bar. If the parameter value is >+ * <code>null</code>, the color is set to a default color ({@link SWT.COLOR_DARK_BLUE}). >+ * <p> >+ * >+ * @param color >+ * Color of the progress bar. >+ */ >+ public void setColor(Color color) { >+ >+ if (color != null) { >+ progressBar.setBackground(color); >+ } else { >+ progressBar.setBackground(DEFAULT_PROGRESS_BAR_COLOR); >+ } >+ >+ updateProgress(); >+ } >+ >+ /** >+ * Increments the current selected value of the progress bar by one. >+ * <p> >+ */ >+ public void incrementSelection() { >+ setSelection(getSelection() + 1); >+ } >+ >+ /** >+ * No-operation. >+ * <p> >+ * Note: The layout can not be set on a this class. >+ * <p> >+ * >+ * @see org.eclipse.swt.widgets.Composite#setLayout(org.eclipse.swt.widgets.Layout) >+ */ >+ public void setLayout(Layout layout) { >+ // No-operation. >+ } >+ >+ private void buildProgressBar() { >+ >+ progressBar = new Composite(this, SWT.NONE); >+ progressBar.setBackground(DEFAULT_PROGRESS_BAR_COLOR); >+ >+ layout(false, true); >+ >+ addControlListener(new ControlListener() { >+ >+ public void controlMoved(ControlEvent con) { >+ // No-operation. >+ } >+ >+ public void controlResized(ControlEvent e) { >+ updateProgress(); >+ } >+ }); >+ } >+ >+ private void updateProgress() { >+ >+ progressBar.setBounds(0, 0, Math.round((((float)(selection - minimum)) / ((float)(maximum - minimum))) * ((float)(getBounds().width))), 17); >+ >+ layout(true, true); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 168580
: 59302