use of javafx.beans.property.Property in project Gargoyle by callakrsos.
the class PropertyChangeExam method propertyCopy.
public void propertyCopy(Node from, Node to) throws Exception {
Method[] fromMethods = from.getClass().getMethods();
Class<? extends Node> class1 = to.getClass();
for (Method fromMethod : fromMethods) {
String methodName = fromMethod.getName();
if (methodName.endsWith("Property")) {
Method targetMethod = class1.getMethod(methodName);
targetMethod.setAccessible(true);
if (targetMethod != null) {
Object fromPropertValue = fromMethod.invoke(from);
Object toPropertValue = targetMethod.invoke(from);
if (Property.class.isAssignableFrom(fromPropertValue.getClass())) {
if (WritableValue.class.isAssignableFrom(fromPropertValue.getClass())) {
// System.out.println("Writable : " +
// fromPropertValue);
// if
// (StyleConverter.class.isAssignableFrom(fromPropertValue.getClass()))
// {
Property fromProp = (Property) fromPropertValue;
Property toProp = (Property) toPropertValue;
Object value = fromProp.getValue();
if (value == null)
continue;
System.out.println("set value : " + fromProp.getValue());
toProp.setValue(fromProp.getValue());
}
// }
}
}
}
}
}
Aggregations