Index: gli/trunk/src/org/greenstone/gatherer/cdm/IndexOptionManager.java
===================================================================
--- gli/trunk/src/org/greenstone/gatherer/cdm/IndexOptionManager.java	(revision 18686)
+++ gli/trunk/src/org/greenstone/gatherer/cdm/IndexOptionManager.java	(revision 18687)
@@ -19,7 +19,6 @@
 
     // we have an IndexOptionList (DOMProxyListModel) for each option type
-    private IndexOptionList level_model = null;
-    private IndexOptionList stem_model = null;
-    
+    private IndexOptionList level_model = null; 
+    private IndexOptionList options_model = null; 
     /** the default level option  - for mgpp and lucene */
     private IndexOption default_level = null;
@@ -30,8 +29,8 @@
     public IndexOptionManager(String current_build_type) {
 	level_model = new IndexOptionList(CollectionDesignManager.collect_config.getLevels());
-	stem_model = new IndexOptionList(CollectionDesignManager.collect_config.getStemOptions());
+	options_model = new IndexOptionList(CollectionDesignManager.collect_config.getIndexOptions());
 	
 	DebugStream.println("IndexOptionManager: " + level_model.getSize() + " levels parsed.");
-	DebugStream.println("IndexOptionManager: " + stem_model.getSize() + " stem options parsed.");
+	DebugStream.println("IndexOptionManager: " + options_model.getSize() + " index options parsed.");
 	
 	build_type = current_build_type;
@@ -39,7 +38,7 @@
 	    level_model.setAssigned(false);
 	}
-	else if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
-	    stem_model.setAssigned(false);
-	}
+	//	else if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+	//   options_model.setAssigned(false);
+	//}
 	// Parse and retrieve the default level 
 	Element default_level_element = CollectionDesignManager.collect_config.getLevelDefault();
@@ -54,13 +53,13 @@
     public void buildTypeChanged(String new_build_type) {
 	boolean levels_enabled = true;
-	boolean stem_enabled = true;
+	//boolean stem_enabled = true;
 	if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
 	    levels_enabled = false;
-	} else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
-	    stem_enabled = false;
-	}
+	}// else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+	 //   stem_enabled = false;
+	//}
 	level_model.setAssigned(levels_enabled);
 	default_level.setAssigned(levels_enabled);
-	stem_model.setAssigned(stem_enabled);
+	//options_model.setAssigned(stem_enabled);
 	((IndexOptionControl)controls).buildTypeChanged(new_build_type);
 	build_type = new_build_type;
@@ -140,7 +139,7 @@
             
 	    setLayout(new BorderLayout());
-	    if (!build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+	    //if (!build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
 		add(stem_control, BorderLayout.NORTH);
-	    }
+		//}
 	    if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
 		add(level_control, BorderLayout.CENTER);
@@ -163,12 +162,12 @@
 	    
 	    // then display/hide as appropriate
-	    if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+	    //if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
 		// Changing to MG/MGPP
-		add(stem_control, BorderLayout.NORTH);
-	    }
-	    else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+	    //	add(stem_control, BorderLayout.NORTH);
+	    //}
+	    //else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
 		// Changing to Lucene
-		remove(stem_control);
-	    }
+		//remove(stem_control);
+	    //}
 	    if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
 		// changing from MG
@@ -213,5 +212,5 @@
 	    accentfold_checkbox.setActionCommand(StaticStrings.ACCENTFOLD_OPTION_STR);
 	    // Accent-folding is currently not available for MG
-	    accentfold_checkbox.setEnabled(!build_type.equals(BuildTypeManager.BUILD_TYPE_MG));
+	    // accentfold_checkbox.setEnabled(!build_type.equals(BuildTypeManager.BUILD_TYPE_MG));
             accentfold_checkbox.setComponentOrientation(Dictionary.getOrientation());
             
@@ -245,32 +244,49 @@
 	    add(checkbox_panel, BorderLayout.CENTER);
 
