Skip to content

Commit

Permalink
Merge pull request #581 from bancika/next
Browse files Browse the repository at this point in the history
fixed serialization issues
  • Loading branch information
bancika committed Sep 18, 2020
2 parents e128c4c + 0fa1565 commit a680a5b
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public boolean shouldSerializeMember(Class definedIn, String fieldName) {
};
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");
Expand All @@ -108,6 +109,7 @@ public boolean shouldSerializeMember(Class definedIn, String fieldName) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion diylc/diylc-library/src/org/diylc/components/misc/BOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions diylc/diylc-library/src/org/diylc/components/misc/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public boolean isLeaf() {
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);
Expand Down

0 comments on commit a680a5b

Please sign in to comment.