當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。