use of maspack.properties.PropertyList in project artisynth_core by artisynth.
the class IsRenderableHolder method init.
private void init(IsRenderable renderable) {
if (renderable == null) {
throw new IllegalArgumentException("Cannot hold a null object");
}
myRenderable = renderable;
myProps = new PropertyList(IsRenderableHolder.class, RenderableComponentBase.class);
myProps.add("renderProps * *", "render properties", null);
if (myRenderable instanceof HasProperties) {
myProps.addReadOnly("renderable", "the held renderable object");
}
if (myRenderable instanceof HasRenderProps) {
myHasRenderProps = (HasRenderProps) myRenderable;
getRenderPropsMethod = null;
setRenderPropsMethod = null;
createRenderPropsMethod = null;
} else {
myHasRenderProps = null;
// try to find methods
Class<?> clazz = myRenderable.getClass();
getRenderPropsMethod = getMethod(clazz, "getRenderProps");
setRenderPropsMethod = getMethod(clazz, "setRenderProps", RenderProps.class);
createRenderPropsMethod = getMethod(clazz, "createRenderProps");
}
if (myRenderable instanceof Scannable) {
myScannable = (Scannable) myRenderable;
writeMethod = null;
scanMethod = null;
} else {
myScannable = null;
Class<?> clazz = myRenderable.getClass();
writeMethod = getMethod(clazz, "write", PrintWriter.class, NumberFormat.class, Object.class);
scanMethod = getMethod(clazz, "scan", ReaderTokenizer.class, CompositeComponent.class);
}
}
Aggregations