/**
* Exposes <code>Face</code> with given name, so that its properties can be modified.
*/
private void addFace(String faceName) throws Exception {
final JavaInfo face = JavaInfoUtils.addChildExposedByMethod(this, "get" + faceName);
m_faces.add(face);
// create ComplexProperty for each face
{
ComplexProperty faceProperty = new ComplexProperty(faceName, "(Face properties)") {
@Override
public void setValue(Object value) throws Exception {
if (value == Property.UNKNOWN_VALUE) {
face.delete();
}
}
};
faceProperty.setProperties(face.getProperties());
faceProperty.setCategory(PropertyCategory.system(100 + m_faces.size()));
m_faceProperties.add(faceProperty);
}
// when any face property is about to set, reset other properties
face.addBroadcastListener(new GenericPropertySetValue() {
public void invoke(GenericPropertyImpl property, Object[] value, boolean[] shouldSetValue)
throws Exception {
if (property.getJavaInfo() == face) {
face.delete();
}
}
});
}