Java Code Examples for javax.swing.tree.DefaultMutableTreeNode#getAllowsChildren()
The following examples show how to use
javax.swing.tree.DefaultMutableTreeNode#getAllowsChildren() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FmtSpaces.java From netbeans with Apache License 2.0 | 6 votes |
private boolean toggle(TreePath treePath) { if( treePath == null ) { return false; } Object o = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject(); DefaultTreeModel dtm = (DefaultTreeModel)cfgTree.getModel(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); if ( o instanceof Item ) { Item item = (Item)o; if ( node.getAllowsChildren() ) { return false; } item.value = !item.value; dtm.nodeChanged(node); dtm.nodeChanged(node.getParent()); scs.notifyChanged(); } return false; }
Example 2
Source File: FmtSpaces.java From netbeans with Apache License 2.0 | 6 votes |
private boolean toggle(TreePath treePath) { if( treePath == null ) { return false; } Object o = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject(); DefaultTreeModel dtm = (DefaultTreeModel)cfgTree.getModel(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); if ( o instanceof Item ) { Item item = (Item)o; if ( node.getAllowsChildren() ) { return false; } item.value = !item.value; dtm.nodeChanged(node); dtm.nodeChanged(node.getParent()); scs.notifyChanged(); } return false; }
Example 3
Source File: FmtSpaces.java From netbeans with Apache License 2.0 | 6 votes |
private boolean toggle(TreePath treePath) { if( treePath == null ) { return false; } Object o = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject(); DefaultTreeModel dtm = (DefaultTreeModel)cfgTree.getModel(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); if ( o instanceof Item ) { Item item = (Item)o; if ( node.getAllowsChildren() ) { return false; } item.value = !item.value; dtm.nodeChanged(node); dtm.nodeChanged(node.getParent()); scs.notifyChanged(); } return false; }
Example 4
Source File: FmtSpaces.java From netbeans with Apache License 2.0 | 6 votes |
private boolean toggle(TreePath treePath) { if (treePath == null) { return false; } Object o = ((DefaultMutableTreeNode) treePath.getLastPathComponent()).getUserObject(); DefaultTreeModel dtm = (DefaultTreeModel) cfgTree.getModel(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); if (o instanceof Item) { Item item = (Item) o; if (node.getAllowsChildren()) { return false; } item.value = !item.value; dtm.nodeChanged(node); dtm.nodeChanged(node.getParent()); scs.notifyChanged(); } return false; }
Example 5
Source File: ClusterTreeVisualization.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
@Override public void valueChanged(TreeSelectionEvent e) { TreePath[] paths = getSelectionPaths(); // If only one item has been selected, then change the text in the // description area if (paths == null) { return; } if (paths.length == 1) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0].getLastPathComponent(); if (!node.getAllowsChildren()) { ClusterTreeLeaf leaf = (ClusterTreeLeaf) node.getUserObject(); ObjectVisualizer viz = ObjectVisualizerService.getVisualizerForObject(clusterModel); viz.startVisualization(leaf.getId()); } } }
Example 6
Source File: ProdosDisk.java From DiskBrowser with GNU General Public License v3.0 | 6 votes |
@Override public int compare (DefaultMutableTreeNode o1, DefaultMutableTreeNode o2) { boolean folder1 = o1.getAllowsChildren (); boolean folder2 = o2.getAllowsChildren (); // if (o1.isLeaf () && !o2.isLeaf ()) if (folder1 && !folder2) return -1; // if (!o1.isLeaf () && o2.isLeaf ()) if (!folder1 && folder2) return 1; String name1 = ((FileEntry) o1.getUserObject ()).name; String name2 = ((FileEntry) o2.getUserObject ()).name; return name1.compareTo (name2); }
Example 7
Source File: WorkgroupInvitationDialog.java From Spark with Apache License 2.0 | 6 votes |
/** * Handles tree selection of an agent. * * @return the agents jid. */ private EntityBareJid getAgent() { EntityBareJid agentJID; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); if (node == null || node.getAllowsChildren()) { return null; } agentJID = roster.getAgentJID((JiveTreeNode)node); if (agentJID == null) { final Object nodeInfo = node.getUserObject(); if (!node.isLeaf()) { return null; } agentJID = JidCreate.entityBareFromOrThrowUnchecked(nodeInfo.toString()); } return agentJID; }