Example usage for javax.swing.event TreeModelEvent TreeModelEvent

List of usage examples for javax.swing.event TreeModelEvent TreeModelEvent

Introduction

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

Prototype

public TreeModelEvent(Object source, TreePath path) 

Source Link

Document

Used to create an event when the node structure has changed in some way, identifying the path to the root of the modified subtree as a TreePath object.

Usage

From source file:de.codesourcery.eve.skills.ui.model.FilteringTreeModel.java

public void viewFilterChanged() {
    System.out.println(">> View filter changed <<");

    delegate.modelChanged();//  w  ww .j  ava 2 s .c om
    fireEvent(EventType.STRUCTURE_CHANGED, new TreeModelEvent(this, ((ITreeNode) getRoot()).getPathToRoot()));
}

From source file:GenealogyExample.java

/**
 * The only event raised by this model is TreeStructureChanged with the root
 * as path, i.e. the whole tree has changed.
 *///from   ww  w. j  av a 2  s .  co m
protected void fireTreeStructureChanged(Person oldRoot) {
    int len = treeModelListeners.size();
    TreeModelEvent e = new TreeModelEvent(this, new Object[] { oldRoot });
    for (TreeModelListener tml : treeModelListeners) {
        tml.treeStructureChanged(e);
    }
}

From source file:com.projity.pm.graphic.model.cache.ViewNodeModelCache.java

protected void fireTreeModelUpdate(Object source) {
    Object[] listeners = treeModelListenerList.getListenerList();
    TreeModelEvent e = null;//from   w  w  w  . j av  a 2 s.com
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == TreeModelListener.class) {
            if (e == null) {
                e = new TreeModelEvent(source, new Object[] { getRoot() });
            }
            ((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
        }
    }
}

From source file:nl.salp.warcraft4j.dev.ui.CascFileTreeModel.java

public void update(CascService cascService) {
    this.root = new CascFileTreeNode("/");
    cascService.getAllCascFiles().forEach(this::add);
    modelListeners.forEach(l -> l.treeStructureChanged(new TreeModelEvent(this, new TreePath(root))));
}

From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.model.RepositoryTreeModel.java

public void fireTreeDataChanged() {
    final TreeModelEvent event = new TreeModelEvent(this, new TreePath(root));
    final TreeModelListener[] modelListeners = listenerList.getListeners(TreeModelListener.class);
    for (int i = 0; i < modelListeners.length; i++) {
        final TreeModelListener modelListener = modelListeners[i];
        modelListener.treeStructureChanged(event);
    }/*from ww w. j  av a2 s. c o  m*/
}

From source file:org.photovault.swingui.PhotoFolderTreeModel.java

/**
   This method is called when some of the tree nodes has changed. Currently it constructs TreePath to
   the changed object and sends a strucure changed event to listeners of the model.
        /*ww w . ja v a2s  . com*/
 */
public void photoCollectionChanged(PhotoCollectionChangeEvent e) {
    PhotoFolder changedFolder = (PhotoFolder) e.getSource();
    if (e instanceof PhotoFolderEvent) {
        changedFolder = ((PhotoFolderEvent) e).getSubfolder();
    }
    Object[] path = findFolderPath(changedFolder);

    // Construct the correct event
    TreeModelEvent treeEvent = new TreeModelEvent(changedFolder, path);
    log.debug("collectionChanged " + path.length);
    fireTreeModelEvent(treeEvent);
}

From source file:org.photovault.swingui.PhotoFolderTreeModel.java

public void subfolderChanged(PhotoFolderEvent e) {
    PhotoFolder changedFolder = (PhotoFolder) e.getSource();
    if (e instanceof PhotoFolderEvent) {
        changedFolder = ((PhotoFolderEvent) e).getSubfolder();
    }/*ww w  .j av a 2s.  co  m*/
    Object[] path = findFolderPath(changedFolder);

    // Construct the correct event
    TreeModelEvent treeEvent = new TreeModelEvent(changedFolder, path);
    log.debug("subfolderChanged " + path.length);
    fireTreeModelEvent(treeEvent);

}

From source file:org.photovault.swingui.PhotoFolderTreeModel.java

public void structureChanged(PhotoFolderEvent e) {
    PhotoFolder changedFolder = (PhotoFolder) e.getSource();
    if (e instanceof PhotoFolderEvent) {
        changedFolder = ((PhotoFolderEvent) e).getSubfolder();
    }//from  w  w w. j  a  v a2 s  .  c o  m
    Object[] path = findFolderPath(changedFolder);

    // Construct the correct event
    TreeModelEvent treeEvent = new TreeModelEvent(changedFolder, path);
    log.debug("structureChanged " + path.length);
    fireTreeModelEvent(treeEvent);
}