Changeset 4465


Ignore:
Timestamp:
2003-06-03T16:25:09+12:00 (21 years ago)
Author:
jmt12
Message:

2030093: Now a custom classifier is called on its own thread, so the AWT EventDispatchThread is free to update the display and more importantly add new GValueNodes to the tree (what caused the NPE). Furthermore it now checks if the custom classifier is currently adjusting its value before asking it to process a new metadata changed event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java

    r4366 r4465  
    319319        if(object instanceof CustomClassifier) {
    320320            CustomClassifier classifier = (CustomClassifier) object;
    321             classifier.process(record);
     321            if(!classifier.valueIsAdjusting()) {
     322            classifier.process(record);
     323            }
    322324        }
    323325        }
     
    874876        // Custom classifier
    875877        else {
    876             if(custom_classifier.display(true)) {
    877             assignClassifier(custom_classifier);
    878             }
    879             custom_classifier.destroy(); // Remove gui prompt or else.
    880             custom_classifier = null;
     878            // Spawn a new thread to handle this, as custom_classifiers can be processor heavy.
     879            CustomClassifierTask task = new CustomClassifierTask(custom_classifier);
     880            task.start();
    881881        }
    882882        }
     
    944944        }
    945945    }
     946
     947    private class CustomClassifierTask
     948        extends Thread {
     949
     950        private CustomClassifier custom_classifier;
     951
     952        CustomClassifierTask(CustomClassifier custom_classifier) {
     953        this.custom_classifier = custom_classifier;
     954        }
     955
     956        public void run() {
     957        if(custom_classifier.display(true)) {
     958            assignClassifier(custom_classifier);
     959        }
     960        custom_classifier.destroy(); // Remove gui prompt or else.
     961        custom_classifier = null;
     962        }
     963    }
     964
    946965    /** This class listens for actions upon the remove button in the controls, and if detected calls the removeClassifier() method.
    947966            */
Note: See TracChangeset for help on using the changeset viewer.