From bde44c29bdec4647dbec94b1ed2482baaf00cddf Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 27 Mar 2013 09:57:40 +0200 Subject: Implemented changes to CSS injection based on API review #5500 Change-Id: I2bed5f5a5c3cfc6b97e94cbd218bb06f446c7325 --- .../v71beta/CSSInjectWithColorpicker.java | 18 +++++++++--------- uitest/src/com/vaadin/tests/themes/CSSInjectTest.java | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java index 09c5f91293..e3b8f997e0 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java @@ -5,7 +5,7 @@ import java.util.Arrays; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.server.Page; -import com.vaadin.server.Page.StyleSheet; +import com.vaadin.server.Page.Styles; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.colorpicker.Color; @@ -125,10 +125,10 @@ public class CSSInjectWithColorpicker extends UI { Color color = event.getColor(); // Get the stylesheet of the page - StyleSheet styles = Page.getCurrent().getStyleSheet(); + Styles styles = Page.getCurrent().getStyles(); // inject the new background color - styles.inject(".v-app .v-textarea.text-label { background-color:" + styles.add(".v-app .v-textarea.text-label { background-color:" + color.getCSS() + "; }"); } }); @@ -153,10 +153,10 @@ public class CSSInjectWithColorpicker extends UI { Color color = event.getColor(); // Get the stylesheet of the page - StyleSheet styles = Page.getCurrent().getStyleSheet(); + Styles styles = Page.getCurrent().getStyles(); // inject the new color as a style - styles.inject(".v-app .v-textarea.text-label { color:" + styles.add(".v-app .v-textarea.text-label { color:" + color.getCSS() + "; }"); } }); @@ -186,11 +186,11 @@ public class CSSInjectWithColorpicker extends UI { String fontFamily = select.getValue().toString(); // Get the stylesheet of the page - StyleSheet styles = Page.getCurrent().getStyleSheet(); + Styles styles = Page.getCurrent().getStyles(); // inject the new font size as a style. We need .v-app to // override Vaadin's default styles here - styles.inject(".v-app .v-textarea.text-label { font-family:" + styles.add(".v-app .v-textarea.text-label { font-family:" + fontFamily + "; }"); } }); @@ -220,11 +220,11 @@ public class CSSInjectWithColorpicker extends UI { Integer fontSize = (Integer) select.getValue(); // Get the stylesheet of the page - StyleSheet styles = Page.getCurrent().getStyleSheet(); + Styles styles = Page.getCurrent().getStyles(); // inject the new font size as a style. We need .v-app to // override Vaadin's default styles here - styles.inject(".v-app .v-textarea.text-label { font-size:" + styles.add(".v-app .v-textarea.text-label { font-size:" + String.valueOf(fontSize) + "px; }"); } }); diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java index bedbf47fe2..f4448bf326 100644 --- a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java +++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java @@ -5,7 +5,7 @@ import java.io.InputStream; import java.util.UUID; import com.vaadin.server.Page; -import com.vaadin.server.Page.StyleSheet; +import com.vaadin.server.Page.Styles; import com.vaadin.server.StreamResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.TestBase; @@ -19,10 +19,10 @@ public class CSSInjectTest extends TestBase { @Override protected void setup() { - final StyleSheet stylesheet = Page.getCurrent().getStyleSheet(); + final Styles stylesheet = Page.getCurrent().getStyles(); // Inject some resources initially - stylesheet.inject(new StreamResource(new StreamResource.StreamSource() { + stylesheet.add(new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { @@ -44,7 +44,7 @@ public class CSSInjectTest extends TestBase { @Override public void buttonClick(ClickEvent event) { - stylesheet.inject(cssToInject.getValue()); + stylesheet.add(cssToInject.getValue()); cssToInject.setValue(""); } }); @@ -58,7 +58,7 @@ public class CSSInjectTest extends TestBase { final String css = cssToInject.getValue(); - stylesheet.inject(new StreamResource( + stylesheet.add(new StreamResource( new StreamResource.StreamSource() { @Override -- cgit v1.2.3