Ignore:
Timestamp:
2018-12-18T19:23:21+13:00 (5 years ago)
Author:
ak19
Message:
  1. Some dialogs do not exist when GLI starts up and becomes visible. These dialogs only get created when the user launches them, such as the new collection dialog appearing when you choose it through the file menu. When testing, such locally instantiated dialogs need to have setNamesRecursively() called on their GUI components too before setVisible() is called on them. 2. Leaving in instances of what I think are safe calls to SwingUntilities.invokeLater() to fix EDT violation exceptions detected during testing, but not committing those cases where I've made the change that actually need proper fixing by using SwingWorker threads.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r32699 r32712  
    183183    }
    184184    else if (esrc == menu_bar.file_delete) {
    185         new DeleteCollectionTask().start();
     185        //new DeleteCollectionTask().start();
     186        SwingUtilities.invokeLater(new DeleteCollectionTask());
    186187    }
    187188    else if (esrc == menu_bar.file_cdimage) {
     
    193194    else if (esrc == menu_bar.file_exportas) {
    194195        ExportAsPrompt eap = new ExportAsPrompt();
     196        TestingPreparation.setNamesRecursively(eap);
    195197        eap.display();
    196198        eap.destroy();
     
    201203    }
    202204        else if (esrc == menu_bar.file_new) {
    203         new NewCollectionTask().start();
     205        //new NewCollectionTask().start();
     206        SwingUtilities.invokeLater(new NewCollectionTask());
    204207    }
    205208    else if (esrc == menu_bar.file_open) {
     
    985988
    986989    private class NewCollectionTask
    987     extends Thread
     990    implements Runnable //extends Thread
    988991    {
    989992    public void run()
    990993    {
    991994        // Create the collection details prompt from new collection prompt
    992         NewCollectionDetailsPrompt ncd_prompt = new NewCollectionDetailsPrompt();
     995        NewCollectionDetailsPrompt ncd_prompt = new NewCollectionDetailsPrompt();       
     996        //TestingPreparation.setNamesRecursively(ncd_prompt);
     997        // 1. names have to be set in NewCollectionDetailsPrompt, as it makes itself visible
     998        // and for testing we have to have run setName() on its components before the dialog goes visible
     999        // 2. For whatever reason, the NewCollectionDetailsPrompt dialog's own name is set
     1000        // to "col" and it's not possible to change it at any point before or after
     1001        // creating the dialog, and whether from inside or outside the dialog's own class
    9931002
    9941003        // Create the new collection (if not cancelled) in a new thread.
     
    10111020
    10121021    private class DeleteCollectionTask
    1013     extends Thread
     1022    implements Runnable //extends Thread
    10141023    {
    10151024    public void run()
     
    10171026        // The rest is handled by the DeleteCollectionPrompt
    10181027        DeleteCollectionPrompt dc_prompt = new DeleteCollectionPrompt();
     1028        TestingPreparation.setNamesRecursively(dc_prompt);
    10191029        if (dc_prompt.display()) {
    10201030        //closeCurrentCollection();
     
    10791089    public void updateUI()
    10801090    {
    1081     JPanel pane = (JPanel) getContentPane();
    1082     pane.updateUI();
    1083     // Also update all of the tabs according to workflow.
    1084     workflowUpdate("Download", Configuration.get("workflow.download", false));
    1085     workflowUpdate("Gather", Configuration.get("workflow.gather", false));
    1086     workflowUpdate("Enrich", Configuration.get("workflow.enrich", false));
    1087     workflowUpdate("Design", Configuration.get("workflow.design", false));
    1088     workflowUpdate("Create", Configuration.get("workflow.create", false));
    1089     workflowUpdate("Format", Configuration.get("workflow.format", false));
     1091    SwingUtilities.invokeLater(new Runnable() {
     1092        public void run() {
     1093            JPanel pane = (JPanel) getContentPane();
     1094            pane.updateUI();
     1095            // Also update all of the tabs according to workflow.
     1096            workflowUpdate("Download", Configuration.get("workflow.download", false));
     1097            workflowUpdate("Gather", Configuration.get("workflow.gather", false));
     1098            workflowUpdate("Enrich", Configuration.get("workflow.enrich", false));
     1099            workflowUpdate("Design", Configuration.get("workflow.design", false));
     1100            workflowUpdate("Create", Configuration.get("workflow.create", false));
     1101            workflowUpdate("Format", Configuration.get("workflow.format", false));
     1102        }
     1103        });
    10901104    }
    10911105
Note: See TracChangeset for help on using the changeset viewer.