-	    // set up the checked/unchecked boxes
-	    if (stem_model.getSize()==0) {
-		// select all
-		stem_checkbox.setSelected(true);
-		stem_model.addOption(StaticStrings.STEM_OPTION_STR);
+	    // set the defaults
+	    if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+		stem_checkbox.setSelected(false);
+		stem_checkbox.setEnabled(false);
 		casefold_checkbox.setSelected(true);
-		stem_model.addOption(StaticStrings.CASEFOLD_OPTION_STR);
-		if (accentfold_checkbox.isEnabled()) {
-		    accentfold_checkbox.setSelected(true);
-		    stem_model.addOption(StaticStrings.ACCENTFOLD_OPTION_STR);
-		}
-		separate_cjk_checkbox.setSelected(false);
-	    } 
-	    else {
-		if (stem_model.getOption(StaticStrings.STEM_OPTION_STR)!=null) {
+		casefold_checkbox.setEnabled(false);
+		accentfold_checkbox.setSelected(true);
+		accentfold_checkbox.setEnabled(false);
+		if (options_model.getOption(StaticStrings.SEPARATE_CJK_OPTION_STR) != null) {
+		    separate_cjk_checkbox.setSelected(true);
+		}
+	    } else {
+		if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
+		    accentfold_checkbox.setEnabled(false);
+		}
+		
+		// set up the checked/unchecked boxes
+		if (options_model.getSize()==0) {
+		    // select all
 		    stem_checkbox.setSelected(true);
-		}
-		if (stem_model.getOption(StaticStrings.CASEFOLD_OPTION_STR)!=null) {
+		    options_model.addOption(StaticStrings.STEM_OPTION_STR);
 		    casefold_checkbox.setSelected(true);
-		}
-		if (stem_model.getOption(StaticStrings.ACCENTFOLD_OPTION_STR)!=null) {
-		    accentfold_checkbox.setSelected(true);
-		}
-		if (stem_model.getOption(StaticStrings.SEPARATE_CJK_OPTION_STR) != null) {
-		    separate_cjk_checkbox.setSelected(true);
-		}
-		
-		
+		    options_model.addOption(StaticStrings.CASEFOLD_OPTION_STR);
+		    if (accentfold_checkbox.isEnabled()) {
+			accentfold_checkbox.setSelected(true);
+			options_model.addOption(StaticStrings.ACCENTFOLD_OPTION_STR);
+		    }
+		    separate_cjk_checkbox.setSelected(false);
+		} 
+		else {
+		    // we'll assume that the config file has got it correct
+		    if (options_model.getOption(StaticStrings.STEM_OPTION_STR)!=null) {
+			stem_checkbox.setSelected(true);
+		    }
+		    if (options_model.getOption(StaticStrings.CASEFOLD_OPTION_STR)!=null) {
+			casefold_checkbox.setSelected(true);
+		    }
+		    if (options_model.getOption(StaticStrings.ACCENTFOLD_OPTION_STR)!=null) {
+			accentfold_checkbox.setSelected(true);
+		    }
+		    if (options_model.getOption(StaticStrings.SEPARATE_CJK_OPTION_STR) != null) {
+			separate_cjk_checkbox.setSelected(true);
+		    }
+		    
+		}
 	    }
 	
@@ -290,21 +306,48 @@
 	
 	public void buildTypeChanged(String new_build_type) {
-	    // Accent-folding is currently not available for MG
+	    // accentfold only enabled for mgpp
+	    if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MGPP)) {
+		accentfold_checkbox.setEnabled(true);
+		accentfold_checkbox.setSelected(true);
+		options_model.addOption(StaticStrings.ACCENTFOLD_OPTION_STR);
+		if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+		    // was lucene
+		    stem_checkbox.setEnabled(true);
+		    stem_checkbox.setSelected(true);
+		    options_model.addOption(StaticStrings.STEM_OPTION_STR);
+		    casefold_checkbox.setEnabled(true);
+		    casefold_checkbox.setSelected(true);
+		    options_model.addOption(StaticStrings.CASEFOLD_OPTION_STR);
+		} // else, was mg, stem and case remain the same
+		    
+	    }
 	    if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
-		//changing to MG
 		accentfold_checkbox.setSelected(false);
 		accentfold_checkbox.setEnabled(false);
-		if (accentfold_checkbox.isSelected()) {
-		    stem_model.removeOption(StaticStrings.ACCENTFOLD_OPTION_STR);
-		} 
-	    }
-	    else if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
-		//Changing from MG
-		accentfold_checkbox.setEnabled(true);
-		if (accentfold_checkbox.isSelected()) {
-		    stem_model.addOption(StaticStrings.ACCENTFOLD_OPTION_STR);
-		}
-	    }
-	    
+		options_model.removeOption(StaticStrings.ACCENTFOLD_OPTION_STR);
+	
+		if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+		    // was lucene
+		    stem_checkbox.setEnabled(true);
+		    stem_checkbox.setSelected(true);
+		    options_model.addOption(StaticStrings.STEM_OPTION_STR);
+		    casefold_checkbox.setEnabled(true);
+		    casefold_checkbox.setSelected(true);
+		    options_model.addOption(StaticStrings.CASEFOLD_OPTION_STR);
+		} // else, was mgpp, stem and case remain the same
+	   
+	    }
+	    if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {
+		accentfold_checkbox.setSelected(true);
+		accentfold_checkbox.setEnabled(false);
+		options_model.removeOption(StaticStrings.ACCENTFOLD_OPTION_STR);
+		stem_checkbox.setSelected(false);
+		stem_checkbox.setEnabled(false);
+		options_model.removeOption(StaticStrings.STEM_OPTION_STR);
+		casefold_checkbox.setSelected(true);
+		casefold_checkbox.setEnabled(false);
+		options_model.removeOption(StaticStrings.CASEFOLD_OPTION_STR);
+	
+	    }
 	}
 
@@ -314,9 +357,9 @@
 		if (!((JCheckBox)event.getSource()).isSelected()) {
 		    // deselecting
-		    stem_model.removeOption(event.getActionCommand());
+		    options_model.removeOption(event.getActionCommand());
 		}
 		else {
 		    // selecting a new one
-		    stem_model.addOption(event.getActionCommand());
+		    options_model.addOption(event.getActionCommand());
 		}
 	    }
