Changeset 4585
- Timestamp:
- 2003-06-11T16:42:00+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r4561 r4585 187 187 } 188 188 else if(esrc == menu_bar.file_new) { 189 if(!Gatherer.c_man.saved()) { 190 cont = showSaveCollectionBox(false, false); 191 } 192 if(cont) { 193 showNewCollectionPrompt(); 194 } 189 showNewCollectionPrompt(); 195 190 } 196 191 else if(esrc == menu_bar.file_open) { 197 if(!Gatherer.c_man.saved()) {198 199 }200 if(cont) {192 // if(!Gatherer.c_man.saved()) { 193 // cont = showSaveCollectionBox(false, false); 194 // } 195 // if(cont) { 201 196 //if(! 202 197 showLoadCollectionBox(); … … 204 199 //collectionChanged(false); 205 200 //} 206 201 // } 207 202 } 208 203 else if(esrc == menu_bar.file_options) { … … 606 601 // User can cancel action. 607 602 if(filename != null) { 608 // If there is already a collection open, close it.603 // If there is already a collection open, save and close it. 609 604 if(Gatherer.c_man.ready()) { 610 Gatherer.c_man.closeCollection();605 showSaveCollectionBox(true, false); 611 606 // Wait until it is closed. 612 try { 613 while(Gatherer.c_man.ready()) { 614 wait(10); 615 } 616 } 617 catch(Exception error) { 618 } 607 // try { 608 // while(Gatherer.c_man.ready()) { 609 // wait(10); 610 // } 611 // } 612 // catch(Exception error) { 613 // System.err.println("Exception: " + error); 614 // error.printStackTrace(); 615 // } 619 616 } 620 617 result = Gatherer.c_man.loadCollection(filename); … … 635 632 } 636 633 /** This method is used to open the new collection box on the screen. 637 634 */ 638 635 public void showNewCollectionPrompt() { 639 636 NewCollectionMetadataPrompt ncm_prompt = null; … … 646 643 // Create the new collection (if not cancelled) in a new thread. 647 644 if(!ncd_prompt.isCancelled() && (ncm_prompt == null || !ncm_prompt.isCancelled())) { 648 // If there is already a collection open, close it.645 // If there is already a collection open, save and close it. 649 646 if(Gatherer.c_man.ready()) { 650 Gatherer.c_man.closeCollection();647 showSaveCollectionBox(true, false); 651 648 // Wait until it is closed. 652 try { 653 while(Gatherer.c_man.ready()) { 654 wait(10); 655 } 656 } 657 catch(Exception error) { 658 } 659 } 649 // try { 650 // synchronized(this) { 651 // while(Gatherer.c_man.ready()) { 652 // wait(10); 653 // } 654 // } 655 // } 656 // catch(Exception error) { 657 // System.err.println("Exception: " + error); 658 // error.printStackTrace(); 659 // } 660 } 661 660 662 // Create new collection. 661 663 CreationTask task = new CreationTask(ncd_prompt, ncm_prompt); 662 SwingUtilities.invokeLater(task); 664 // SwingUtilities.invokeLater(task); 665 task.start(); 663 666 // Close prompt. 664 667 } … … 668 671 } 669 672 private class CreationTask 670 implements Runnable{673 extends Thread { 671 674 private NewCollectionDetailsPrompt ncd_prompt = null; 672 675 private NewCollectionMetadataPrompt ncm_prompt = null; … … 677 680 678 681 public void run() { 682 // System.err.println("Running CreationTask..."); 679 683 if(ncm_prompt == null) { 680 684 Gatherer.c_man.createCollection(ncd_prompt.getDescription(), ncd_prompt.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), null); … … 732 736 } 733 737 } 738 // "View assigned metadata" menu item is disabled by default 739 menu_bar.metadata_view.setCanEnable(false); 740 menu_bar.setMetaAuditSuffix(null); 741 734 742 menu_bar.tabSelected(tab_pane.getSelectedIndex()); 735 743 if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(collection_pane)) { 744 collection_pane.gainFocus(); 745 // "View assigned metadata" menu item is enabled for the "Gather" pane 736 746 menu_bar.metadata_view.setCanEnable(true); 737 747 } 738 748 else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(metaedit_pane)) { 739 749 metaedit_pane.gainFocus(); 750 // "View assigned metadata" menu item is enabled for the "Enrich" pane 740 751 menu_bar.metadata_view.setCanEnable(true); 741 752 } 742 753 else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(config_pane)) { 743 754 config_pane.gainFocus(); 744 menu_bar.metadata_view.setCanEnable(false);745 755 } 746 756 else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(create_pane)) { 747 757 create_pane.gainFocus(); 748 menu_bar.metadata_view.setCanEnable(false);749 758 } 750 759 else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(preview_pane)) { 751 760 config_pane.saveConfiguration(); 752 761 preview_pane.gainFocus(); 753 menu_bar.metadata_view.setCanEnable(false); 754 } 755 else { 756 menu_bar.metadata_view.setCanEnable(false); 757 } 762 } 763 758 764 previous_pane = (JPanel) tab_pane.getSelectedComponent(); 759 765 }
Note:
See TracChangeset
for help on using the changeset viewer.