Java 8 TreeModelEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TreeModelEvent class.

This code example shows how to use the following methods:getSource, getChildren
         
        // listen for changes in the model (including check box toggles) 
        getModel().addTreeModelListener(new TreeModelListener() {
            @Override 
            public void treeNodesChanged(final TreeModelEvent e) {
                DefaultTreeModel model = (DefaultTreeModel)e.getSource();
                Object[] nodes = e.getChildren();
                DefaultMutableTreeNode node;
                if(nodes==null||nodes.length==0){ 
                    node = node(model.getRoot());
                }else{ 
                    node = node(nodes[0]);
                } 
                nodeChanged(node);
                repaint();
            } 
 
            @Override 
            public void treeNodesInserted(final TreeModelEvent e) {
                //System.out.println("nodes inserted"); 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	private TreeModelEvent getEvent(XACMLTreeNode node, int index)
	{ 
		final TreePath path = getPathToNode(node.getParent());
		final int[] childIndices = { index };
		final Object[] child = { node }; 
		final TreeModelEvent event = new TreeModelEvent(this, path, childIndices, child);
		return event;
	} 
	public static TreePath getPathToNode(XACMLTreeNode node)
	{ 
		final NodeContainer parent = node.getParent();
		if(parent == null)
			{return new TreePath(node);}
		return getPathToNode(parent).pathByAddingChild(node);
	} 
} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
         * @param l 
         */ 
        private void moveElementDown(RuleWrapper rw, ILegendPanel l){
                int i = rw.indexOf(l);
                rw.moveLegendDown(i);
                TreeModelEvent tme = new TreeModelEvent(
                        this,
                        new Object[]{root,rw}); 
                fireStructureChanged(tme);
        } 
 
        /** 
         * Manage element moves for RuleWrapper nodes. 
         * @param rw 
         */ 
        private void moveElementDown(RuleWrapper rw){
                int i = getIndexOfChild(root, rw);
                root.moveRuleWrapperDown(i);
                TreeModelEvent tme = new TreeModelEvent(
                        this,
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 TreeModelEvent Methods: