* @param observable the observable object
* @param obj the object
*/
public void update(Observable observable, Object obj) {
if (obj == null) {
setModel(new DefaultTreeModel(new FormTreeNode()));
xfaFile = null;
xfaTree.clear();
xfaTextArea.clear();
repaint();
return;
}
if (obj instanceof ObjectLoader) {
ObjectLoader loader = (ObjectLoader)obj;
TreeNodeFactory factory = loader.getNodes();
PdfTrailerTreeNode trailer = controller.getPdfTree().getRoot();
PdfObjectTreeNode catalog = factory.getChildNode(trailer, PdfName.ROOT);
PdfObjectTreeNode form = factory.getChildNode(catalog, PdfName.ACROFORM);
if (form == null) {
return;
}
PdfObjectTreeNode fields = factory.getChildNode(form, PdfName.FIELDS);
FormTreeNode root = new FormTreeNode();
if (fields != null) {
FormTreeNode node = new FormTreeNode(fields);
node.setUserObject("Fields");
loadFields(factory, node, fields);
root.add(node);
}
PdfObjectTreeNode xfa = factory.getChildNode(form, PdfName.XFA);
if (xfa != null) {
XfaTreeNode node = new XfaTreeNode(xfa);
node.setUserObject("XFA");
loadXfa(factory, node, xfa);
root.add(node);
try {
xfaFile = new XfaFile(node);
xfaTree.load(xfaFile);