diff options
author | John Ahlroos <john@vaadin.com> | 2012-09-24 14:44:19 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-09-24 14:44:19 +0300 |
commit | cc3013a1e6e94872fb6ec07e756201495ec03ab6 (patch) | |
tree | 081b8824f5a321a2a471f6696866d0ac3ce7a99b | |
parent | b7db84e161ab4098750a3cf85e6c481af5df185a (diff) | |
download | vaadin-framework-cc3013a1e6e94872fb6ec07e756201495ec03ab6.tar.gz vaadin-framework-cc3013a1e6e94872fb6ec07e756201495ec03ab6.zip |
Added primary stylename handling on server side #9724
4 files changed, 26 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index b1d31370b3..c6990d92f1 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -271,7 +271,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector protected void updateWidgetStyleNames() { ComponentState state = getState(); - String primaryStyleName = getWidget().getStylePrimaryName(); + String primaryStyleName = state.primaryStyleName == null ? "" + : state.primaryStyleName; // should be in AbstractFieldConnector ? // add / remove read-only style name diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index c49d6237b8..51510ce00a 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -197,6 +197,16 @@ public abstract class AbstractComponent extends AbstractClientConnector } @Override + public void setPrimaryStylename(String style) { + getState().primaryStyleName = style; + } + + @Override + public String getPrimaryStyleName() { + return getState().primaryStyleName; + } + + @Override public void addStyleName(String style) { if (style == null || "".equals(style)) { return; diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 320a9dc97c..dd7ea6278b 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -198,6 +198,19 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public void removeStyleName(String style); /** + * FIXME Javadoc + */ + public String getPrimaryStyleName(); + + /** + * FIXME Javadoc + * + * @param style + * The stylename to set + */ + public void setPrimaryStylename(String style); + + /** * Tests whether the component is enabled or not. A user can not interact * with disabled components. Disabled components are rendered in a style * that indicates the status, usually in gray color. Children of a disabled diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/ComponentState.java index 7d286f39a0..2ecf09b422 100644 --- a/shared/src/com/vaadin/shared/ComponentState.java +++ b/shared/src/com/vaadin/shared/ComponentState.java @@ -39,6 +39,7 @@ public class ComponentState extends SharedState { public String caption = null; public List<String> styles = null; public String id = null; + public String primaryStyleName = null; /** * A set of event identifiers with registered listeners. */ |