aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/declarative
diff options
context:
space:
mode:
authorMaciej PrzepioĢra <matthew@vaadin.com>2015-05-25 10:08:59 +0200
committerVaadin Code Review <review@vaadin.com>2015-05-25 21:53:28 +0000
commite2678791bb028746f1b78aa232bef4240ebffa92 (patch)
tree6d5d496d8a8e49d15b2ff70cafe0d5b22aff22ac /server/src/com/vaadin/ui/declarative
parenta562635f09cbb9d7a7d550a7429de754609bc384 (diff)
downloadvaadin-framework-e2678791bb028746f1b78aa232bef4240ebffa92.tar.gz
vaadin-framework-e2678791bb028746f1b78aa232bef4240ebffa92.zip
Fix font icon codepoint formatting in DesignResourceConverter (#17970)
ResourceReference.getURL() is now used to ensure consistency. Change-Id: Ic204a826c093fc34af2be1e0e4e8a8dd4f820e09
Diffstat (limited to 'server/src/com/vaadin/ui/declarative')
-rw-r--r--server/src/com/vaadin/ui/declarative/converters/DesignResourceConverter.java13
1 files changed, 5 insertions, 8 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