Changeset 6212


Ignore:
Timestamp:
2003-12-10T17:03:57+13:00 (20 years ago)
Author:
jmt12
Message:

Exceptions are now being sent to debug rather than screen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java

    r6096 r6212  
    3131import javax.swing.SwingUtilities;
    3232import javax.swing.tree.*;
     33import org.greenstone.gatherer.Gatherer;
    3334/** 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.
    3435 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    8687        }
    8788    }
    88     catch (Exception e) {
    89         e.printStackTrace();
     89    catch (Exception exception) {
     90        Gatherer.printStackTrace(exception);
    9091    }
    9192    ///ystem.err.print("Added Task... ");
     
    104105        };
    105106    try {
    106                 //SwingUtilities.invokeLater(doRemoveNodeFromParent);
     107        //SwingUtilities.invokeLater(doRemoveNodeFromParent);
    107108        SwingUtilities.invokeAndWait(doRemoveNodeFromParent);
    108109    }
    109     catch (Exception e) {
    110         e.printStackTrace();
    111                 ///ystem.err.println(e);
     110    catch (Exception exception) {
     111        Gatherer.printStackTrace(exception);
     112        ///ystem.err.println(e);
    112113    }
    113114    // If we've thrown an error because we tried to invoke the runnable task and wait, when we are in the AWTEvent thread already, then try agin but with an invoke later.
     
    136137        };
    137138    try {
    138                 //SwingUtilities.invokeLater(doReplaceNode);
     139        //SwingUtilities.invokeLater(doReplaceNode);
    139140        SwingUtilities.invokeAndWait(doReplaceNode);
    140141    }
    141     catch (Exception e) {
    142         e.printStackTrace();
     142    catch (Exception exception) {
     143        Gatherer.printStackTrace(exception);
    143144    }
    144145    }
Note: See TracChangeset for help on using the changeset viewer.