List of usage examples for javax.swing.tree TreeModel isLeaf
public boolean isLeaf(Object node);
true
if node
is a leaf. From source file:org.kepler.gui.OntLibrarySearcher.java
private void buildHashTable(NamedObj parent, TreeModel model) { for (int i = 0; i < model.getChildCount(parent); i++) { NamedObj child = (NamedObj) model.getChild(parent, i); _pathStack.push(child);//from w w w . j ava2 s. c o m if (model.isLeaf(child)) { Iterator<String> iter = getIds(child).iterator(); while (iter.hasNext()) { TreePath path = new TreePath(_pathStack.toArray()); hashTablePut(iter.next(), path); } } else { buildHashTable(child, model); } _pathStack.pop(); } }
From source file:org.pentaho.reporting.designer.core.ReportDesignerFrame.java
private void insertReports(final TreeModel model, final Object currentLevel, final XulMenupopup popup) throws XulException { final int childCount = model.getChildCount(currentLevel); for (int i = 0; i < childCount; i += 1) { final ReportDesignerView frame = context.getView(); final Object child = model.getChild(currentLevel, i); if (model.isLeaf(child)) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) child; final File file = new File(String.valueOf(node.getUserObject())); final OpenSampleReportAction action = new OpenSampleReportAction(file, node.toString()); action.setReportDesignerContext(context); popup.addChild(frame.createMenuItem(action)); } else {/*from w w w . j a va 2 s .com*/ final XulMenupopup childPopup = frame.createPopupMenu(String.valueOf(child), popup); insertReports(model, child, childPopup); } } }