- Timestamp:
- 2004-10-08T09:46:12+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java
r6622 r8236 31 31 import javax.swing.SwingUtilities; 32 32 import javax.swing.tree.*; 33 import org.greenstone.gatherer.Gatherer; 33 import org.greenstone.gatherer.DebugStream; 34 34 35 /** Due to the TreeModel objects not having any synchronization, certain assumptions, such as the model state remaining constant during a repaint, don't always hold - especially given that I'm changing the tree model on a different thread. In order to get around this I will use the latest swing paradigm wherein you flag a section of code to be executed by the AWT GUI Event queue, as soon as other gui tasks have finished. This way I shouldn't have tree redraws throwing NPEs because the array size of the children of a certain node has changed -while- the repaint call was made, i.e. repaint() calls getChildCount() = 13, removeNodeFromParent() called, repaint calls getChildAt(12) = ArrayIndexOutOfBoundsException. 35 36 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 46 47 public void run() { 47 48 ///ystem.err.print("Running task... "); 48 Gatherer.println("insertNodeInto(" + model + ", " + parent + ", " + target_node + ", " + wait_allowed);49 DebugStream.println("insertNodeInto(" + model + ", " + parent + ", " + target_node + ", " + wait_allowed); 49 50 int index = -1; 50 51 int pos = 0; … … 89 90 } 90 91 catch (Exception exception) { 91 Gatherer.printStackTrace(exception);92 DebugStream.printStackTrace(exception); 92 93 } 93 94 ///ystem.err.print("Added Task... "); … … 110 111 } 111 112 catch (Exception exception) { 112 Gatherer.printStackTrace(exception);113 DebugStream.printStackTrace(exception); 113 114 ///ystem.err.println(e); 114 115 } … … 142 143 } 143 144 catch (Exception exception) { 144 Gatherer.printStackTrace(exception);145 DebugStream.printStackTrace(exception); 145 146 } 146 147 }
Note:
See TracChangeset
for help on using the changeset viewer.