aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-16 16:55:47 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-16 16:55:47 +0000
commit8e382ac39fae61f44757ee419c5411985034ef40 (patch)
tree0852a78ace7820ef8744d6d1cbcffd9251b9f772
parentecd522615fb4d96a9649343a7461e9bbc3074e72 (diff)
downloadvaadin-framework-8e382ac39fae61f44757ee419c5411985034ef40.tar.gz
vaadin-framework-8e382ac39fae61f44757ee419c5411985034ef40.zip
concatenating css classnames instead of mangling dom many times
svn changeset:4534/svn branch:trunk
-rwxr-xr-xsrc/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
index 330f8595c1..1e79ad8f86 100755
--- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
@@ -753,21 +753,19 @@ public class ApplicationConnection {
updateComponentSize(component, uidl);
- // Styles + disabled & readonly
- component.setStyleName(component.getStylePrimaryName());
-
- // first disabling and read-only status
- boolean enabled = true;
- if (uidl.hasAttribute("disabled")) {
- enabled = !uidl.getBooleanAttribute("disabled");
- }
+ boolean enabled = !uidl.getBooleanAttribute("disabled");
if (component instanceof FocusWidget) {
((FocusWidget) component).setEnabled(enabled);
}
+
+ StringBuffer styleBuf = new StringBuffer();
+ String primaryName = component.getStylePrimaryName();
+ styleBuf.append(primaryName);
+
+ // first disabling and read-only status
if (!enabled) {
- component.addStyleName("i-disabled");
- } else {
- component.removeStyleName("i-disabled");
+ styleBuf.append(" ");
+ styleBuf.append("i-disabled");
}
// add additional styles as css classes, prefixed with component default
@@ -775,26 +773,31 @@ public class ApplicationConnection {
if (uidl.hasAttribute("style")) {
final String[] styles = uidl.getStringAttribute("style").split(" ");
for (int i = 0; i < styles.length; i++) {
- component.addStyleDependentName(styles[i]);
+ styleBuf.append(" ");
+ styleBuf.append(primaryName);
+ styleBuf.append("-");
+ styleBuf.append(styles[i]);
}
}
// add modified classname to Fields
if (component instanceof Field && uidl.hasAttribute("modified")) {
- component.addStyleName(MODIFIED_CLASSNAME);
+ styleBuf.append(" ");
+ styleBuf.append(MODIFIED_CLASSNAME);
}
// add error classname to components w/ error
if (uidl.hasAttribute("error")) {
- component.addStyleName(ERROR_CLASSNAME);
+ styleBuf.append(" ");
+ styleBuf.append(ERROR_CLASSNAME);
}
+ // Styles + disabled & readonly
+ component.setStyleName(styleBuf.toString());
+
if (usePaintableIdsInDOM) {
DOM.setElementProperty(component.getElement(), "id", uidl.getId());
}
- // TODO this should really build one string with all the classnames
- // and setStyleName() once
-
return false;
}