greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 17145

Show
Ignore:
Timestamp:
2008-09-04 15:15:27 (4 months ago)
Author:
kjdon
Message:

export script has been modified to only use one collection. So modified this prompt to reflect this change.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gli/trunk/src/org/greenstone/gatherer/gui/ExportAsPrompt.java

    r17132 r17145  
    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; 
     
    161161        plugoutMap.put("GreenstoneMETS","doctxt.xml,docmets.xml");      
    162162        plugoutMap.put("FedoraMETS","doctxt.xml,docmets.xml");      
    163         plugoutMap.put("GA","doc.xml"); 
    164163 
    165164        // this is the order we want them to appear in the list 
    166         String [] saveas_formats = {"GA", "GreenstoneMETS", "FedoraMETS", "MARCXML", "DSpace"}; 
     165        String [] saveas_formats = {"GreenstoneMETS", "FedoraMETS", "MARCXML", "DSpace"}; 
    167166        cancel_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip")); 
    168167         
     
    232231 
    233232        all_collections = new ArrayList(); 
    234         list = new CheckList(true); 
     233        //list = new CheckList(true); 
     234        list = new JList(getCollectionListModel()); 
    235235        list_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_List")); 
    236236         
     
    244244        folder_button.addActionListener(new FolderButtonListener()); 
    245245    
    246          
    247         scanForCollections(); 
    248         list.setListData(all_collections); 
    249  
     246        
    250247        prompt = this; 
    251248        setSize(SIZE); 
     
    286283        ok_button = null; 
    287284        prompt = null; 
    288         if (selected_collections!=null) { 
    289             selected_collections.clear(); 
    290             selected_collections = null; 
    291         } 
     285        selected_collection = null; 
    292286        title_field = null; 
    293287        title_label = null; 
     
    411405        DebugStream.println("ExportAsPrompt.exportAsCollections()"); 
    412406 
    413         int num_collections = selected_collections.size()
    414         if (num_collections == 0) return; 
     407        if (selected_collection == null) return
     408 
    415409        cd_title = title_field.getText(); 
    416410 
     
    488482        } 
    489483        
    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          
    493486 
    494487        DebugStream.print("export command = "); 
     
    523516    public void resultPrompt(boolean success, String extra) { 
    524517        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; 
    536521         
    537522        String export_type = (String) saveas_combobox.getSelectedItem();        
     
    558543 
    559544        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); 
    568549        } 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); 
    577554        } 
    578555        SimpleResultDialog result_dialog = new SimpleResultDialog(this, title, label, details); 
     
    588565     * @see org.greenstone.gatherer.util.Utility 
    589566     */ 
    590     private void scanForCollections() { 
     567  private ListModel getCollectionListModel() { 
     568    DefaultListModel model = new DefaultListModel(); 
    591569        // Start at the collect dir. 
    592570        File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 
     
    602580                    if (config_file.exists()) { 
    603581                        BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 
    604                         all_collections.add(config);                   
     582                        model.addElement(config);                      
    605583                        config = null; 
    606584                    } 
     
    608586            } 
    609587        } 
     588        return model; 
    610589        // Otherwise the collect directory doesn't actually exist, so there ain't much we can do. 
    611    
     590 
    612591 
    613592 
     
    667646        { 
    668647            // Can only export when something is ticked 
    669             ok_button.setEnabled(!list.isNothingTicked()); 
     648            //ok_button.setEnabled(!list.isNothingTicked()); 
    670649 
    671650            if (list.isSelectionEmpty()) { 
    672                 // This only happens when the dialog is first entered 
    673651                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    } 
    688667    /** The OK button listener implementation. */ 
    689668    private class OKButtonListener  
     
    702681            ///ystem.err.println("OK Clicked"); 
    703682            // Make sure there are some colls specified 
    704             selected_collections = list.getTicked(); 
     683            selected_collection = (BasicCollectionConfiguration)list.getSelectedValue(); 
    705684            error_message = new StringBuffer(); 
    706685