use of maspack.util.Clonable in project artisynth_core by artisynth.
the class CompositePropertyPanel method tryCreatingCpropFromPrototype.
/**
* Try to create a prototype for a particular type of composite property by
* cloning an instance (if there is one) in a host list.
*/
private CompositeProperty tryCreatingCpropFromPrototype(Class<?> type) {
CompositeProperty protoCprop = null;
EditingProperty eprop = (EditingProperty) myCpropProperty;
HostList hostList = eprop.getHostList();
Object[] values = hostList.getAllValues(eprop.getCell());
for (int i = 0; i < values.length; i++) {
if (type.isInstance(values[i]) && values[i] instanceof Clonable) {
try {
protoCprop = (CompositeProperty) ((Clonable) values[i]).clone();
} catch (Exception e) {
System.out.println("Warning: clone failed for " + values[i].getClass());
}
if (protoCprop != null) {
break;
}
}
}
return protoCprop;
}
Aggregations