show mutual properties across different component types

This commit is contained in:
bancika
2011-08-27 20:36:37 +00:00
parent 7d3a7c30ca
commit 69e2296c23
7 changed files with 29 additions and 16 deletions
@@ -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() {
@@ -74,6 +74,14 @@ public class PropertyWrapper implements Cloneable {
public IPropertyValidator getValidator() {
return validator;
}
public boolean isUnique() {
return unique;
}
public void setUnique(boolean unique) {
this.unique = unique;
}
// @Override
// public Object clone() throws CloneNotSupportedException {
@@ -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) {
@@ -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>