- Timestamp:
- 2008-09-04T15:15:27+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/gui/ExportAsPrompt.java
r17132 r17145 83 83 84 84 private ArrayList all_collections = null; 85 private ArrayList selected_collections= null;86 /** The list of collections to include in exported cd-rom/dvd image*/87 private CheckList list = null;85 private BasicCollectionConfiguration selected_collection = null; 86 /** The list of collections to export */ 87 private JList list = null; 88 88 /** The currently selected collection for deletion. */ 89 89 private BasicCollectionConfiguration collection = null; … … 161 161 plugoutMap.put("GreenstoneMETS","doctxt.xml,docmets.xml"); 162 162 plugoutMap.put("FedoraMETS","doctxt.xml,docmets.xml"); 163 plugoutMap.put("GA","doc.xml");164 163 165 164 // this is the order we want them to appear in the list 166 String [] saveas_formats = {"G A", "GreenstoneMETS", "FedoraMETS", "MARCXML", "DSpace"};165 String [] saveas_formats = {"GreenstoneMETS", "FedoraMETS", "MARCXML", "DSpace"}; 167 166 cancel_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip")); 168 167 … … 232 231 233 232 all_collections = new ArrayList(); 234 list = new CheckList(true); 233 //list = new CheckList(true); 234 list = new JList(getCollectionListModel()); 235 235 list_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_List")); 236 236 … … 244 244 folder_button.addActionListener(new FolderButtonListener()); 245 245 246 247 scanForCollections(); 248 list.setListData(all_collections); 249 246 250 247 prompt = this; 251 248 setSize(SIZE); … … 286 283 ok_button = null; 287 284 prompt = null; 288 if (selected_collections!=null) { 289 selected_collections.clear(); 290 selected_collections = null; 291 } 285 selected_collection = null; 292 286 title_field = null; 293 287 title_label = null; … … 411 405 DebugStream.println("ExportAsPrompt.exportAsCollections()"); 412 406 413 i nt num_collections = selected_collections.size();414 if (num_collections == 0) return; 407 if (selected_collection == null) return; 408 415 409 cd_title = title_field.getText(); 416 410 … … 488 482 } 489 483 490 for (int i = 0; i < num_collections; i++) { 491 command_parts_list.add(((BasicCollectionConfiguration) selected_collections.get(i)).getShortName()); 492 } 484 command_parts_list.add( selected_collection.getShortName()); 485 493 486 494 487 DebugStream.print("export command = "); … … 523 516 public void resultPrompt(boolean success, String extra) { 524 517 args = new String[2]; 525 StringBuffer coll_names = new StringBuffer(); 526 for (int i=0; i<selected_collections.size();i++) { 527 if (i>0) { 528 coll_names.append(", "); 529 } 530 BasicCollectionConfiguration complete_collection = (BasicCollectionConfiguration)selected_collections.get(i); 531 coll_names.append(complete_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + complete_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER); 532 complete_collection = null; 533 } 534 535 args[0] = coll_names.toString(); 518 519 // coll name 520 args[0] = selected_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + selected_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER; 536 521 537 522 String export_type = (String) saveas_combobox.getSelectedItem(); … … 558 543 559 544 if (success) { 560 String successMessage 561 = (selected_collections.size()==1) 562 ? "ExportAsPrompt.Successful_ExportOne" 563 : "ExportAsPrompt.Successful_ExportMany"; 564 565 title = Dictionary.get("ExportAsPrompt.Successful_Title"); 566 label = Dictionary.get(successMessage, args); 567 details = Dictionary.get("ExportAsPrompt.Successful_Details", args); 545 String successMessage = "ExportAsPrompt.Successful_ExportOne"; 546 title = Dictionary.get("ExportAsPrompt.Successful_Title"); 547 label = Dictionary.get(successMessage, args); 548 details = Dictionary.get("ExportAsPrompt.Successful_Details", args); 568 549 } else { 569 String failedMessage 570 = (selected_collections.size()==1) 571 ? "ExportAsPrompt.Failed_ExportOne" 572 : "ExportAsPrompt.Failed_ExportMany"; 573 574 title = Dictionary.get("ExportAsPrompt.Failed_Title"); 575 label = Dictionary.get(failedMessage, args); 576 details = Dictionary.get("ExportAsPrompt.Failed_Details", args); 550 String failedMessage = "ExportAsPrompt.Failed_ExportOne"; 551 title = Dictionary.get("ExportAsPrompt.Failed_Title"); 552 label = Dictionary.get(failedMessage, args); 553 details = Dictionary.get("ExportAsPrompt.Failed_Details", args); 577 554 } 578 555 SimpleResultDialog result_dialog = new SimpleResultDialog(this, title, label, details); … … 588 565 * @see org.greenstone.gatherer.util.Utility 589 566 */ 590 private void scanForCollections() { 567 private ListModel getCollectionListModel() { 568 DefaultListModel model = new DefaultListModel(); 591 569 // Start at the collect dir. 592 570 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); … … 602 580 if (config_file.exists()) { 603 581 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 604 all_collections.add(config);582 model.addElement(config); 605 583 config = null; 606 584 } … … 608 586 } 609 587 } 588 return model; 610 589 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do. 611 590 } 612 591 613 592 … … 667 646 { 668 647 // Can only export when something is ticked 669 ok_button.setEnabled(!list.isNothingTicked());648 //ok_button.setEnabled(!list.isNothingTicked()); 670 649 671 650 if (list.isSelectionEmpty()) { 672 // This only happens when the dialog is first entered673 651 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.No_Collection")); 674 return; 675 } 676 677 collection = (BasicCollectionConfiguration) ((CheckListEntry) list.getSelectedValue()).getObject(); 678 args = new String[3]; 679 args[0] = collection.getCreator(); 680 args[1] = collection.getMaintainer(); 681 args[2] = collection.getDescription(); 682 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.Details", args)); 683 details_textarea.setCaretPosition(0); 684 } 685 } 686 687 652 ok_button.setEnabled(false); 653 } 654 else { 655 BasicCollectionConfiguration collection = (BasicCollectionConfiguration) list.getSelectedValue(); 656 args = new String[3]; 657 args[0] = collection.getCreator(); 658 args[1] = collection.getMaintainer(); 659 args[2] = collection.getDescription(); 660 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.Details", args)); 661 details_textarea.setCaretPosition(0); 662 ok_button.setEnabled(true); 663 } 664 } 665 666 } 688 667 /** The OK button listener implementation. */ 689 668 private class OKButtonListener … … 702 681 ///ystem.err.println("OK Clicked"); 703 682 // Make sure there are some colls specified 704 selected_collection s = list.getTicked();683 selected_collection = (BasicCollectionConfiguration)list.getSelectedValue(); 705 684 error_message = new StringBuffer(); 706 685
Note:
See TracChangeset
for help on using the changeset viewer.