]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed multiple bugs in ProgressIndicator: polled even if disabled or invisible (...
authorMarc Englund <marc.englund@itmill.com>
Fri, 6 Jun 2008 08:40:32 +0000 (08:40 +0000)
committerMarc Englund <marc.englund@itmill.com>
Fri, 6 Jun 2008 08:40:32 +0000 (08:40 +0000)
svn changeset:4771/svn branch:trunk

WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif [new file with mode: 0644]
WebContent/ITMILL/themes/default/progressindicator/progressindicator.css
src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java
src/com/itmill/toolkit/ui/ProgressIndicator.java

diff --git a/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif b/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif
new file mode 100644 (file)
index 0000000..7a64d03
Binary files /dev/null and b/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif differ
index 57bc14aba8cf2aaaa07104d16b41943d7df58145..669942cc498b0445646af780baa6aaa7295038ce 100644 (file)
@@ -5,6 +5,13 @@
        overflow: hidden; /* for IE6 */
 }
 
+.i-progressindicator-disabled {
+       background: #dfe2e4 url(img/disabled.gif);
+       height: 9px;
+       border: 1px solid #b6bbbc;
+       overflow: hidden; /* for IE6 */
+}
+
 .i-progressindicator div {
        background: #f7f9f9 url(img/progress.png);
        height: 9px;
        height: 16px;
        width: 16px;
        overflow: hidden; /* for IE6 */
+}
+.i-progressindicator-disabled-indeterminate {
+       background: #dfe2e4 url(../common/img/blank.gif);
+       height: 16px;
+       width: 16px;
+       overflow: hidden; /* for IE6 */
 }
\ No newline at end of file
index 5845599cf58cab91790873ef07f18bcd7e86dbe7..c7c062c138393ee56d5330c35482d709f51c4566 100644 (file)
@@ -41,9 +41,15 @@ public class IProgressIndicator extends Widget implements Paintable {
 
         indeterminate = uidl.getBooleanAttribute("indeterminate");
 
+        String style = CLASSNAME;
+        if (uidl.getBooleanAttribute("disabled")) {
+            style += "-disabled";
+        }
+
         if (indeterminate) {
-            this.setStyleName(CLASSNAME + "-indeterminate");
+            this.setStyleName(style + "-indeterminate");
         } else {
+            setStyleName(style);
             try {
                 final float f = Float.parseFloat(uidl
                         .getStringAttribute("state"));
@@ -52,7 +58,17 @@ public class IProgressIndicator extends Widget implements Paintable {
             } catch (final Exception e) {
             }
         }
-        poller.scheduleRepeating(uidl.getIntAttribute("pollinginterval"));
+
+        if (!uidl.getBooleanAttribute("disabled")) {
+            poller.scheduleRepeating(uidl.getIntAttribute("pollinginterval"));
+        }
+    }
+
+    public void setVisible(boolean visible) {
+        super.setVisible(visible);
+        if (!visible) {
+            poller.cancel();
+        }
     }
 
     class Poller extends Timer {
index 8a48239da0e08bfad10a502cce9f77ade89c4e85..c10ac7daca660de314f6a732d7f64e0c95759deb 100644 (file)
@@ -214,13 +214,23 @@ public class ProgressIndicator extends AbstractField implements Property,
     }
 
     /**
-     * Sets the ProgressIndicator to indeterminate mode.
+     * Sets wheter or not the ProgressIndicator is indeterminate.
      * 
      * @param newValue
      *                true to set to indeterminate mode.
      */
     public void setIndeterminate(boolean newValue) {
         indeterminate = newValue;
+        requestRepaint();
+    }
+
+    /**
+     * Gets whether or not the ProgressIndicator is indeterminate.
+     * 
+     * @return true to set to indeterminate mode.
+     */
+    public boolean isIndeterminate() {
+        return indeterminate;
     }
 
     /**
@@ -231,6 +241,7 @@ public class ProgressIndicator extends AbstractField implements Property,
      */
     public void setPollingInterval(int newValue) {
         pollingInterval = newValue;
+        requestRepaint();
     }
 
     /**