Example usage for javax.swing.event TreeModelListener treeNodesInserted

List of usage examples for javax.swing.event TreeModelListener treeNodesInserted

Introduction

In this page you can find the example usage for javax.swing.event TreeModelListener treeNodesInserted.

Prototype

void treeNodesInserted(TreeModelEvent e);

Source Link

Document

Invoked after nodes have been inserted into the tree.

Use e.getPath() to get the parent of the new node(s).

Usage

From source file:CreatingTreeModel.java

public void fireTreeNodesInserted(TreeModelEvent e) {
    Enumeration listenerCount = listeners.elements();
    while (listenerCount.hasMoreElements()) {
        TreeModelListener listener = (TreeModelListener) listenerCount.nextElement();
        listener.treeNodesInserted(e);
    }//  w  w  w .  ja va 2s .  c o  m
}

From source file:com.nbt.NBTTreeTableModel.java

/**
 * @see TreeModelEvent#TreeModelEvent(Object, Object[], int[], Object[])
 * @see TreeModelEvent#TreeModelEvent(Object, TreePath, int[], Object[])
 * @see TreeModelListener#treeNodesInserted(TreeModelEvent)
 *///  ww  w . j  a v  a 2  s.co  m
protected void fireTreeNodesInserted(Object source, TreePath path, int[] childIndices, Object[] children) {
    TreeModelEvent event = new TreeModelEvent(source, path, childIndices, children);
    TreeModelListener[] listeners = getTreeModelListeners();
    ArrayUtils.reverse(listeners);
    for (TreeModelListener listener : listeners)
        listener.treeNodesInserted(event);
}

From source file:gov.nij.er.ui.RawDataFilteredTreeModel.java

RawDataFilteredTreeModel(RecordTreeModel rawDataTreeModel) {
    this.rawDataTreeModel = rawDataTreeModel;
    rawDataTreeModel.addTreeModelListener(new TreeModelListener() {

        public void treeNodesChanged(TreeModelEvent e) {
            if (!isFiltered) {
                for (TreeModelListener l : listeners) {
                    l.treeNodesChanged(e);
                }/*from   w w w .jav a 2s.com*/
            }
        }

        public void treeNodesInserted(TreeModelEvent e) {
            if (!isFiltered) {
                for (TreeModelListener l : listeners) {
                    l.treeNodesInserted(e);
                }
            }
        }

        public void treeNodesRemoved(TreeModelEvent e) {
            if (!isFiltered) {
                for (TreeModelListener l : listeners) {
                    l.treeNodesRemoved(e);
                }
            }
        }

        public void treeStructureChanged(TreeModelEvent e) {
            if (!isFiltered) {
                for (TreeModelListener l : listeners) {
                    l.treeStructureChanged(e);
                }
            }
        }
    });
    root = new DefaultMutableTreeNode(ROOT_NODE_LABEL);

}

From source file:org.drugis.mtc.gui.AnalysesModel.java

private void fireTreeNodeAdded(Object parent, Object newObj) {
    int index = getIndexOfChild(parent, newObj);
    TreeModelEvent event = createTreeEvent(parent, newObj, index);
    for (TreeModelListener l : new ArrayList<TreeModelListener>(d_listeners)) {
        l.treeNodesInserted(event);
    }/*  ww w . j  ava2  s. com*/
}