Java Code Examples for javax.swing.event.TreeModelListener#treeNodesInserted()

The following examples show how to use javax.swing.event.TreeModelListener#treeNodesInserted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTreeModel.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public void fireNodeAdded(final GTreeNode parentNode, final GTreeNode newNode) {
	if (!eventsEnabled) {
		return;
	}
	SystemUtilities.assertThisIsTheSwingThread(
		"GTreeModel.fireNodeAdded() must be " + "called from the AWT thread");

	GTreeNode parent = convertToViewNode(parentNode);
	if (parent == null) {  // it will be null if filtered out
		return;
	}

	int index = parent.getIndexOfChild(newNode);
	if (index < 0) {
		// the index will be -1 if filtered out
		return;
	}
	TreeModelEvent event = new TreeModelEvent(this, parent.getTreePath(), new int[] { index },
		new Object[] { newNode });
	for (TreeModelListener listener : listeners) {
		listener.treeNodesInserted(event);
	}
}
 
Example 2
Source File: CustomTreeModel.java    From Pixie with MIT License 6 votes vote down vote up
/**
 * Generate events specific to the user actions and trigger the internal
 * management of the tree.
 *
 * @param parent the parent node of the changed nodes (rename, add, remove)
 * @param indices the indexes of the changed nodes
 * @param nodes the affected nodes; the nodes which are changed
 * @param action the action related to the node: rename, add, remove
 */
public void fireTreeStructureChanged(CustomTreeNode parent, int[] indices, Object[] nodes, TreeActions action) {
    TreeModelEvent eventInsRem = new TreeModelEvent(this, parent.getPath(), indices, nodes);
    TreeModelEvent eventStructChange = new TreeModelEvent(this, new Object[]{parent});

    for (TreeModelListener lis : treeModelListeners) {
        switch (action) {
            case NODE_RENAMED:
                lis.treeNodesChanged(eventInsRem);
                break;

            case NODE_INSERTED:
                lis.treeNodesInserted(eventInsRem);
                break;

            case NODE_REMOVED:
                lis.treeNodesRemoved(eventInsRem);
                break;

            case TREE_STRUCTURE_CHANGED:
                lis.treeStructureChanged(eventStructChange);
                break;

        }
    }
}
 
Example 3
Source File: NodeProjectGroup.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Nonnull
public NodeProject addProjectFolder(@Nonnull final File folder) throws IOException {
  NodeProject newProject = findForFolder(folder);
  if (newProject == null) {
    newProject = new NodeProject(this, folder);

    final int index = this.children.size();
    this.children.add(newProject);

    final TreeModelEvent event = new TreeModelEvent(this, new Object[]{this}, new int[]{index}, new Object[]{newProject});
    for (final TreeModelListener l : this.listeners) {
      l.treeNodesInserted(event);
    }
  }
  return newProject;
}
 
Example 4
Source File: AbstractReportDataTreeModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void fireExpressionAdded( final Expression parameter ) {
  final TreePath pathForNode = new TreePath( new Object[] { getRoot(), getReportFunctionNode() } );
  final TreeModelListener[] treeModelListeners = getListeners();
  final int index = getIndexOfChild( getReportFunctionNode(), parameter );
  if ( index == -1 ) {
    return;
  }

  final TreeModelEvent treeEvent = new TreeModelEvent( this, pathForNode,
    new int[] { index }, new Object[] { parameter } );
  for ( int i = treeModelListeners.length - 1; i >= 0; i -= 1 ) {
    final TreeModelListener listener = treeModelListeners[ i ];
    listener.treeNodesInserted( treeEvent );
  }

  refreshExpressionsCache();
}
 
Example 5
Source File: MasterReportDataTreeModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void fireParameterAdded( final ParameterDefinitionEntry parameter ) {
  final TreePath pathForNode = new TreePath( new Object[] { getRoot(), getReportParametersNode() } );
  final TreeModelListener[] treeModelListeners = getListeners();
  final int index = getIndexOfChild( getReportParametersNode(), parameter );
  if ( index == -1 ) {
    return;
  }

  final TreeModelEvent treeEvent = new TreeModelEvent( this, pathForNode,
    new int[] { index }, new Object[] { parameter } );
  for ( int i = treeModelListeners.length - 1; i >= 0; i -= 1 ) {
    final TreeModelListener listener = treeModelListeners[ i ];
    listener.treeNodesInserted( treeEvent );
  }
  refreshParameterCache();
}
 
Example 6
Source File: ProcessTreeModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
private void fireTreeNodesInserted(Operator operator) {
	TreeModelEvent e = makeChangeEvent(operator);
	for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) {
		try {
			l.treeNodesInserted(e);
		} catch (Exception ex) {
			//ignore
		}
	}
}
 
Example 7
Source File: NodeProjectGroup.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
@Nonnull
public NodeFileOrFolder addChild(@Nonnull final NodeFileOrFolder folder, final boolean showHiddenFiles, @Nonnull final File childFile) throws IOException {
  final NodeFileOrFolder newNode = folder.addFile(childFile, showHiddenFiles);
  final TreeModelEvent event = new TreeModelEvent(this, folder.makeTreePath(), new int[]{newNode.getIndexAtParent()}, new Object[]{newNode});
  for (final TreeModelListener l : this.listeners) {
    l.treeNodesInserted(event);
  }
  return newNode;
}
 
Example 8
Source File: WidgetTreeModel.java    From DroidUIBuilder with Apache License 2.0 5 votes vote down vote up
protected void fireNodeInsertedEvent(TreeModelEvent event)
{
	for (TreeModelListener listener : listeners)
	{
		listener.treeNodesInserted(event);
	}
}
 
Example 9
Source File: ProjectTreeModel.java    From quickfix-messenger with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void fireTreeNodesInserted(Object source, Object[] path,
		int[] childIndices, Object[] children)
{
	TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
			children);
	for (TreeModelListener listener : getTreeModelListeners())
	{
		listener.treeNodesInserted(event);
	}
}
 
Example 10
Source File: LayerTreeModel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
protected void fireTreeNodesInserted(Layer parentLayer) {
    TreeModelEvent event = createTreeModelEvent(parentLayer);
    if (event == null) {
        return;
    }
    for (TreeModelListener treeModelListener : treeModelListeners.keySet()) {
        treeModelListener.treeNodesInserted(event);
    }
}
 
Example 11
Source File: TreeModelListenerList.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies all added listeners that some nodes were inserted.
 *
 * @param event the event object specifying inserted nodes
 */
@Override
public void treeNodesInserted(@Nonnull TreeModelEvent event) {
  for (TreeModelListener listener : myListeners) {
    listener.treeNodesInserted(event);
  }
}
 
Example 12
Source File: TagTreeModel.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
private void fireTreeNodesInserted(TreeModelEvent e) {
    for (TreeModelListener listener : listeners) {
        listener.treeNodesInserted(e);
    }
}
 
Example 13
Source File: FilterTreeModel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private void fireTreeNodesInserted(TreeModelEvent treeModelEvent) {
    for (TreeModelListener listener : listeners) {
        listener.treeNodesInserted(treeModelEvent);
    }
}
 
Example 14
Source File: CustomTopicPanelConfiguration.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
public void fireNodesInserted(TreeModelEvent e){
    for(TreeModelListener l : listeners) l.treeNodesInserted(e);
}