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


Java TreeWillExpandListener类代码示例

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


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

示例1: addListener

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
private <T extends EventListener> void addListener(Class<T> cls, T l) {
    if (l == null)
        return;
    int count = listenerList.getListenerCount(cls);
    listenerList.add(cls, l);
    if (count == 0) {
        if (cls == TreeExpansionListener.class) {
            tree.addTreeExpansionListener(adapter);
        } else if (cls == TreeWillExpandListener.class) {
            tree.addTreeWillExpandListener(adapter);
        } else if (cls == TreeTableMouseListener.class) {
            hasTreeTableMouseListener = true;
        } else if (cls == TreeTableMouseMotionListener.class) {
            hasTreeTableMouseMotionListener = true;
        }
    }
}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:18,代码来源:TreeTable.java

示例2: removeListener

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
private <T extends EventListener> void removeListener(Class<T> cls, T l) {
    if (l == null)
        return;
    listenerList.remove(cls, l);
    int count = listenerList.getListenerCount(cls);
    if (count == 0) {
        if (cls == TreeExpansionListener.class) {
            tree.removeTreeExpansionListener(adapter);
        } else if (cls == TreeWillExpandListener.class) {
            tree.removeTreeWillExpandListener(adapter);
        } else if (cls == TreeTableMouseListener.class) {
            hasTreeTableMouseListener = false;
        } else if (cls == TreeTableMouseMotionListener.class) {
            hasTreeTableMouseMotionListener = false;
        }
    }
}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:18,代码来源:TreeTable.java

示例3: fireTreeWillExpand

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
private void fireTreeWillExpand (TreeExpansionEvent e, boolean expanded) throws ExpandVetoException {
    int size = weListeners.size();
    
    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (expanded) {
            listeners[i].treeWillExpand(e);
        } else {
            listeners[i].treeWillCollapse(e);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:TreePathSupport.java

示例4: fireTreeExpansionVetoed

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
private void fireTreeExpansionVetoed (TreeExpansionEvent e, ExpandVetoException ex) {
    int size = weListeners.size();
    
    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (listeners[i] instanceof ExtTreeWillExpandListener) {
            ((ExtTreeWillExpandListener) listeners[i]).treeExpansionVetoed(e,
                ex);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:TreePathSupport.java

示例5: addTreeWillExpandListener

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Maps {@code JTree.addTreeWillExpandListener(TreeWillExpandListener)}
 * through queue
 */
public void addTreeWillExpandListener(final TreeWillExpandListener treeWillExpandListener) {
    runMapping(new MapVoidAction("addTreeWillExpandListener") {
        @Override
        public void map() {
            ((JTree) getSource()).addTreeWillExpandListener(treeWillExpandListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JTreeOperator.java

示例6: removeTreeWillExpandListener

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Maps
 * {@code JTree.removeTreeWillExpandListener(TreeWillExpandListener)}
 * through queue
 */
public void removeTreeWillExpandListener(final TreeWillExpandListener treeWillExpandListener) {
    runMapping(new MapVoidAction("removeTreeWillExpandListener") {
        @Override
        public void map() {
            ((JTree) getSource()).removeTreeWillExpandListener(treeWillExpandListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:JTreeOperator.java

示例7: fireTreeWillCollapse

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Notifies all listeners that the tree will collapse.
 *
 * @param path the path to the node that will collapse
 */
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillCollapse(event);
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:JTree.java

示例8: fireTreeWillExpand

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Notifies all listeners that the tree will expand.
 *
 * @param path the path to the node that will expand
 */
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillExpand(event);
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:JTree.java

示例9: actionPerformed

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    TreePath rootPath = new TreePath(model.getRoot());
    DummyNode dummyTree = new DummyNode(rootPath.getPathComponent(0).toString(),
            tree.isExpanded(rootPath));
    buildDummyTree(dummyTree, rootPath);
    // cannot determine listener in constructor because it's not initialized yet
    TreeListener listener = (TreeListener) tree.getListeners(TreeWillExpandListener.class)[0];
    listener.setShowErrorMessages(false);
    expandTree(dummyTree, rootPath);
    listener.setShowErrorMessages(true);
}
 
开发者ID:axxepta,项目名称:project-argon,代码行数:13,代码来源:RefreshTreeAction.java

示例10: fireTreeWillCollapse

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Notifies all listeners that the tree will collapse.
 * 
 * @param path the path to the node that will collapse
 */
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillCollapse(event);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:14,代码来源:JTree.java

示例11: fireTreeWillExpand

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
/**
 * Notifies all listeners that the tree will expand.
 * 
 * @param path the path to the node that will expand
 */
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillExpand(event);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:14,代码来源:JTree.java

示例12: fireTreeWillExpand

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException {
    TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
    if (listeners.length == 0) {
        return;
    }
    TreeExpansionEvent event = new TreeExpansionEvent(this, path);
    for (TreeWillExpandListener element : listeners) {
        element.treeWillExpand(event);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:JTree.java

示例13: fireTreeWillCollapse

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException {
    TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
    if (listeners.length == 0) {
        return;
    }
    TreeExpansionEvent event = new TreeExpansionEvent(this, path);
    for (TreeWillExpandListener element : listeners) {
        element.treeWillCollapse(event);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:JTree.java

示例14: setUI

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
public void setUI(TreeTableUI ui) {
        boolean addExpandLis = false;
        boolean addWillExpandLis = false;
        if (table != null) {
            table.removePropertyChangeListener(adapter);
            tree.removePropertyChangeListener(adapter);
            int lisCount = listenerList.getListenerCount(TreeExpansionListener.class);
            if (lisCount > 0) {
                tree.removeTreeExpansionListener(adapter);
                addExpandLis = true;
            }
            lisCount = listenerList.getListenerCount(TreeWillExpandListener.class);
            if (lisCount > 0) {
                tree.removeTreeWillExpandListener(adapter);
                addWillExpandLis = true;
            }
            getSelectionModel().removeTreeSelectionListener(adapter);
            if (getAutoCreateColumnsFromModel())
                columnModel = null;
            updateUIProperties();
        }
        super.setUI(ui);
        tree = getUI().getTreeInterface(this);
        table = getUI().getTableInterface(this);
//		if (columnModel == null) {
//			columnModel = table.getColumnModel();
//			int hc = getTreeColumnModel().getHierarchicalColumn();
//			if (hc >= 0)
//				columnModel.getColumn(hc).setPreferredWidth(150);
//		}
        getSelectionModel().addTreeSelectionListener(adapter);
        table.addPropertyChangeListener(adapter);
        tree.addPropertyChangeListener(adapter);
        if (addExpandLis)
            tree.addTreeExpansionListener(adapter);
        if (addWillExpandLis)
            tree.addTreeWillExpandListener(adapter);
        if (getAutoCreateColumnHeader() && isDisplayable())
            configureEnclosingScrollPane();
    }
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:41,代码来源:TreeTable.java

示例15: fireTreeWillExpandEvent

import javax.swing.event.TreeWillExpandListener; //导入依赖的package包/类
private void fireTreeWillExpandEvent(TreePath path, boolean exp) throws ExpandVetoException {
    TreeExpansionEvent e = new TreeExpansionEvent(this, path);
    Object[] listeners = listenerList.getListenerList();
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==TreeWillExpandListener.class) {
            TreeWillExpandListener lis = (TreeWillExpandListener)listeners[i+1];
            if (exp) {
                lis.treeWillExpand(e);
            } else {
                lis.treeWillCollapse(e);
            }
        }
    }
}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:15,代码来源:TreeTable.java


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