Changeset 32712

Show
Ignore:
Timestamp:
18.12.2018 19:23:21 (3 months 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.

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r31638 r32712  
    6060import org.greenstone.gatherer.gui.LockFileDialog; 
    6161import org.greenstone.gatherer.gui.ModalProgressPopup; 
     62import org.greenstone.gatherer.gui.TestingPreparation; 
    6263import org.greenstone.gatherer.gui.WarningDialog; 
    6364import org.greenstone.gatherer.metadata.DocXMLFileManager; 
     
    551552    // Create the collection on a separate thread so the progress bar updates correctly 
    552553    (new CreateCollectionTask(description, email, name, title, base_collection_directory, metadata_sets, create_collection_progress_popup)).start(); 
     554    //SwingUtilities.invokeLater(new CreateCollectionTask(description, email, name, title, base_collection_directory, metadata_sets, create_collection_progress_popup)); 
    553555    } 
    554556 
     
    12851287    // Load the collection on a separate thread so the progress bar updates correctly 
    12861288    (new LoadCollectionTask(collection_file_path, load_collection_progress_popup)).start(); 
     1289    //SwingUtilities.invokeLater(new LoadCollectionTask(collection_file_path, load_collection_progress_popup)); 
    12871290    } 
    12881291 
     
    13941397    if (lock_file.exists()) { 
    13951398        LockFileDialog dialog = new LockFileDialog(Gatherer.g_man, collection_name, lock_file); 
     1399        TestingPreparation.setNamesRecursively(dialog); 
    13961400        int choice = dialog.getChoice(); 
    13971401        dialog.dispose(); 
  • 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 
  • main/trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r25789 r32712  
    9797     */ 
    9898    public NewCollectionDetailsPrompt() { 
    99     super(Gatherer.g_man, true);         
     99    super(Gatherer.g_man, true); 
    100100    this.cancelled = true; 
    101101        this.setComponentOrientation(Dictionary.getOrientation()); 
     
    254254    Dimension screen_size = Configuration.screen_size; 
    255255    setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2); 
     256 
     257    TestingPreparation.setNamesRecursively(this); 
     258     
    256259    setVisible(true); 
    257260    } 
  • main/trunk/gli/src/org/greenstone/gatherer/gui/SimpleResultDialog.java

    r18370 r32712  
    6868   
    6969    setUpGUI(label, results); 
     70    TestingPreparation.setNamesRecursively(this); 
    7071  } 
    7172 
  • main/trunk/gli/src/org/greenstone/gatherer/gui/TestingPreparation.java

    r32706 r32712  
    66 
    77public class TestingPreparation { 
    8     public static boolean TEST_MODE = true; // TODO: set to true for debugging. Reset to false when committing to svn 
     8    public static boolean TEST_MODE = false; // TODO: set to true for debugging. Reset to false when committing to svn 
    99    public static boolean DEBUGGING_TEST_MODE = true; 
    1010