Example usage for javax.swing.event TreeModelListener treeNodesChanged

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

Introduction

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

Prototype

void treeNodesChanged(TreeModelEvent e);

Source Link

Document

Invoked after a node (or a set of siblings) has changed in some way.

Usage

From source file:CreatingTreeModel.java

public void fireTreeNodesChanged(TreeModelEvent e) {
    Enumeration listenerCount = listeners.elements();
    while (listenerCount.hasMoreElements()) {
        TreeModelListener listener = (TreeModelListener) listenerCount.nextElement();
        listener.treeNodesChanged(e);
    }/*from   ww w . j  av a  2s  . co m*/

}

From source file:FileTreeFrame.java

private void fireTreeNodesChanged(TreePath parentPath, int[] indices, Object[] children) {
    TreeModelEvent event = new TreeModelEvent(this, parentPath, indices, children);
    Iterator iterator = listeners.iterator();
    TreeModelListener listener = null;
    while (iterator.hasNext()) {
        listener = (TreeModelListener) iterator.next();
        listener.treeNodesChanged(event);
    }//from w ww .jav  a  2 s.  c o  m
}

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);
                }//  www.  j a v a  2  s. c  o m
            }
        }

        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:com.igormaznitsa.mindmap.model.MindMap.java

private void fireTopicChanged(@Nullable final Topic topic) {
    final TreeModelEvent evt = new TreeModelEvent(this, topic == null ? null : topic.getPath());
    for (final TreeModelListener l : this.treeListeners) {
        l.treeNodesChanged(evt);
    }/*  ww w. j  a  v  a2 s.co  m*/
}

From source file:com.haulmont.cuba.desktop.gui.data.TreeModelAdapter.java

public TreeModelAdapter(HierarchicalDatasource datasource, CaptionMode captionMode, String captionProperty,
        boolean autoRefresh) {

    this.datasource = datasource;
    this.captionMode = captionMode;

    setCaptionProperty(captionProperty);

    this.autoRefresh = autoRefresh;

    this.metadataTools = AppBeans.get(MetadataTools.NAME);

    collectionChangeListener = e -> {
        switch (e.getOperation()) {
        case CLEAR:
        case REFRESH:
        case ADD:
        case REMOVE:
            Object[] path = { getRoot() };
            for (TreeModelListener listener : treeModelListeners) {
                TreeModelEvent ev = new TreeModelEvent(this, path);
                listener.treeStructureChanged(ev);
            }//from   w ww.ja va 2 s  . c  o  m
            break;

        case UPDATE:
            for (Object item : e.getItems()) {
                TreePath treePath = getTreePath(item);
                for (TreeModelListener listener : treeModelListeners) {
                    TreeModelEvent ev = new TreeModelEvent(this, treePath.getPath());
                    listener.treeNodesChanged(ev);
                }
            }
            break;
        }
    };
    //noinspection unchecked
    datasource.addCollectionChangeListener(
            new WeakCollectionChangeListener(datasource, collectionChangeListener));
}

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

private void fireNodeReplaced(ModelType type, MCMCPresentation oldPresentation,
        MCMCPresentation newPresentation) {
    int idx = getIndexOfChild(type, newPresentation);
    TreeModelEvent event = createTreeEvent(type, newPresentation, idx);
    for (TreeModelListener l : new ArrayList<TreeModelListener>(d_listeners)) {
        l.treeNodesChanged(event);
    }//  www  . j a  v  a  2  s.co  m
}