mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
show mutual properties across different component types
This commit is contained in:
Binary file not shown.
+16
-8
@@ -1,7 +1,6 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
|
||||
@@ -16,12 +15,13 @@ public class PropertyWrapper implements Cloneable {
|
||||
private String name;
|
||||
private Class<?> type;
|
||||
private Object value;
|
||||
private Method setter;
|
||||
private Method getter;
|
||||
private String setter;
|
||||
private String getter;
|
||||
private boolean defaultable;
|
||||
private IPropertyValidator validator;
|
||||
private boolean unique = true;
|
||||
|
||||
public PropertyWrapper(String name, Class<?> type, Method getter, Method setter,
|
||||
public PropertyWrapper(String name, Class<?> type, String getter, String setter,
|
||||
boolean defaultable, IPropertyValidator validator) {
|
||||
super();
|
||||
this.name = name;
|
||||
@@ -33,8 +33,8 @@ public class PropertyWrapper implements Cloneable {
|
||||
}
|
||||
|
||||
public void readFrom(Object object) throws IllegalArgumentException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
this.value = getter.invoke(object);
|
||||
InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
this.value = object.getClass().getMethod(getter).invoke(object);
|
||||
}
|
||||
|
||||
// public void readUniqueFrom(IDIYComponent component)
|
||||
@@ -47,8 +47,8 @@ public class PropertyWrapper implements Cloneable {
|
||||
// }
|
||||
|
||||
public void writeTo(Object object) throws IllegalArgumentException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
setter.invoke(object, value);
|
||||
InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
object.getClass().getMethod(setter, this.value.getClass()).invoke(object, this.value);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -75,6 +75,14 @@ public class PropertyWrapper implements Cloneable {
|
||||
return validator;
|
||||
}
|
||||
|
||||
public boolean isUnique() {
|
||||
return unique;
|
||||
}
|
||||
|
||||
public void setUnique(boolean unique) {
|
||||
this.unique = unique;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Object clone() throws CloneNotSupportedException {
|
||||
// // Try to invoke clone method on value if possible.
|
||||
|
||||
+2
-2
@@ -141,8 +141,8 @@ public class ComponentProcessor {
|
||||
Method setter = clazz.getMethod("set" + method.getName().substring(3),
|
||||
method.getReturnType());
|
||||
PropertyWrapper property = new PropertyWrapper(name,
|
||||
method.getReturnType(), method, setter, annotation.defaultable(),
|
||||
validator);
|
||||
method.getReturnType(), method.getName(), setter.getName(),
|
||||
annotation.defaultable(), validator);
|
||||
properties.add(property);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
|
||||
+3
-1
@@ -173,9 +173,11 @@ public class InstantiationManager {
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
* @throws InvocationTargetException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws SecurityException
|
||||
*/
|
||||
public void fillWithDefaultProperties(Object object) throws IllegalArgumentException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
// Extract properties.
|
||||
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(
|
||||
object.getClass());
|
||||
|
||||
@@ -324,7 +324,11 @@
|
||||
</com.diyfever.gui.update.Change>
|
||||
<com.diyfever.gui.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Ctrl+click should not cleanup selection when clicked on the canvas</description>
|
||||
<description>Component edit dialog should show mutual properties when components of different types are selected (e.g. curved trace and straight trace witdth)</description>
|
||||
</com.diyfever.gui.update.Change>
|
||||
<com.diyfever.gui.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Ctrl+click should not clear selection when clicked on the canvas</description>
|
||||
</com.diyfever.gui.update.Change>
|
||||
<com.diyfever.gui.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
|
||||
+2
-3
@@ -8,7 +8,6 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
@@ -40,11 +39,11 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Width")
|
||||
public Size getSize() {
|
||||
public Size getThickness() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
public void setThickness(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
|
||||
break;
|
||||
case B9A:
|
||||
pinCount = 9;
|
||||
pinCircleDiameter = getClosestOdd(new Size(14d, SizeUnit.mm).convertToPixels());
|
||||
pinCircleDiameter = getClosestOdd(new Size(21d, SizeUnit.mm).convertToPixels());
|
||||
hasEmptySpace = true;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user