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

The following examples show how to use javax.swing.event.TreeModelListener#treeNodesRemoved() . 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: 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 2
Source File: AbstractReportDataTreeModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void fireExpressionRemoved( final Expression parameter ) {
  final TreePath pathForNode = new TreePath( new Object[] { getRoot(), getReportFunctionNode() } );
  final TreeModelListener[] treeModelListeners = getListeners();
  final int index = findExpressionInCache( 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.treeNodesRemoved( treeEvent );
  }

  refreshExpressionsCache();
}
 
Example 3
Source File: MasterReportDataTreeModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void fireParameterRemoved( final ParameterDefinitionEntry parameter ) {
  final TreePath pathForNode = new TreePath( new Object[] { getRoot(), getReportParametersNode() } );
  final TreeModelListener[] treeModelListeners = getListeners();
  final int index = findParameterInCache( 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.treeNodesRemoved( treeEvent );
  }

  refreshParameterCache();
}
 
Example 4
Source File: GTreeModel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public void fireNodeRemoved(GTreeNode parentNode, GTreeNode removedNode, int index) {

		SystemUtilities.assertThisIsTheSwingThread(
			"GTreeModel.fireNodeRemoved() must be " + "called from the AWT thread");

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

		// if filtered, remove filtered node
		if (parent != parentNode) {
			index = removeFromFiltered(parent, removedNode);
			return;  // the above call will generate the event for the filtered node
		}

		if (index < 0) {  // will be -1 if filtered out
			return;
		}

		TreeModelEvent event = new TreeModelEvent(this, parent.getTreePath(), new int[] { index },
			new Object[] { removedNode });

		for (TreeModelListener listener : listeners) {
			listener.treeNodesRemoved(event);
		}
	}
 
Example 5
Source File: ProcessTreeModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
private void fireTreeNodesRemoved(Operator operator, int oldIndex) {
	TreePath path = getPathTo(operator).getParentPath();
	TreeModelEvent e = new TreeModelEvent(this, path, new int[] { oldIndex }, new Object[] { operator });
	for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) {
		try {
			l.treeNodesRemoved(e);
		} catch (Exception ex) {
			//ignore
		}
	}
}
 
Example 6
Source File: NodeProjectGroup.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
public boolean deleteNode(@Nonnull final NodeFileOrFolder node, final boolean notifyListeners) {
  final NodeFileOrFolder parentNode = node.getNodeParent();
  if (parentNode != null) {
    final TreeModelEvent event = new TreeModelEvent(this, parentNode.makeTreePath(), new int[]{node.getIndexAtParent()}, new Object[]{node});
    if (parentNode.deleteChild(node)) {
      if (notifyListeners) {
        for (final TreeModelListener l : this.listeners) {
          l.treeNodesRemoved(event);
        }
      }
      return true;
    }
  }
  return false;
}
 
Example 7
Source File: WidgetTreeModel.java    From DroidUIBuilder with Apache License 2.0 5 votes vote down vote up
protected void fireNodeRemovedEvent(TreeModelEvent event)
{
	for (TreeModelListener listener : listeners)
	{
		listener.treeNodesRemoved(event);
	}
}
 
Example 8
Source File: ProjectTreeModel.java    From quickfix-messenger with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void fireTreeNodesRemoved(Object source, Object[] path,
		int[] childIndices, Object[] children)
{
	TreeModelEvent event = new TreeModelEvent(source, path, childIndices,
			children);
	for (TreeModelListener listener : getTreeModelListeners())
	{
		listener.treeNodesRemoved(event);
	}
}
 
Example 9
Source File: LayerTreeModel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
protected void fireTreeNodesRemoved(Layer parentLayer) {
    TreeModelEvent event = createTreeModelEvent(parentLayer);
    if (event == null) {
        return;
    }
    for (TreeModelListener treeModelListener : treeModelListeners.keySet()) {
        treeModelListener.treeNodesRemoved(event);
    }
}
 
Example 10
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 removed.
 *
 * @param event the event object specifying removed nodes
 */
@Override
public void treeNodesRemoved(@Nonnull TreeModelEvent event) {
  for (TreeModelListener listener : myListeners) {
    listener.treeNodesRemoved(event);
  }
}
 
Example 11
Source File: EditableResources.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public void fireTreeNodeRemoved(final String nodeName, final byte type, int index) {
    TreeModelEvent ev = createEventForNode(nodeName, type, index);
    for(TreeModelListener l : listeners) {
        l.treeNodesRemoved(ev);
    }
}
 
Example 12
Source File: TagTreeModel.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
private void fireTreeNodesRemoved(TreeModelEvent e) {
    for (TreeModelListener listener : listeners) {
        listener.treeNodesRemoved(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 fireTreeNodesRemoved(TreeModelEvent treeModelEvent) {
    for (TreeModelListener listener : listeners) {
        listener.treeNodesRemoved(treeModelEvent);
    }
}
 
Example 14
Source File: CustomTopicPanelConfiguration.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
public void fireNodesRemoved(TreeModelEvent e){
    for(TreeModelListener l : listeners) l.treeNodesRemoved(e);
}