- Timestamp:
- 2009-01-12T11:40:15+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/ExportAsPrompt.java
r18297 r18364 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; … … 159 159 plugoutMap.put("DSpace","dublin-core.xml"); 160 160 plugoutMap.put("MARCXML","doc.xml"); 161 plugoutMap.put("METS","doctxt.xml,docmets.xml"); 162 plugoutMap.put("GA","doc.xml"); 163 161 plugoutMap.put("GreenstoneMETS","doctxt.xml,docmets.xml"); 162 plugoutMap.put("FedoraMETS","doctxt.xml,docmets.xml"); 163 164 // this is the order we want them to appear in the list 165 String [] saveas_formats = {"GreenstoneMETS", "FedoraMETS", "MARCXML", "DSpace"}; 164 166 cancel_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip")); 165 167 … … 179 181 instructions_textarea.setComponentOrientation(Dictionary.getOrientation()); 180 182 181 // Save As182 ArrayList saveas_formats = new ArrayList(plugoutMap.keySet());183 183 184 184 saveas_label = new JLabel(Dictionary.get("ExportAsPrompt.SaveAs") … … 187 187 //saveas_label.setPreferredSize(LABEL_SIZE); 188 188 189 saveas_combobox = new JComboBox(saveas_formats.toArray());189 saveas_combobox = new JComboBox(saveas_formats); 190 190 saveas_combobox.setOpaque(false); 191 191 saveas_combobox.setToolTipText(Dictionary.get("ExportAsPrompt.SaveAs_Tooltip")); … … 224 224 convert_xml_field1 = new JTextField(); 225 225 convert_xml_field1.setComponentOrientation(Dictionary.getOrientation()); 226 convert_xml_field1.setEnabled(false); 227 226 228 convert_xml_field2 = new JTextField(); 227 229 convert_xml_field2.setComponentOrientation(Dictionary.getOrientation()); 230 convert_xml_field2.setEnabled(false); 231 228 232 mapping_xml_field = new JTextField(); 229 233 mapping_xml_field.setComponentOrientation(Dictionary.getOrientation()); 234 mapping_xml_field.setEnabled(false); 230 235 231 236 convert_xml_pane1 = new JPanel(new BorderLayout()); … … 242 247 243 248 all_collections = new ArrayList(); 244 list = new CheckList(true); 249 //list = new CheckList(true); 250 list = new JList(getCollectionListModel()); 245 251 list_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_List")); 246 252 list_label.setComponentOrientation(Dictionary.getOrientation()); … … 257 263 folder_button.addActionListener(new FolderButtonListener()); 258 264 259 260 scanForCollections(); 261 list.setListData(all_collections); 262 265 263 266 prompt = this; 264 267 setSize(SIZE); … … 299 302 ok_button = null; 300 303 prompt = null; 301 if (selected_collections!=null) { 302 selected_collections.clear(); 303 selected_collections = null; 304 } 304 selected_collection = null; 305 305 title_field = null; 306 306 title_label = null; … … 348 348 349 349 String saveas = (String)saveas_combobox.getSelectedItem(); 350 if (saveas.equals("MARCXML")){ 351 convert_xml_pane.add(mapping_xml_pane); 352 convert_xml_pane.add(output_single_checkbox); 353 } 354 else{ 355 if (saveas.equals("METS")){ 356 convert_xml_pane.add(convert_xml_pane2); 357 } 358 } 359 convert_xml_pane.revalidate(); 360 convert_xml_pane.repaint(); 350 // force the updating of which fields we are displaying 351 saveas_combobox.setSelectedIndex(0); 361 352 362 353 // Save as pane … … 441 432 DebugStream.println("ExportAsPrompt.exportAsCollections()"); 442 433 443 i nt num_collections = selected_collections.size();444 if (num_collections == 0) return; 434 if (selected_collection == null) return; 435 445 436 cd_title = title_field.getText(); 446 437 … … 479 470 command_parts_list.add(export_dir); 480 471 481 if (!export_type.e quals("METS") && xsl_file1 !=null){472 if (!export_type.endsWith("METS") && xsl_file1 !=null){ 482 473 command_parts_list.add("-xsltfile"); 483 474 command_parts_list.add(xsl_file1.getPath()); … … 508 499 509 500 510 if (export_type.e quals("METS") && xsl_file1 !=null){501 if (export_type.endsWith("METS") && xsl_file1 !=null){ 511 502 command_parts_list.add("-xslt_txt"); 512 503 command_parts_list.add(xsl_file1.getPath()); 513 504 } 514 505 515 if (export_type.e quals("METS") && xsl_file2 !=null){506 if (export_type.endsWith("METS") && xsl_file2 !=null){ 516 507 command_parts_list.add("-xslt_mets"); 517 508 command_parts_list.add(xsl_file2.getPath()); 518 509 } 519 510 520 for (int i = 0; i < num_collections; i++) { 521 command_parts_list.add(((BasicCollectionConfiguration) selected_collections.get(i)).getShortName()); 522 } 511 command_parts_list.add( selected_collection.getShortName()); 512 523 513 524 514 DebugStream.print("export command = "); … … 553 543 public void resultPrompt(boolean success, String extra) { 554 544 args = new String[2]; 555 StringBuffer coll_names = new StringBuffer(); 556 for (int i=0; i<selected_collections.size();i++) { 557 if (i>0) { 558 coll_names.append(", "); 559 } 560 BasicCollectionConfiguration complete_collection = (BasicCollectionConfiguration)selected_collections.get(i); 561 coll_names.append(complete_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + complete_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER); 562 complete_collection = null; 563 } 564 565 args[0] = coll_names.toString(); 545 546 // coll name 547 args[0] = selected_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + selected_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER; 566 548 567 549 String export_type = (String) saveas_combobox.getSelectedItem(); … … 588 570 589 571 if (success) { 590 String successMessage 591 = (selected_collections.size()==1) 592 ? "ExportAsPrompt.Successful_ExportOne" 593 : "ExportAsPrompt.Successful_ExportMany"; 594 595 title = Dictionary.get("ExportAsPrompt.Successful_Title"); 596 label = Dictionary.get(successMessage, args); 597 details = Dictionary.get("ExportAsPrompt.Successful_Details", args); 572 String successMessage = "ExportAsPrompt.Successful_ExportOne"; 573 title = Dictionary.get("ExportAsPrompt.Successful_Title"); 574 label = Dictionary.get(successMessage, args); 575 details = Dictionary.get("ExportAsPrompt.Successful_Details", args); 598 576 } else { 599 String failedMessage 600 = (selected_collections.size()==1) 601 ? "ExportAsPrompt.Failed_ExportOne" 602 : "ExportAsPrompt.Failed_ExportMany"; 603 604 title = Dictionary.get("ExportAsPrompt.Failed_Title"); 605 label = Dictionary.get(failedMessage, args); 606 details = Dictionary.get("ExportAsPrompt.Failed_Details", args); 607 } 608 SimpleResultDialog result_dialog = new SimpleResultDialog(title, label, details); 577 String failedMessage = "ExportAsPrompt.Failed_ExportOne"; 578 title = Dictionary.get("ExportAsPrompt.Failed_Title"); 579 label = Dictionary.get(failedMessage, args); 580 details = Dictionary.get("ExportAsPrompt.Failed_Details", args); 581 } 582 SimpleResultDialog result_dialog = new SimpleResultDialog(this, title, label, details); 609 583 result_dialog.setVisible(true); // Blocks 610 584 result_dialog.dispose(); … … 618 592 * @see org.greenstone.gatherer.util.Utility 619 593 */ 620 private void scanForCollections() { 594 private ListModel getCollectionListModel() { 595 DefaultListModel model = new DefaultListModel(); 621 596 // Start at the collect dir. 622 597 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); … … 632 607 if (config_file.exists()) { 633 608 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 634 all_collections.add(config);609 model.addElement(config); 635 610 config = null; 636 611 } … … 638 613 } 639 614 } 615 return model; 640 616 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do. 641 617 } 642 618 643 619 … … 697 673 { 698 674 // Can only export when something is ticked 699 ok_button.setEnabled(!list.isNothingTicked());675 //ok_button.setEnabled(!list.isNothingTicked()); 700 676 701 677 if (list.isSelectionEmpty()) { 702 // This only happens when the dialog is first entered703 678 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.No_Collection")); 704 return; 705 } 706 707 collection = (BasicCollectionConfiguration) ((CheckListEntry) list.getSelectedValue()).getObject(); 708 args = new String[3]; 709 args[0] = collection.getCreator(); 710 args[1] = collection.getMaintainer(); 711 args[2] = collection.getDescription(); 712 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.Details", args)); 713 details_textarea.setCaretPosition(0); 714 } 715 } 716 717 679 ok_button.setEnabled(false); 680 } 681 else { 682 BasicCollectionConfiguration collection = (BasicCollectionConfiguration) list.getSelectedValue(); 683 args = new String[3]; 684 args[0] = collection.getCreator(); 685 args[1] = collection.getMaintainer(); 686 args[2] = collection.getDescription(); 687 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.Details", args)); 688 details_textarea.setCaretPosition(0); 689 ok_button.setEnabled(true); 690 } 691 } 692 693 } 718 694 /** The OK button listener implementation. */ 719 695 private class OKButtonListener … … 732 708 ///ystem.err.println("OK Clicked"); 733 709 // Make sure there are some colls specified 734 selected_collection s = list.getTicked();710 selected_collection = (BasicCollectionConfiguration)list.getSelectedValue(); 735 711 error_message = new StringBuffer(); 736 712 … … 837 813 838 814 convert_xml_button1.setEnabled(convert_xml_checkbox1.isSelected()); 815 convert_xml_field1.setEnabled(convert_xml_checkbox1.isSelected()); 839 816 convert_xml_button2.setEnabled(convert_xml_checkbox2.isSelected()); 817 convert_xml_field2.setEnabled(convert_xml_checkbox2.isSelected()); 840 818 convert_xml_button3.setEnabled(mapping_xml_checkbox.isSelected()); 819 mapping_xml_field.setEnabled(mapping_xml_checkbox.isSelected()); 841 820 842 821 } … … 871 850 } 872 851 873 if (!saveas.e quals("METS")){852 if (!saveas.endsWith("METS")){ 874 853 875 854 convert_xml_checkbox1.setText(Dictionary.get("ExportAsPrompt.ApplyXSL",(String)plugoutMap.get(saveas)));
Note:
See TracChangeset
for help on using the changeset viewer.