当前位置: 首页>>代码示例>>Java>>正文


Java TreeModelListener类代码示例

本文整理汇总了Java中javax.swing.event.TreeModelListener的典型用法代码示例。如果您正苦于以下问题:Java TreeModelListener类的具体用法?Java TreeModelListener怎么用?Java TreeModelListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeModelListener类属于javax.swing.event包,在下文中一共展示了TreeModelListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireTreeStructureChanged

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
/**
 * 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;

        }
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:35,代码来源:CustomTreeModel.java

示例2: filter

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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()}));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:OptionsFilter.java

示例3: fireTreeNode

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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;
            }

        }
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:27,代码来源:MyAbstractTreeTableModel.java

示例4: fire

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LanguagesNavigatorModel.java

示例5: fireRemove

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:LanguagesNavigatorModel.java

示例6: fireInsert

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:LanguagesNavigatorModel.java

示例7: nodesWereInsertedInternal

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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;
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:NodeTreeModel.java

示例8: removeTreeModelListener

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
@Override
public synchronized void removeTreeModelListener(TreeModelListener l) {
    listeners.remove(l);
    if (delegatingTreeModelListener) {
        delegate.removeTreeModelListener(l);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:OptionsFilter.java

示例9: entryAdded

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
@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);
			}
		}
	});
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:RepositoryTreeModel.java

示例10: folderRefreshed

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
@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);
			}
		});
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:RepositoryTreeModel.java

示例11: refresh

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
				}
			}
		});
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:RepositoryTreeModel.java

示例12: fireTreeNodesChanged

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:ProcessTreeModel.java

示例13: fireTreeNodesRemoved

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ProcessTreeModel.java

示例14: fireTreeStructureChanged

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ProcessTreeModel.java

示例15: fireTreeStructureChanged

import javax.swing.event.TreeModelListener; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:GenealogyModel.java


注:本文中的javax.swing.event.TreeModelListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。