本文整理匯總了Java中javax.swing.tree.ExpandVetoException類的典型用法代碼示例。如果您正苦於以下問題:Java ExpandVetoException類的具體用法?Java ExpandVetoException怎麽用?Java ExpandVetoException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ExpandVetoException類屬於javax.swing.tree包,在下文中一共展示了ExpandVetoException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: treeExpansionVetoed
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/** Messaged if the tree expansion event (for which we will have already
* constructed a TableModelEvent) was vetoed; disposes of the constructed
* TableModelEvent in that circumstance. */
@Override
public void treeExpansionVetoed(TreeExpansionEvent event, ExpandVetoException exception) {
assert SwingUtilities.isEventDispatchThread();
log ("treeExpansionVetoed", exception);
//Make sure the event that was vetoed is the one we're interested in
if (event == inProgressEvent) {
//If so, delete the expansion event we thought we were going
//to use in treeExpanded/treeCollapsed, so that it doesn't
//stick around forever holding references to objects from the
//model
pendingExpansionEvent = null;
inProgressEvent = null;
}
}
示例2: expandPath
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
public void expandPath(TreePath path)
{
// Don't expand if path is null
// or is already expanded.
if (path == null || isExpanded(path))
return;
try
{
fireTreeWillExpand(path);
}
catch (ExpandVetoException ev)
{
// We do nothing if attempt has been vetoed.
}
setExpandedState(path, true);
fireTreeExpanded(path);
}
示例3: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
final InspectionTreeNode node = (InspectionTreeNode)event.getPath().getLastPathComponent();
final Object userObject = node.getUserObject();
//TODO: never re-sort
if (node.isValid() && !myExpandedUserObjects.contains(userObject)) {
sortChildren(node);
nodeStructureChanged(node);
}
myExpandedUserObjects.add(userObject);
// Smart expand
if (node.getChildCount() == 1) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
expandPath(new TreePath(node.getPath()));
}
});
}
}
示例4: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/**
* @see javax.swing.event.TreeWillExpandListener#treeWillExpand(javax.swing.event.TreeExpansionEvent)
*/
public void treeWillExpand(TreeExpansionEvent e) throws ExpandVetoException {
logger.debug("Tree will expand " + e.getPath());
/*
* DefaultMutableTreeNode node = (DefaultMutableTreeNode)
* tree.getLastSelectedPathComponent(); if (node == null) { return; }
* logger.debug(""+node.getPath()[node.getLevel()]); // buttons
* disabling switch(node.getLevel()) { case LEVEL_FOLDERS: // disconnect
* childrens from the node Enumeration enumeration=node.children(); //
* delete nodes itself while (enumeration.hasMoreElements()) { Object
* object=enumeration.nextElement();
* treeNodeToResourceUriMap.remove(object);
* treeModel.removeNodeFromParent((MutableTreeNode)object); } // get
* folder URI logger.debug("Expanding folder:
* "+treeNodeToResourceUriMap.get(node)); FolderResource folder =new
* FolderResource(MindRaider.folderCustodian.get((String)treeNodeToResourceUriMap.get(node)));
* String[] notebookUris=folder.getNotebookUris(); if (notebookUris !=
* null) { for (int i= 0; i < notebookUris.length; i++) {
* NotebookResource notebook=new
* NotebookResource(MindRider.notebookCustodian.get(notebookUris[i]));
* addNotebookNode(node,notebook.resource.metadata.uri.toASCIIString(),notebook.getLabel()); } } }
*/
}
示例5: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
public void treeWillExpand(final TreeExpansionEvent event) throws ExpandVetoException {
final TreePath path = event.getPath();
final DefaultMutableTreeNode lastTreeNode = (DefaultMutableTreeNode) path.getLastPathComponent();
SwingWorker<?, ?> worker = null;
if (lastTreeNode.getChildCount() == 1) {
final DefaultMutableTreeNode firstChildNode = (DefaultMutableTreeNode) lastTreeNode.getChildAt(0);
if (firstChildNode.getUserObject() == LOADING_TABLES_STRING) {
// Load a schema's tables
worker = new LoadTablesSwingWorker(lastTreeNode);
} else if (firstChildNode.getUserObject() == LOADING_COLUMNS_STRING) {
// Load a table's columns
worker = new LoadColumnsSwingWorker(path, lastTreeNode);
}
}
if (worker != null) {
worker.execute();
}
}
示例6: doSetExpandedState
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
private void doSetExpandedState(TreePath path, boolean state) {
if (path == null) {
return;
}
doSetExpandedState(path.getParentPath(), true);
if (isExpanded(path) == state) {
return;
}
try {
if (state) {
fireTreeWillExpand(path);
} else {
fireTreeWillCollapse(path);
}
} catch (ExpandVetoException e) {
return;
}
togglePaths.put(path, Boolean.valueOf(state));
if (state) {
fireTreeExpanded(path);
} else {
fireTreeCollapsed(path);
}
}
示例7: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
@Override
public void treeWillExpand(TreeExpansionEvent event)
throws ExpandVetoException {
// prepare wait cursor and optionally show it
TreePath path = event.getPath();
prepareWaitCursor(DragDropUtilities.secureFindNode(path.getLastPathComponent()));
}
示例8: treeWillCollapse
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/** Receives a TreeWillCollapse event and constructs a TableModelEvent
* based on the pending changes while the model still reflects the unchanged
* state */
@Override
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
assert SwingUtilities.isEventDispatchThread();
log ("treeWillCollapse", event);
//Construct the TableModelEvent here, before data structures have
//changed. We will fire it from TreeCollapsed if the change is
//not vetoed.
pendingExpansionEvent = translateEvent (event, false);
log ("treeWillCollapse generated ", pendingExpansionEvent);
inProgressEvent = event;
}
示例9: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/** Receives a TreeWillExpand event and constructs a TableModelEvent
* based on the pending changes while the model still reflects the unchanged
* state */
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
assert SwingUtilities.isEventDispatchThread();
log ("treeWillExpand", event);
//Construct the TableModelEvent here, before data structures have
//changed. We will fire it from TreeExpanded if the change is not
//vetoed
pendingExpansionEvent = translateEvent (event, true);
log ("treeWillExpand generated", pendingExpansionEvent);
inProgressEvent = event;
}
示例10: fireTreeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的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);
}
}
}
示例11: fireTreeExpansionVetoed
import javax.swing.tree.ExpandVetoException; //導入依賴的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);
}
}
}
示例12: fireTreeWillCollapse
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/**
* Maps {@code JTree.fireTreeWillCollapse(TreePath)} through queue
*/
public void fireTreeWillCollapse(final TreePath treePath) {
runMapping(new MapVoidAction("fireTreeWillCollapse") {
@Override
public void map() throws ExpandVetoException {
((JTree) getSource()).fireTreeWillCollapse(treePath);
}
});
}
示例13: fireTreeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/**
* Maps {@code JTree.fireTreeWillExpand(TreePath)} through queue
*/
public void fireTreeWillExpand(final TreePath treePath) {
runMapping(new MapVoidAction("fireTreeWillExpand") {
@Override
public void map() throws ExpandVetoException {
((JTree) getSource()).fireTreeWillExpand(treePath);
}
});
}
示例14: treeWillExpand
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/**
* Invoked whenever a node in the tree is about to be expanded.
*/
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
if (classificationViewer.isLocked()) {
throw new ExpandVetoException(event);
}
jTree.addChildren((ViewerJTree.MyJTreeNode) event.getPath().getLastPathComponent());
}
示例15: treeWillCollapse
import javax.swing.tree.ExpandVetoException; //導入依賴的package包/類
/**
* Invoked whenever a node in the tree is about to be collapsed.
*/
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
if (inspectorWindow.isLocked()) {
if (dir.getDocument().getProgressListener() != null)
dir.getDocument().getProgressListener().setUserCancelled(true);
throw new ExpandVetoException(event);
}
}