本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
}