mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Added ability to set board size explicitly by typing in dimensions,
instead of dragging two control points
This commit is contained in:
@@ -29,5 +29,5 @@ package org.diylc.core;
|
||||
public class AllowAllValidator implements IPropertyValidator {
|
||||
|
||||
@Override
|
||||
public void validate(Object value) throws ValidationException {}
|
||||
public void validate(Object owner, Object value) throws ValidationException {}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.diylc.core.annotations.EditableProperty;
|
||||
*
|
||||
* @param <T> type of component values, e.g. Resistance for resistors or String for transistors.
|
||||
*/
|
||||
public interface IDIYComponent<T> extends Serializable {
|
||||
public interface IDIYComponent<T> extends Serializable, Cloneable {
|
||||
|
||||
public static final int CHASSIS = 1;
|
||||
public static final int BOARD = 2;
|
||||
|
||||
@@ -28,9 +28,10 @@ package org.diylc.core;
|
||||
*/
|
||||
public interface IPropertyValidator {
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param owner
|
||||
* @param value
|
||||
* @throws ValidationException if validation fails. Message will contain the reason.
|
||||
*/
|
||||
void validate(Object value) throws ValidationException;
|
||||
void validate(Object owner, Object value) throws ValidationException;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public class Project implements Serializable {
|
||||
public class Project implements Serializable, Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -292,8 +292,8 @@ public class Project implements Serializable {
|
||||
public static class SpacingValidator extends PositiveMeasureValidator {
|
||||
|
||||
@Override
|
||||
public void validate(Object value) throws ValidationException {
|
||||
super.validate(value);
|
||||
public void validate(Object owner, Object value) throws ValidationException {
|
||||
super.validate(owner, value);
|
||||
Size size = (Size) value;
|
||||
if (size.compareTo(new Size(0.1d, SizeUnit.mm)) < 0) {
|
||||
throw new ValidationException("must be at least 0.1mm");
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ import org.diylc.core.measures.AbstractMeasure;
|
||||
public class PositiveMeasureValidator implements IPropertyValidator {
|
||||
|
||||
@Override
|
||||
public void validate(Object value) throws ValidationException {
|
||||
public void validate(Object owner, Object value) throws ValidationException {
|
||||
if (value == null)
|
||||
return;
|
||||
if (value instanceof AbstractMeasure) {
|
||||
|
||||
+3
-3
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ import org.diylc.core.measures.AbstractMeasure;
|
||||
public class PositiveNonZeroMeasureValidator implements IPropertyValidator {
|
||||
|
||||
@Override
|
||||
public void validate(Object value) throws ValidationException {
|
||||
public void validate(Object owner, Object value) throws ValidationException {
|
||||
if (value == null)
|
||||
return;
|
||||
if (value instanceof AbstractMeasure) {
|
||||
|
||||
@@ -53,15 +53,6 @@ public class AbstractMeasure<T extends Enum<? extends Unit>> implements Serializ
|
||||
|
||||
public T getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
/***
|
||||
* Flag that designates if measure value should be converted between different units. eg. 2.54mm <-> 0.1in
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isConvertible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,10 +65,5 @@ public class Size extends AbstractMeasure<SizeUnit> implements Comparable<Size>
|
||||
@Override
|
||||
public int compareTo(Size o) {
|
||||
return new Double(value * unit.getFactor()).compareTo(o.getValue() * o.getUnit().getFactor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConvertible() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2710,6 +2710,10 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added "Tape Measure" component for measuring the distance between any two points on the drawing</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added ability to set board size explicitly by typing in dimensions, instead of dragging two control points</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>New app bundle for Mac OS using appbundler instead of javabundler</description>
|
||||
|
||||
Reference in New Issue
Block a user