use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method getDocsTree.
/**
* This method initializes docsNode
*
* @return javax.swing.JTree
*/
private JTree getDocsTree() {
if (docsTree == null) {
docsTree = new JTree(new DefaultMutableTreeNode("ROOT"));
docsTree.setRootVisible(false);
docsTree.setToggleClickCount(1);
docsTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
docNodeSelected = (DefaultMutableTreeNode) docsTree.getLastSelectedPathComponent();
if (docNodeSelected != null) {
docSelected = (EbeDocument) docNodeSelected.getUserObject();
locationField.setText(docSelected.getPath());
} else {
locationField.setText("(none)");
}
complexNodeSelected = null;
complexSelected = null;
refreshNodesTree();
refreshDocTable();
try {
loadXmlView();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
}
ToolTipManager.sharedInstance().registerComponent(docsTree);
return docsTree;
}
use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method isError.
protected boolean isError(Object value) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object nodeInfo = (Object) (node.getUserObject());
if (nodeInfo instanceof Error) {
return true;
}
return false;
}
use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method refreshDocsTree.
public void refreshDocsTree() {
TreeMap<String, EbeDocument> docs = manager.getDocuments();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) docsTree.getModel().getRoot();
root.removeAllChildren();
for (EbeDocument doc : docs.values()) {
root.add(new DefaultMutableTreeNode(doc));
}
((DefaultTreeModel) docsTree.getModel()).reload();
}
use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method refreshNodesTree.
private void refreshNodesTree() {
DefaultTreeModel model = (DefaultTreeModel) nodesTree.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
root.removeAllChildren();
if (docSelected == null) {
model.reload();
return;
}
TreeMap<String, ComplexObject> nodes = docSelected.getNodes();
for (ComplexObject node : nodes.values()) {
root.add(new DefaultMutableTreeNode(node));
}
model.reload();
}
use of javax.swing.tree.DefaultMutableTreeNode in project ACS by ACS-Community.
the class ErrorTreeCellRenderer method isCompletion.
protected boolean isCompletion(Object value) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object nodeInfo = (Object) (node.getUserObject());
if (nodeInfo instanceof Completion) {
return true;
}
return false;
}
Aggregations