Changeset 6662
- Timestamp:
- 2004-01-29T17:34:35+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r6389 r6662 192 192 } 193 193 194 /** Ensure that saving will actually work. This can return false if there is a collection filename clash for instance. */ 195 public boolean canSave() { 196 return general_manager.canSave(); 197 } 198 194 199 /** Cause the current collection configuration to be written out to disk. 195 200 * @see org.greenstone.gatherer.cdm.ClassifierManager -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r6636 r6662 98 98 } 99 99 100 public boolean canSave() { 101 return ((GeneralControl)controls).canSave(); 102 } 103 100 104 /** Destructor. */ 101 105 public void destroy() { … … 146 150 extends JPanel 147 151 implements Control { 152 153 private boolean has_been_warned = false; 148 154 private boolean ready = false; 149 155 private CollectionMeta beta_collectionmeta; … … 365 371 ready = true; 366 372 } 373 374 public boolean canSave() { 375 boolean title_clash_warning = true; 376 // Oh, and if the collection title is already in use warn them about it 377 String title = name_textfield.getText(); 378 // I just happen to have a handy method in the new details prompt to detect this very thing 379 if(NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) { 380 // Determine if the user wants to be warned about this 381 WarningDialog dialog = new WarningDialog("warning.TitleClashes", true); 382 if(dialog.display() == JOptionPane.OK_OPTION) { 383 // If they have said yes, then carry on with the assignement 384 collection_name_collectionmeta.setValue(title); 385 has_been_warned = true; 386 } 387 // Otherwise we don't assign anything. In fact we have to restore the frame title back to its original value 388 else { 389 title_clash_warning = false; 390 String collection_title = collection_name_collectionmeta.getValue(CollectionMeta.TEXT); 391 String collection_name = Gatherer.c_man.getCollection().getName(); 392 Gatherer.g_man.setTitle(collection_title, collection_name); 393 collection_name = null; 394 collection_title = null; 395 } 396 dialog.dispose(); 397 dialog = null; 398 } 399 // No clash, no worries. 400 else { 401 collection_name_collectionmeta.setValue(title); 402 } 403 return title_clash_warning; 404 } 405 367 406 /** Called to store the current value of the components. */ 368 407 public void loseFocus() { 408 369 409 // String values. Have to test if this component has actually ever recieved focus anyway. 370 410 if(ready) { … … 386 426 String title = name_textfield.getText(); 387 427 // I just happen to have a handy method in the new details prompt to detect this very thing 388 if( NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) {428 if(!has_been_warned && NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) { 389 429 // Determine if the user wants to be warned about this 390 430 WarningDialog dialog = new WarningDialog("warning.TitleClashes", true); … … 411 451 412 452 ready = false; 453 has_been_warned = false; 413 454 } 414 455 } -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r6582 r6662 1233 1233 } 1234 1234 1235 public void setClosingThread(boolean set) { 1236 if(set) { 1237 closing_thread = Thread.currentThread(); 1238 } 1239 else { 1240 closing_thread = null; 1241 } 1242 } 1243 1235 1244 /** Updates the given workspace tree model to reference the private cache of the currently loaded collection. */ 1236 1245 /* private void updatePrivateWorkspace(DefaultTreeModel model) { -
trunk/gli/src/org/greenstone/gatherer/gui/GConfigPane.java
r6389 r6662 99 99 } 100 100 101 public boolean canSave() { 102 return cdm.canSave(); 103 } 104 101 105 public void loseFocus() { 102 106 if(cdm != null) { -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r6643 r6662 209 209 } 210 210 else if(esrc == menu_bar.file_exit) { 211 menu_bar.exit();211 //menu_bar.exit(); 212 212 exit(); 213 213 } … … 539 539 */ 540 540 public void exit() { 541 // First of all an exit can only happen if no modal dialog is currently being displayed. Something is creating a modal dialog but not disposing of it. 542 if(Gatherer.current_modal != null) { 543 System.err.println("There is a modal dialog open."); 544 Gatherer.current_modal.makeVisible(); 545 Gatherer.current_modal.toFront(); 546 return; 547 } 548 549 boolean cont = true; 550 if(Gatherer.c_man.ready() && !Gatherer.c_man.saved()) { 551 cont = showSaveCollectionBox(false, true); 552 } 553 else { 554 // Deal to help 555 if(help != null) { 556 help.destroy(); 557 help = null; 558 } 559 Gatherer.self.exit(); 541 // Tell everyone who cares that they are losing focus 542 if(config_pane.canSave()) { 543 boolean cont = true; 544 if(Gatherer.c_man.ready() && !Gatherer.c_man.saved()) { 545 cont = showSaveCollectionBox(false, true); 546 } 547 else { 548 // Deal to help 549 if(help != null) { 550 help.destroy(); 551 help = null; 552 } 553 Gatherer.self.exit(); 554 } 560 555 } 561 556 } … … 852 847 //switch(result) { 853 848 //case SaveCollectionBox.SAVE_YES: 849 Gatherer.c_man.setClosingThread(true); 854 850 Gatherer.c_man.saveCollection(close_after, exit_after); 855 851 // Wait until it is closed. 856 852 try { 857 853 synchronized(this) { 858 854 while(Gatherer.c_man.reallyReady()) { 859 855 wait(10); 860 856 } 861 857 } 862 858 } 863 859 catch(Exception error) { … … 865 861 Gatherer.printStackTrace(error); 866 862 } 867 863 864 Gatherer.c_man.setClosingThread(false); 865 868 866 //content_pane.paintImmediately(bounds); 869 867 return true; -
trunk/gli/src/org/greenstone/gatherer/gui/ModalDialog.java
r6641 r6662 151 151 Object src = event.getSource (); 152 152 if (event instanceof ActiveEvent) { 153 ///ystem.err.println("ActiveEvent:");153 System.err.println("ActiveEvent:"); 154 154 ((ActiveEvent) event).dispatch (); 155 155 } else if (src instanceof Component) { 156 ///ystem.err.println("Source is component");156 System.err.println("Source is component"); 157 157 ((Component) src).dispatchEvent (event); 158 158 } 159 159 else { 160 ///ystem.err.println("Event blocked");160 System.err.println("Event blocked"); 161 161 } 162 162 }
Note:
See TracChangeset
for help on using the changeset viewer.