mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
fixed serialization issues
This commit is contained in:
@@ -98,6 +98,7 @@ public class ProjectFileManager {
|
||||
};
|
||||
xStream.autodetectAnnotations(true);
|
||||
xStream.alias("point", java.awt.geom.Point2D.class);
|
||||
xStream.alias("point", java.awt.geom.Point2D.Double.class);
|
||||
xStream.alias("font", java.awt.Font.class);
|
||||
xStream.alias("project", Project.class);
|
||||
xStream.aliasPackage("diylc", "org.diylc.components");
|
||||
@@ -108,6 +109,7 @@ public class ProjectFileManager {
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.addImmutableType(Color.class);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.class);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.Double.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Voltage.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Resistance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Capacitance.class);
|
||||
|
||||
@@ -59,8 +59,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
protected Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0),
|
||||
new Point2D.Double(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels())};
|
||||
// top-left and bottom-right points
|
||||
protected Point2D firstPoint = new Point2D.Double();
|
||||
protected Point2D secondPoint = new Point2D.Double();
|
||||
protected Point2D.Double firstPoint = new Point2D.Double();
|
||||
protected Point2D.Double secondPoint = new Point2D.Double();
|
||||
|
||||
protected Color boardColor = BOARD_COLOR;
|
||||
protected Color borderColor = BORDER_COLOR;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CutLine extends AbstractTransparentComponent<Void> {
|
||||
private Size width = WIDTH;
|
||||
private Size length = LENGTH;
|
||||
private Color color = COLOR;
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private OrientationHV orientation = OrientationHV.VERTICAL;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Dot extends AbstractComponent<Void> {
|
||||
|
||||
private Size size = SIZE;
|
||||
private Color color = COLOR;
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Eyelet extends AbstractComponent<String> {
|
||||
private Size size = SIZE;
|
||||
private Size holeSize = HOLE_SIZE;
|
||||
private Color color = COLOR;
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private String value = "";
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SolderPad extends AbstractComponent<Void> {
|
||||
|
||||
private Size size = SIZE;
|
||||
private Color color = COLOR;
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private Type type = Type.ROUND;
|
||||
private Size holeSize = HOLE_SIZE;
|
||||
private PCBLayer layer = PCBLayer._1;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
private OrientationHV orientation = OrientationHV.VERTICAL;
|
||||
private Size holeSpacing = VeroBoard.SPACING;
|
||||
|
||||
protected Point2D point = new Point2D.Double(0, 0);
|
||||
protected Point2D.Double point = new Point2D.Double(0, 0);
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Turret extends AbstractComponent<String> {
|
||||
private Size size = SIZE;
|
||||
private Size holeSize = HOLE_SIZE;
|
||||
private Color color = COLOR;
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private String value = "";
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BOM extends AbstractComponent<Void> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Size size = DEFAULT_SIZE;
|
||||
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private Color color = COLOR;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
public static Color COLOR = Color.black;
|
||||
public static Size SIZE = new Size(0.15d, SizeUnit.in);
|
||||
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private Color color = COLOR;
|
||||
private Size size = SIZE;
|
||||
private GroundSymbolType type = GroundSymbolType.DEFAULT;
|
||||
|
||||
@@ -57,8 +57,8 @@ public class Image extends AbstractTransparentComponent<Void> {
|
||||
private static ImageIcon ICON;
|
||||
private static byte DEFAULT_SCALE = 25;
|
||||
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D secondPoint = null;
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double secondPoint = null;
|
||||
|
||||
static {
|
||||
String name = "image.png";
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Label extends AbstractComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private String text = DEFAULT_TEXT;
|
||||
private Font font = LABEL_FONT;
|
||||
private Color color = LABEL_COLOR;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PCBText extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Point2D point = new Point2D.Double(0, 0);
|
||||
private Point2D.Double point = new Point2D.Double(0, 0);
|
||||
private String text = DEFAULT_TEXT;
|
||||
private Font font = DEFAULT_FONT;
|
||||
private Color color = LABEL_COLOR;
|
||||
|
||||
@@ -56,8 +56,8 @@ public class WrapLabel extends AbstractComponent<String> {
|
||||
|
||||
protected Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0),
|
||||
new Point2D.Double((int) DEFAULT_WIDTH.convertToPixels(), (int) DEFAULT_HEIGHT.convertToPixels())};
|
||||
protected Point2D firstPoint = new Point2D.Double();
|
||||
protected Point2D secondPoint = new Point2D.Double();
|
||||
protected Point2D.Double firstPoint = new Point2D.Double();
|
||||
protected Point2D.Double secondPoint = new Point2D.Double();
|
||||
|
||||
private Font font = LABEL_FONT;
|
||||
private Color color = LABEL_COLOR;
|
||||
|
||||
@@ -43,8 +43,8 @@ public abstract class AbstractShape extends AbstractTransparentComponent<Void> {
|
||||
protected String value = "";
|
||||
protected Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0),
|
||||
new Point2D.Double(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels())};
|
||||
protected Point2D firstPoint = new Point2D.Double();
|
||||
protected Point2D secondPoint = new Point2D.Double();
|
||||
protected Point2D.Double firstPoint = new Point2D.Double();
|
||||
protected Point2D.Double secondPoint = new Point2D.Double();
|
||||
|
||||
protected Color color = COLOR;
|
||||
protected Color borderColor = BORDER_COLOR;
|
||||
|
||||
@@ -68,6 +68,8 @@ public class TreeNode {
|
||||
public String forDisplay() {
|
||||
if (componentType == null) {
|
||||
String display = category;
|
||||
if (display == null)
|
||||
return null;
|
||||
Matcher match = contributedPattern.matcher(display);
|
||||
if (match.find()) {
|
||||
String name = match.group(1);
|
||||
|
||||
Reference in New Issue
Block a user