Hi,

I'm looking for incubator sponsor for ProgressBar in order to evaluate a new
method that simplifies the way used to change to progress bar style class.

Sometimes it's necessary to change the progress bar style attributes
(example: color) according the progress value.

if (progressBar.getProgress() > 7) {
//change the progress bar color to red
} else if (progressBar.getProgress() > 4){
//change the progress bar color to yellow
} else {
//change the progress bar color to green
}

The problem is that the ProgressBar has an element (barElement) that does
not expose this option.
In the current version it's necessary to access the child element in order
to change its attribute.
Example: 
progressBar.getElement().getFirstChildElement().setClassName("gwt-ProgressBar-red");

I created a simple method that allows the user to set the bar style class in
a easier way.
Example: progressBar.setBarClassName("gwt-ProgressBar-red");

Please see the file attached.
I would appreciate any feedback.

Thanks

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Index: trunk-read-only/src/com/google/gwt/widgetideas/client/ProgressBar.java
===================================================================
--- trunk-read-only/src/com/google/gwt/widgetideas/client/ProgressBar.java	(revision 1709)
+++ trunk-read-only/src/com/google/gwt/widgetideas/client/ProgressBar.java	(working copy)
@@ -355,6 +355,13 @@
   }
 
   /**
+   * Change the class attribute of the bar element. 
+   */
+  public void setBarClassName(String className) {
+    barElement.setClassName(className);
+  }
+
+  /**
    * Get the text element.
    * 
    * @return the text element

Reply via email to