diff options
-rw-r--r-- | server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java | 13 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java | 8 |
2 files changed, 9 insertions, 12 deletions
diff --git a/server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index ff73b61eb2..ffa51fedd1 100644 --- a/server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -28,8 +28,8 @@ import com.vaadin.server.FontAwesome; import com.vaadin.server.FontIcon; import com.vaadin.server.GenericFontIcon; import com.vaadin.server.Resource; +import com.vaadin.server.ResourceReference; import com.vaadin.server.ThemeResource; -import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -109,8 +109,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) throws Converter.ConversionException { - return ApplicationConstants.THEME_PROTOCOL_PREFIX - + ((ThemeResource) value).getResourceId(); + return new ResourceReference(value, null, null).getURL(); } }, FONTICON { @@ -118,8 +117,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { public Resource parse(String value) { final String address = (value.split("://", 2))[1]; final String[] familyAndCode = address.split("/", 2); - final int codepoint = Integer.valueOf( - familyAndCode[1].substring(2), 16); + final int codepoint = Integer.valueOf(familyAndCode[1], 16); if (FontAwesome.FONT_FAMILY.equals(familyAndCode[0])) { try { @@ -141,9 +139,8 @@ public class DesignResourceConverter implements Converter<String, Resource> { public String format(Resource value) throws Converter.ConversionException { FontIcon icon = (FontIcon) value; - return ApplicationConstants.FONTICON_PROTOCOL_PREFIX - + icon.getFontFamily() + "/0x" - + Integer.toHexString(icon.getCodepoint()); + return new ResourceReference(icon, null, null).getURL(); + } }, @Deprecated diff --git a/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java b/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java index dcabd6c637..00af20ea8c 100644 --- a/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java +++ b/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java @@ -275,8 +275,8 @@ public class DesignFormatterTest { String httpUrl = "http://example.com/icon.png"; String httpsUrl = "https://example.com/icon.png"; String themePath = "icons/icon.png"; - String fontAwesomeUrl = "fonticon://FontAwesome/0xf0f9"; - String someOtherFontUrl = "fonticon://SomeOther/0xF0F9"; + String fontAwesomeUrl = "fonticon://FontAwesome/f0f9"; + String someOtherFontUrl = "fonticon://SomeOther/F0F9"; String fileSystemPath = "c:\\app\\resources\\icon.png"; assertEquals(httpUrl, formatter.format(new ExternalResource(httpUrl))); @@ -315,8 +315,8 @@ public class DesignFormatterTest { String httpUrl = "http://example.com/icon.png"; String httpsUrl = "https://example.com/icon.png"; String themePath = "icons/icon.png"; - String fontAwesomeUrl = "fonticon://FontAwesome/0xf0f9"; - String someOtherFont = "fonticon://SomeOther/0xF0F9"; + String fontAwesomeUrl = "fonticon://FontAwesome/f0f9"; + String someOtherFont = "fonticon://SomeOther/F0F9"; String fontAwesomeUrlOld = "font://AMBULANCE"; String fileSystemPath = "c:\\app\\resources\\icon.png"; |