getAllowsChildren ( )源码实例Demo

javax.swing.tree.DefaultMutableTreeNode#getAllowsChildren ( )源码实例Demo

下面列出了javax.swing.tree.DefaultMutableTreeNode#getAllowsChildren ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: FmtSpaces.java
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;
}
 
源代码2 项目: netbeans   文件: FmtSpaces.java
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;
    }
 
源代码3 项目: netbeans   文件: FmtSpaces.java
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;
    }
 
源代码4 项目: netbeans   文件: FmtSpaces.java
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;
    }
 
@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());
		}
	}
}
 
源代码6 项目: DiskBrowser   文件: ProdosDisk.java
@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);
}
 
源代码7 项目: Spark   文件: WorkgroupInvitationDialog.java
/**
 * 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;
}