From: Marc Englund Date: Fri, 6 Jun 2008 08:40:32 +0000 (+0000) Subject: Fixed multiple bugs in ProgressIndicator: polled even if disabled or invisible (... X-Git-Tag: 6.7.0.beta1~4652 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2b851d47f2aa09e4b8535d3b39ed93440f6eee27;p=vaadin-framework.git Fixed multiple bugs in ProgressIndicator: polled even if disabled or invisible (#1581), had no isIndeterminate(), did not call requestRepaint() when changing polling interval or indeterminate mode. svn changeset:4771/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif b/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif new file mode 100644 index 0000000000..7a64d034b2 Binary files /dev/null and b/WebContent/ITMILL/themes/default/progressindicator/img/disabled.gif differ diff --git a/WebContent/ITMILL/themes/default/progressindicator/progressindicator.css b/WebContent/ITMILL/themes/default/progressindicator/progressindicator.css index 57bc14aba8..669942cc49 100644 --- a/WebContent/ITMILL/themes/default/progressindicator/progressindicator.css +++ b/WebContent/ITMILL/themes/default/progressindicator/progressindicator.css @@ -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; @@ -16,4 +23,10 @@ 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 diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java index 5845599cf5..c7c062c138 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java @@ -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 { diff --git a/src/com/itmill/toolkit/ui/ProgressIndicator.java b/src/com/itmill/toolkit/ui/ProgressIndicator.java index 8a48239da0..c10ac7daca 100644 --- a/src/com/itmill/toolkit/ui/ProgressIndicator.java +++ b/src/com/itmill/toolkit/ui/ProgressIndicator.java @@ -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(); } /**