mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Fix issue deserializing building blocks
This commit is contained in:
@@ -26,6 +26,7 @@ import com.thoughtworks.xstream.converters.MarshallingContext;
|
||||
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
|
||||
/**
|
||||
* Serializes {@link Font} objects in a more compact fashion. Backwards compatible when unmarshalling.
|
||||
@@ -34,8 +35,8 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
*/
|
||||
public class FontConverter extends com.thoughtworks.xstream.converters.extended.FontConverter {
|
||||
|
||||
public FontConverter() {
|
||||
super(null);
|
||||
public FontConverter(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +51,7 @@ public class FontConverter extends com.thoughtworks.xstream.converters.extended.
|
||||
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
|
||||
if (reader.getAttribute("name") != null) {
|
||||
return new Font(reader.getAttribute("name"), Integer.parseInt(reader.getAttribute("style")), Integer.parseInt(reader.getAttribute("size")));
|
||||
}
|
||||
}
|
||||
return super.unmarshal(reader, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ public class ProjectFileManager {
|
||||
xStream.aliasPackage("diylc", "org.diylc.components");
|
||||
xStream.registerConverter(new PointConverter());
|
||||
xStream.registerConverter(new ColorConverter());
|
||||
xStream.registerConverter(new FontConverter());
|
||||
xStream.registerConverter(new FontConverter(xStream.getMapper()));
|
||||
xStream.registerConverter(new MeasureConverter());
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.addImmutableType(Color.class, true);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.class, true);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.Double.class, true);
|
||||
|
||||
Reference in New Issue
Block a user