diff options
author | Artur Signell <artur@vaadin.com> | 2013-05-28 19:52:21 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-29 13:42:04 +0000 |
commit | a5b8209d928815aab9eee2151bdd00686a2b0ff7 (patch) | |
tree | 8a0cd2d8bbe50dbdeb156b64af0c3883df5622a7 /client | |
parent | 91182e237f2f4f8784582887970c32b5be3ad7c5 (diff) | |
download | vaadin-framework-a5b8209d928815aab9eee2151bdd00686a2b0ff7.tar.gz vaadin-framework-a5b8209d928815aab9eee2151bdd00686a2b0ff7.zip |
Add primary style name support for ProgressBar/Indicator (#9913)
Change-Id: I3d773640d2f1c8cd1b71c673685afd7059811d16
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VProgressBar.java | 32 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VProgressIndicator.java | 6 |
2 files changed, 29 insertions, 9 deletions
diff --git a/client/src/com/vaadin/client/ui/VProgressBar.java b/client/src/com/vaadin/client/ui/VProgressBar.java index 3eb8725520..8cfc28005c 100644 --- a/client/src/com/vaadin/client/ui/VProgressBar.java +++ b/client/src/com/vaadin/client/ui/VProgressBar.java @@ -21,6 +21,8 @@ import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.ApplicationConnection; +import com.vaadin.shared.ui.progressindicator.ProgressBarState; /** * Widget for showing the current progress of a long running task. @@ -35,26 +37,39 @@ import com.google.gwt.user.client.ui.Widget; */ public class VProgressBar extends Widget implements HasEnabled { - public static final String CLASSNAME = "v-progressindicator"; Element wrapper = DOM.createDiv(); Element indicator = DOM.createDiv(); - protected boolean indeterminate = false; - protected float state = 0.0f; + private boolean indeterminate = false; + private float state = 0.0f; private boolean enabled; public VProgressBar() { setElement(DOM.createDiv()); getElement().appendChild(wrapper); - setStyleName(CLASSNAME); wrapper.appendChild(indicator); - indicator.setClassName(CLASSNAME + "-indicator"); - wrapper.setClassName(CLASSNAME + "-wrapper"); + + setStylePrimaryName(ProgressBarState.PRIMARY_STYLE_NAME); + } + + /* + * (non-Javadoc) + * + * @see + * com.google.gwt.user.client.ui.UIObject#setStylePrimaryName(java.lang. + * String) + */ + @Override + public void setStylePrimaryName(String style) { + super.setStylePrimaryName(style); + indicator.setClassName(getStylePrimaryName() + "-indicator"); + wrapper.setClassName(getStylePrimaryName() + "-wrapper"); + } public void setIndeterminate(boolean indeterminate) { this.indeterminate = indeterminate; - setStyleName(CLASSNAME + "-indeterminate", indeterminate); + setStyleName(getStylePrimaryName() + "-indeterminate", indeterminate); } public void setState(float state) { @@ -78,8 +93,7 @@ public class VProgressBar extends Widget implements HasEnabled { @Override public void setEnabled(boolean enabled) { this.enabled = enabled; - setStyleName("v-disabled", !enabled); - + setStyleName(ApplicationConnection.DISABLED_CLASSNAME, !enabled); } } diff --git a/client/src/com/vaadin/client/ui/VProgressIndicator.java b/client/src/com/vaadin/client/ui/VProgressIndicator.java index 500a5def30..c75113b5f4 100644 --- a/client/src/com/vaadin/client/ui/VProgressIndicator.java +++ b/client/src/com/vaadin/client/ui/VProgressIndicator.java @@ -16,6 +16,8 @@ package com.vaadin.client.ui; +import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState; + /** * * @author Vaadin Ltd @@ -25,4 +27,8 @@ package com.vaadin.client.ui; @Deprecated public class VProgressIndicator extends VProgressBar { + public VProgressIndicator() { + super(); + setStylePrimaryName(ProgressIndicatorState.PRIMARY_STYLE_NAME); + } } |