diff options
author | John Ahlroos <john@vaadin.com> | 2012-10-17 15:58:06 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-10-17 15:58:06 +0300 |
commit | 75b045efd11c82af56bc29d98ac25f287f896c4d (patch) | |
tree | b073fd63486a5c5eefca3b021266339d81794891 | |
parent | 43c3f454d419c0eb7b0d094c4cf853e3ec3867ae (diff) | |
download | vaadin-framework-75b045efd11c82af56bc29d98ac25f287f896c4d.tar.gz vaadin-framework-75b045efd11c82af56bc29d98ac25f287f896c4d.zip |
Fixed multiple stylename handling #9983
Change-Id: Iae0acde0c8cba4b7c1fc4166bb19f7f619c3afd5
-rw-r--r-- | client/src/com/vaadin/client/ui/AbstractComponentConnector.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 6ff51b3766..8b6c4fb8aa 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -273,7 +273,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector if (state.primaryStyleName != null) { /* * We overwrite the widgets primary stylename if state defines a - * primary stylename. Clears all previous stylenames. + * primary stylename. */ getWidget().setStylePrimaryName(state.primaryStyleName); } @@ -293,24 +293,24 @@ public abstract class AbstractComponentConnector extends AbstractConnector // add additional user defined style names as class names, prefixed with // component default class name. remove nonexistent style names. if (ComponentStateUtil.hasStyles(state)) { - // add new style names - List<String> newStyles = new ArrayList<String>(); - newStyles.addAll(state.styles); - newStyles.removeAll(styleNames); - for (String newStyle : newStyles) { - setWidgetStyleName(newStyle, true); - setWidgetStyleNameWithPrefix(primaryStyleName + "-", newStyle, - true); - } - // remove nonexistent style names - styleNames.removeAll(state.styles); + + // Remove all old stylenames for (String oldStyle : styleNames) { setWidgetStyleName(oldStyle, false); setWidgetStyleNameWithPrefix(primaryStyleName + "-", oldStyle, false); } + + // add new style names + for (String newStyle : state.styles) { + setWidgetStyleName(newStyle, true); + setWidgetStyleNameWithPrefix(primaryStyleName + "-", newStyle, + true); + } + styleNames.clear(); styleNames.addAll(state.styles); + } else { // remove all old style names for (String oldStyle : styleNames) { |