Java 类javax.swing.event.TreeModelListener 实例源码
项目:Pixie
文件:CustomTreeModel.java
/**
* 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;
}
}
}
项目:incubator-netbeans
文件:OptionsFilter.java
void filter() {
final String[] term = new String[1];
filter.render(new Runnable() {
public void run() {
try {
term[0] = filter.getText(0, filter.getLength());
} catch (BadLocationException ex) {
throw new IllegalStateException(ex);
}
}
});
category2Nodes.clear();
filterNodes(delegate.getRoot(), term[0]);
for (TreeModelListener l : getListeners()) {
l.treeStructureChanged(new TreeModelEvent(this, new Object[] {getRoot()}));
}
}
项目:featurea
文件:MyAbstractTreeTableModel.java
private void fireTreeNode(int changeType, Object source, Object[] path, int[] childIndices, Object[] children) {
Object[] listeners = listenerList.getListenerList();
TreeModelEvent e = new TreeModelEvent(source, path, childIndices, children);
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TreeModelListener.class) {
switch (changeType) {
case CHANGED:
((TreeModelListener) listeners[i + 1]).treeNodesChanged(e);
break;
case INSERTED:
((TreeModelListener) listeners[i + 1]).treeNodesInserted(e);
break;
case REMOVED:
((TreeModelListener) listeners[i + 1]).treeNodesRemoved(e);
break;
case STRUCTURE_CHANGED:
((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
break;
default:
break;
}
}
}
}
项目:incubator-netbeans
文件:LanguagesNavigatorModel.java
private void fire () {
TreeModelListener[] listeners = listenerList.getListeners (TreeModelListener.class);
if (listeners.length == 0) return;
TreeModelEvent e = new TreeModelEvent (this, new Object[] {getRoot ()});
for (int i = 0; i < listeners.length; i++)
listeners [i].treeStructureChanged (e);
}
项目:incubator-netbeans
文件:LanguagesNavigatorModel.java
private void fireRemove(ASTNavigatorNode node, int[] indices, ASTNavigatorNode[] children,
LinkedList<ASTNavigatorNode> nodePath) {
TreeModelListener[] listeners = listenerList.getListeners (TreeModelListener.class);
if (listeners.length == 0) return;
TreePath path = new TreePath(nodePath.toArray());
TreeModelEvent e = new TreeModelEvent (this, path, indices, children);
for (int i = 0; i < listeners.length; i++)
listeners [i].treeNodesRemoved (e);
}
项目:incubator-netbeans
文件:LanguagesNavigatorModel.java
private void fireInsert(ASTNavigatorNode node, int[] indices, ASTNavigatorNode[] children,
LinkedList<ASTNavigatorNode> nodePath) {
TreeModelListener[] listeners = listenerList.getListeners (TreeModelListener.class);
if (listeners.length == 0) return;
TreePath path = new TreePath(nodePath.toArray());
TreeModelEvent e = new TreeModelEvent (this, path, indices, children);
for (int i = 0; i < listeners.length; i++)
listeners [i].treeNodesInserted (e);
}
项目:incubator-netbeans
文件:NodeTreeModel.java
void nodesWereInsertedInternal(final VisualizerEvent ev) {
if (listenerList == null) {
return;
}
TreeNode node = ev.getVisualizer();
Object[] path = getPathToRoot(node);
Object[] listeners = listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==TreeModelListener.class) {
// Lazily create the event:
if (e == null) {
e = new TreeModelEventImpl(this, path, ev);
}
try {
((TreeModelListener)listeners[i+1]).treeNodesInserted(e);
} catch (IndexOutOfBoundsException ex) {
LOG.log(Level.WARNING, "Visualizer: {0}", node);
Node n = Visualizer.findNode(node);
LOG.log(Level.WARNING, "Node: {0}", n);
if (n != null) {
LOG.log(Level.WARNING, " # children: {0}", n.getChildren().getNodesCount());
LOG.log(Level.WARNING, " children: {0}", n.getChildren().getClass());
}
LOG.log(Level.WARNING, "Path: {0}", Arrays.toString(path));
LOG.log(Level.WARNING, "ev.getArray: {0}", Arrays.toString(ev.getArray()));
LOG.log(Level.WARNING, "ev.getSnapshot: {0}", ev.getSnapshot());
throw ex;
}
}
}
}
项目:incubator-netbeans
文件:OptionsFilter.java
@Override
public synchronized void removeTreeModelListener(TreeModelListener l) {
listeners.remove(l);
if (delegatingTreeModelListener) {
delegate.removeTreeModelListener(l);
}
}
项目:rapidminer
文件:RepositoryTreeModel.java
@Override
public void entryAdded(final Entry newEntry, Folder parent) {
SwingTools.invokeAndWait(new Runnable() {
@Override
public void run() {
final TreeModelEvent e = makeChangeEvent(newEntry);
for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) {
l.treeNodesInserted(e);
}
}
});
}
项目:rapidminer
文件:RepositoryTreeModel.java
@Override
public void folderRefreshed(final Folder folder) {
final TreeModelEvent e = makeChangeEvent(folder);
final RepositoryTreeUtil treeUtil = new RepositoryTreeUtil();
SwingTools.invokeAndWait(new Runnable() {
@Override
public void run() {
if (parentTree != null) {
treeUtil.saveExpansionState(parentTree);
}
for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) {
l.treeStructureChanged(e);
}
treeUtil.locateExpandedEntries();
}
});
if (parentTree != null) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
treeUtil.restoreExpansionState(parentTree);
}
});
}
}
项目:rapidminer
文件:RepositoryTreeModel.java
private void refresh() {
for (Repository repo : root.getRepositories()) {
final TreeModelEvent e = makeChangeEvent(repo);
SwingTools.invokeAndWait(new Runnable() {
@Override
public void run() {
for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) {
l.treeStructureChanged(e);
}
}
});
}
}
项目:rapidminer
文件:ProcessTreeModel.java
private void fireTreeNodesChanged(Operator operator) {
TreeModelEvent e = makeChangeEvent(operator);
if (e.getChildIndices() != null && e.getChildIndices()[0] != -1) { // otherwise the
// operator is in
// the state of
// being removed and
// has
// triggered an
// update while
// dying.
for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) {
l.treeNodesChanged(e);
}
}
}
项目:rapidminer
文件:ProcessTreeModel.java
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)) {
l.treeNodesRemoved(e);
}
}
项目:rapidminer
文件:ProcessTreeModel.java
private void fireTreeStructureChanged(ExecutionUnit unit) {
TreePath path = getPathTo(unit).getParentPath();
TreeModelEvent e = new TreeModelEvent(this, path);
for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) {
l.treeStructureChanged(e);
}
}
项目:marathonv5
文件:GenealogyModel.java
/**
* The only event raised by this model is TreeStructureChanged with the root
* as path, i.e. the whole tree has changed.
*/
protected void fireTreeStructureChanged(Person oldRoot) {
int len = treeModelListeners.size();
TreeModelEvent e = new TreeModelEvent(this, new Object[] { oldRoot });
for (TreeModelListener tml : treeModelListeners) {
tml.treeStructureChanged(e);
}
}
项目:VASSAL-src
文件:Inventory.java
public void fireNodesRemoved(Object[] path, int[] childIndices,
Object[] children) {
TreeModelEvent e = new TreeModelEvent(this, path, childIndices, children);
for (TreeModelListener l : treeModelListeners) {
l.treeNodesRemoved(e);
}
}
项目:truevfs
文件:TFileTreeModel.java
/**
* This method calls {@link TreeModelListener#treeStructureChanged(TreeModelEvent)}
* on all listeners of this {@code TreeModel}.
* May be used to tell the listeners about a change in the file system.
*/
// TODO: Declare this package private.
protected void fireTreeNodesChanged(final TreeModelEvent evt) {
final EventListener[] l = listeners.getListeners(TreeModelListener.class);
for (int i = 0, ll = l.length; i < ll; i++)
((TreeModelListener) l[i]).treeNodesChanged(evt);
}
项目:truevfs
文件:TFileTreeModel.java
/**
* This method calls {@link TreeModelListener#treeStructureChanged(TreeModelEvent)}
* on all listeners of this {@code TreeModel}.
* May be used to tell the listeners about a change in the file system.
*/
// TODO: Declare this package private.
protected void fireTreeNodesInserted(final TreeModelEvent evt) {
final EventListener[] l = listeners.getListeners(TreeModelListener.class);
for (int i = 0, ll = l.length; i < ll; i++)
((TreeModelListener) l[i]).treeNodesInserted(evt);
}
项目:truevfs
文件:TFileTreeModel.java
/**
* This method calls {@link TreeModelListener#treeStructureChanged(TreeModelEvent)}
* on all listeners of this {@code TreeModel}.
* May be used to tell the listeners about a change in the file system.
*/
// TODO: Declare this package private.
protected void fireTreeNodesRemoved(final TreeModelEvent evt) {
final EventListener[] l = listeners.getListeners(TreeModelListener.class);
for (int i = 0, ll = l.length; i < ll; i++)
((TreeModelListener) l[i]).treeNodesRemoved(evt);
}
项目:truevfs
文件:TFileTreeModel.java
/**
* This method calls {@link TreeModelListener#treeStructureChanged(TreeModelEvent)}
* on all listeners of this {@code TreeModel}.
* May be used to tell the listeners about a change in the file system.
*/
// TODO: Declare this package private.
protected void fireTreeStructureChanged(final TreeModelEvent evt) {
final EventListener[] l = listeners.getListeners(TreeModelListener.class);
for (int i = 0, ll = l.length; i < ll; i++)
((TreeModelListener) l[i]).treeStructureChanged(evt);
}
项目:Equella
文件:WizardModel.java
/**
* Notifies all listeners that have registered interest for notification on
* this event type. The event instance is lazily created using the
* parameters passed into the fire method.
*
* @param source the node being changed
* @param path the path to the root node
* @param childIndices the indices of the changed elements
* @param children the changed elements
* @see EventListenerList
*/
private void fireTreeNodesChanged(TreePath path, int[] childIndices, Object[] children)
{
TreeModelListener[] listeners = listenerList.getListeners(TreeModelListener.class);
if( listeners != null && listeners.length > 0 )
{
TreeModelEvent e = new TreeModelEvent(this, path, childIndices, children);
for( TreeModelListener listener : listeners )
{
listener.treeNodesChanged(e);
}
}
}
项目:Logisim
文件:ProjectExplorer.java
private void fireNodesChanged(List<TreeModelEvent> events) {
for (TreeModelEvent e : events) {
for (TreeModelListener l : listeners) {
l.treeNodesChanged(e);
}
}
}
项目:alevin-svn2
文件:DefaultSelectionTreeModel.java
@Override
public void addTreeModelListener(TreeModelListener l) {
}
项目:alevin-svn2
文件:DefaultSelectionTreeModel.java
@Override
public void removeTreeModelListener(TreeModelListener l) {
}
项目:alevin-svn2
文件:MappingTreeModel.java
@Override
public void addTreeModelListener(TreeModelListener arg0) {
}
项目:alevin-svn2
文件:MappingTreeModel.java
@Override
public void removeTreeModelListener(TreeModelListener arg0) {
}
项目:incubator-netbeans
文件:InstallationDetailsDialog.java
public void addTreeModelListener(TreeModelListener listener) {
// do nothing we are read-only
}
项目:incubator-netbeans
文件:InstallationDetailsDialog.java
public void removeTreeModelListener(TreeModelListener listener) {
// do nothing we are read-only
}
项目:incubator-netbeans
文件:ComponentsSelectionPanel.java
public void addTreeModelListener(final TreeModelListener listener) {
synchronized (listeners) {
listeners.add(listener);
}
}
项目:incubator-netbeans
文件:ComponentsSelectionPanel.java
public void removeTreeModelListener(final TreeModelListener listener) {
synchronized (listeners) {
listeners.remove(listener);
}
}
项目:incubator-netbeans
文件:SelectEventsPanel.java
@Override
public void addTreeModelListener(TreeModelListener l) {
}
项目:incubator-netbeans
文件:SelectEventsPanel.java
@Override
public void removeTreeModelListener(TreeModelListener l) {
}
项目:incubator-netbeans
文件:LanguagesNavigatorModel.java
public void addTreeModelListener (TreeModelListener l) {
listenerList.add (TreeModelListener.class, l);
}
项目:incubator-netbeans
文件:LanguagesNavigatorModel.java
public void removeTreeModelListener (TreeModelListener l) {
listenerList.remove (TreeModelListener.class, l);
}
项目:incubator-netbeans
文件:TreeView.java
@Override
protected TreeModelListener createTreeModelListener() {
return new ModelHandler();
}
项目:incubator-netbeans
文件:DefaultOutlineModel.java
@Override
public final synchronized void addTreeModelListener(TreeModelListener l) {
broadcaster.addTreeModelListener (l);
}
项目:Logisim
文件:ProjectExplorer.java
@Override
public void removeTreeModelListener(TreeModelListener l) {
listeners.remove(l);
}
项目:incubator-netbeans
文件:EventBroadcaster.java
/** Add a tree model listener. All events fired by this EventBroadcaster
* will have the OutlineModel as the event source */
public synchronized void addTreeModelListener(TreeModelListener l) {
treeListeners.add (l);
}
项目:Logisim
文件:SimulationTreeModel.java
@Override
public void removeTreeModelListener(TreeModelListener l) {
listeners.remove(l);
}
项目:incubator-netbeans
文件:LookTreeModel.java
public LookTreeModel(Object root, LookSelector sel) {
listeners = new ArrayList<TreeModelListener>();
this.rootObject = root;
this.sel = sel;
}