Changeset 11174


Ignore:
Timestamp:
2006-01-31T21:22:39+13:00 (18 years ago)
Author:
kjdon
Message:

changed the replacelistener to handle replacing with an allfields index

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java

    r11038 r11174  
    817817        level_combobox.setSelectedIndex(selected_index.getLevel());
    818818        }
    819         // TODO: need to set all fields if necessary
    820819        source_list.clearTicked();
    821820        ArrayList sources = selected_index.getSources();
     
    874873        if (index_list.getSelectedIndex() != -1) {
    875874            String id = index.getID();
    876            
    877875            String selected_index_id = ((Index)index_list.getSelectedValue()).getID();
    878876            if (id.equals(selected_index_id)) {
     
    11341132       
    11351133        String name = name_textfield.getText();
    1136         if (!source_list.isNothingTicked() && name.length() != 0) {
    1137             ArrayList sources = source_list.getTicked();
    1138             Index index;
     1134        if (name.length() == 0) {
     1135            // this also should never happen...
     1136            add_button.setEnabled(false);
     1137            replace_button.setEnabled(false);
     1138            return;
     1139        }
     1140        ArrayList sources;
     1141        Index index = null;
     1142        if (mgpp_enabled && allfields_box.isSelected()) {
     1143            sources = new ArrayList();
     1144            sources.add(ALLFIELDS);
     1145            index = new Index(sources);
     1146        }
     1147        else if (!source_list.isNothingTicked()) {
     1148            sources = source_list.getTicked();
    11391149            if (mgpp_enabled) {
    11401150            index = new Index(sources);
     
    11421152            index = new Index(level_combobox.getSelectedIndex(), sources);
    11431153            }
     1154        }
     1155        if (index != null) {
    11441156            // Create the new collection meta
    11451157            CollectionMeta metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + index.getID());
    11461158            metadatum.setValue(name);
    1147 
     1159           
    11481160            // replace the index
    11491161            replaceIndex((Index) index_list.getSelectedValue(), index, metadatum);
    11501162            index_list.setSelectedValue(index, true);
    1151 
     1163           
    11521164        }
    11531165        add_button.setEnabled(false);
Note: See TracChangeset for help on using the changeset viewer.