Associate the content controller with the SDM engine
and the handler.
_controller = new IlvContentController();
_controller.setSDMEngine(diagrammer.getEngine());
_controller.setContentHandler(new ContentHandler());
private class ContentHandler extends IlvContentHandler() {
// here we load/unload objects
private void loadObject(Object node, boolean load) {
if (load) {
model.setObjectProperty(node, CONTENT, ...);
} else {
// unload values
model.setObjectProperty(node, CONTENT, null);
}
}
// callback for loading content
public void loadContent(IlvContentController source, Object[] objects) {
// prevent too much notifications
diagrammer.setAdjusting(true);
// loop over objects to load
for (int i=0; i<objects.length; i++) {
loadObject(objects[i], true);
}
diagrammer.setAdjusting(false);
}
// callback for unloading content
public void unloadContent(IlvContentController source, Object[]
objects) {
diagrammer.setAdjusting(true);
for (int i=0; i<objects.length; i++) {
loadObject(objects[i], false);
}
diagrammer.setAdjusting(false);
}
}
}