Ignore:
Timestamp:
2009-01-12T11:40:15+13:00 (15 years ago)
Author:
kjdon
Message:

updated the rtl-gli branch with files from trunk. Result of a merge 14807:18318, and fixed some conflicts. I think this is the last commit following merging the files. Haven't tried to compile yet... here goes...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/ExportAsPrompt.java

    r18297 r18364  
    8383
    8484    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;
    8888    /** The currently selected collection for deletion. */
    8989    private BasicCollectionConfiguration collection = null;
     
    159159    plugoutMap.put("DSpace","dublin-core.xml");
    160160        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"};
    164166        cancel_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip"));
    165167   
     
    179181    instructions_textarea.setComponentOrientation(Dictionary.getOrientation());
    180182             
    181         // Save As
    182     ArrayList saveas_formats = new ArrayList(plugoutMap.keySet());
    183183       
    184184        saveas_label = new JLabel(Dictionary.get("ExportAsPrompt.SaveAs")
     
    187187        //saveas_label.setPreferredSize(LABEL_SIZE);
    188188       
    189         saveas_combobox = new JComboBox(saveas_formats.toArray());
     189    saveas_combobox = new JComboBox(saveas_formats);
    190190    saveas_combobox.setOpaque(false);
    191191    saveas_combobox.setToolTipText(Dictionary.get("ExportAsPrompt.SaveAs_Tooltip"));
     
    224224        convert_xml_field1 = new JTextField();
    225225        convert_xml_field1.setComponentOrientation(Dictionary.getOrientation());
     226    convert_xml_field1.setEnabled(false);
     227
    226228    convert_xml_field2 = new JTextField();
    227229        convert_xml_field2.setComponentOrientation(Dictionary.getOrientation());
     230    convert_xml_field2.setEnabled(false);
     231
    228232    mapping_xml_field = new JTextField();
    229233        mapping_xml_field.setComponentOrientation(Dictionary.getOrientation());
     234    mapping_xml_field.setEnabled(false);
    230235
    231236        convert_xml_pane1 = new JPanel(new BorderLayout());
     
    242247       
    243248    all_collections = new ArrayList();
    244     list = new CheckList(true);
     249    //list = new CheckList(true);
     250    list = new JList(getCollectionListModel());
    245251    list_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_List"));
    246252    list_label.setComponentOrientation(Dictionary.getOrientation());
     
    257263    folder_button.addActionListener(new FolderButtonListener());
    258264   
    259    
    260     scanForCollections();
    261     list.setListData(all_collections);
    262 
     265       
    263266    prompt = this;
    264267    setSize(SIZE);
     
    299302    ok_button = null;
    300303    prompt = null;
    301     if (selected_collections!=null) {
    302         selected_collections.clear();
    303         selected_collections = null;
    304     }
     304    selected_collection = null;
    305305    title_field = null;
    306306    title_label = null;
     
    348348       
    349349        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);
    361352
    362353        // Save as pane
     
    441432    DebugStream.println("ExportAsPrompt.exportAsCollections()");
    442433
    443     int num_collections = selected_collections.size();
    444     if (num_collections == 0) return;
     434    if (selected_collection == null) return;
     435
    445436    cd_title = title_field.getText();
    446437
     
    479470        command_parts_list.add(export_dir);
    480471
    481         if (!export_type.equals("METS") && xsl_file1 !=null){
     472        if (!export_type.endsWith("METS") && xsl_file1 !=null){
    482473             command_parts_list.add("-xsltfile");
    483474             command_parts_list.add(xsl_file1.getPath());
     
    508499
    509500           
    510         if (export_type.equals("METS") && xsl_file1 !=null){
     501        if (export_type.endsWith("METS") && xsl_file1 !=null){
    511502             command_parts_list.add("-xslt_txt");
    512503             command_parts_list.add(xsl_file1.getPath());
    513504    }
    514505
    515          if (export_type.equals("METS") && xsl_file2 !=null){
     506         if (export_type.endsWith("METS") && xsl_file2 !=null){
    516507             command_parts_list.add("-xslt_mets");
    517508             command_parts_list.add(xsl_file2.getPath());
    518509    }
    519510       
    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     
    523513
    524514    DebugStream.print("export command = ");
     
    553543    public void resultPrompt(boolean success, String extra) {
    554544    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;
    566548   
    567549    String export_type = (String) saveas_combobox.getSelectedItem();       
     
    588570
    589571    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);
    598576    } 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);
    609583    result_dialog.setVisible(true); // Blocks
    610584    result_dialog.dispose();
     
    618592     * @see org.greenstone.gatherer.util.Utility
    619593     */
    620     private void scanForCollections() {
     594  private ListModel getCollectionListModel() {
     595    DefaultListModel model = new DefaultListModel();
    621596    // Start at the collect dir.
    622597    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
     
    632607            if (config_file.exists()) {
    633608            BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
    634             all_collections.add(config);               
     609            model.addElement(config);               
    635610            config = null;
    636611            }
     
    638613        }
    639614    }
     615    return model;
    640616    // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
    641     }
     617  }
    642618
    643619
     
    697673    {
    698674        // Can only export when something is ticked
    699         ok_button.setEnabled(!list.isNothingTicked());
     675        //ok_button.setEnabled(!list.isNothingTicked());
    700676
    701677        if (list.isSelectionEmpty()) {
    702         // This only happens when the dialog is first entered
    703678        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    }
    718694    /** The OK button listener implementation. */
    719695    private class OKButtonListener
     
    732708        ///ystem.err.println("OK Clicked");
    733709        // Make sure there are some colls specified
    734         selected_collections = list.getTicked();
     710        selected_collection = (BasicCollectionConfiguration)list.getSelectedValue();
    735711        error_message = new StringBuffer();
    736712       
     
    837813     
    838814        convert_xml_button1.setEnabled(convert_xml_checkbox1.isSelected());
     815        convert_xml_field1.setEnabled(convert_xml_checkbox1.isSelected());
    839816        convert_xml_button2.setEnabled(convert_xml_checkbox2.isSelected());
     817        convert_xml_field2.setEnabled(convert_xml_checkbox2.isSelected());
    840818        convert_xml_button3.setEnabled(mapping_xml_checkbox.isSelected());
     819        mapping_xml_field.setEnabled(mapping_xml_checkbox.isSelected());
    841820           
    842821    }
     
    871850        }
    872851
    873         if (!saveas.equals("METS")){
     852        if (!saveas.endsWith("METS")){
    874853   
    875854        convert_xml_checkbox1.setText(Dictionary.get("ExportAsPrompt.ApplyXSL",(String)plugoutMap.get(saveas)));   
Note: See TracChangeset for help on using the changeset viewer.