Index: /trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java	(revision 8495)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java	(revision 8496)
@@ -576,5 +576,6 @@
 	    JLabel source_label = new JLabel();
 	    Dictionary.registerText(source_label, "CDM.IndexManager.Source");
-	    source_list = new CheckList(new_data, false);
+	    source_list = new CheckList(false);
+	    source_list.setListData(new_data);
 	    Dictionary.registerTooltip(source_list, "CDM.IndexManager.Source_Tooltip");
 
@@ -696,5 +697,5 @@
 		new_data.addAll(MetadataSetManager.getEveryMetadataSetElement());
 		// reset the model in the list and combobox
-		source_list.setListData(new_data.toArray());
+		source_list.setListData(new_data);
 		new_data = null;
 		// refresh the indexList
@@ -742,5 +743,5 @@
 	    }
 	    // Can't add a new index if no sources are selected
-	    else if(source_list.isSelectionEmpty()) {
+	    else if (source_list.getSelected().size() == 0) {
 		add_enabled = false;
 	    }
@@ -795,5 +796,5 @@
 	    public void actionPerformed(ActionEvent event) {
 		String name = name_textfield.getText();
-		if(!source_list.isSelectionEmpty() && name.length() != 0) {
+		if (source_list.getSelected().size() > 0 && name.length() != 0) {
 		    ArrayList sources = source_list.getSelected();
 		    Index index = new Index(level_combobox.getSelectedIndex(), sources);
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java	(revision 8495)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java	(revision 8496)
@@ -117,5 +117,4 @@
 	    super();
 
-	    buildModel();
 	    // Creation
 	    JPanel header_panel = new JPanel();
@@ -135,5 +134,7 @@
 	    Dictionary.registerText(instructions, "CDM.SuperCollectionManager.Instructions");
 
-	    collection_checklist = new CheckList(collection_checklist_model, false);
+	    collection_checklist = new CheckList(false);
+	    buildModel();
+	    collection_checklist.setListData(collection_checklist_model);
 
 	    // Layout
@@ -189,19 +190,22 @@
 	}
 
-	private void buildModel() {
-	    // We start by building a model of the installed collections.
+
+	private void buildModel()
+	{
 	    collection_checklist_model = new ArrayList();
+	    current_coll_name = Gatherer.c_man.getCollection().getName();
+
 	    File gsdl_collection_directory;
 	    if (Gatherer.GS3) {
 		gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
-	    } else {
+	    }
+	    else {
 		gsdl_collection_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
 	    }
-	    current_coll_name = Gatherer.c_man.getCollection().getName();
+
 	    File[] possible_collections = gsdl_collection_directory.listFiles();
 	    for(int i = 0; possible_collections != null && i < possible_collections.length; i++) {
-		// The simpliest case is if the directory etc/collect.cfg file and a metadata/ in it. Thus it can easily be built upon.
 		File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_FILE);
-		if(collect_cfg_file.exists()) {
+		if (collect_cfg_file.exists()) {
 		    BasicCollectionConfiguration collect_cfg = new BasicCollectionConfiguration(collect_cfg_file);
 		    StringBuffer title_buffer = new StringBuffer(collect_cfg.getName());
@@ -213,25 +217,18 @@
 		    title_buffer = null;
 		    String collection_name = possible_collections[i].getName();
-		    // We do have to block the model collection.
-		    if(!collect_cfg.getName().equals("**title**")) {
-			Entry entry = new Entry(collection_title);
-			entry.setProperty(collection_name);
-			// Check if a collection with this name exists. The current collection is always selected.
-			entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
-			entry.setFixed(collection_name.equals(current_coll_name));
-			collection_checklist_model.add(entry);
-			entry = null;
-
+
+		    // We have to block the model collection.
+		    if (collect_cfg.getName().equals("**title**")) {
+			continue;
 		    }
-		    collection_name = null;
-		    collection_title = null;
-		    collect_cfg = null;
+
+		    // The current collection is always selected.
+		    Entry entry = new Entry(collection_title);
+		    entry.setProperty(collection_name);
+		    entry.setSelected(getSuperCollection(collection_name) != null || collection_name.equals(current_coll_name));
+		    entry.setFixed(collection_name.equals(current_coll_name));
+		    collection_checklist_model.add(entry);
 		}
-		collect_cfg_file = null;
-	    }
-	    possible_collections = null;
-	    gsdl_collection_directory = null;
-	    // Sort the result.
-	    Collections.sort(collection_checklist_model);
+	    }
 	}
     }
Index: /trunk/gli/src/org/greenstone/gatherer/checklist/CheckList.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/checklist/CheckList.java	(revision 8495)
+++ /trunk/gli/src/org/greenstone/gatherer/checklist/CheckList.java	(revision 8496)
@@ -37,11 +37,4 @@
 package org.greenstone.gatherer.checklist;
 
-/**************************************************************************************
- * Title:        Gatherer
- * Description:  The Gatherer: a tool for gathering and enriching a digital collection.
- * Company:      The University of Waikato
- * Written:      14/08/02
- * Revised:      
- **************************************************************************************/
 import java.awt.*;
 import java.awt.event.*;
@@ -50,23 +43,24 @@
 import javax.swing.border.*;
 
+
 /** This class provides a visual component that has the form of a list, as provided by JList but uses JCheckBox for data selection. Thus several elements can be 'ticked' in the list, and this selection returned using the method getSelected().<BR>Parts of this code modified from Trevor Harmon's posting on www.dejanews.com.
  * @author John Thompson
  * @version 2.3
  */ 
-// ####################################################################################
-// Optimization                          Saving
-// ####################################################################################
-// Vector -> ArrayList                   + Processor
-// ####################################################################################
 public class CheckList
-    extends JList {
+    extends JList
+{
     /** The border used when a list row is not in focus. */
-    protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
-    
+    static private Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
+
     private boolean show_selected_row = true;
+
+
     /** Constructor. */
-    public CheckList(boolean show_selected_row) {
+    public CheckList(boolean show_selected_row)
+    {
 	super();
 	this.show_selected_row = show_selected_row;
+
 	setCellRenderer(new CellRenderer());
 	setModel(new DefaultListModel());
@@ -74,88 +68,33 @@
 	addMouseListener(new CheckListListener());
     }
-    /** Constructor.
-     * @param list_data An ArrayList of entries for this checklist.
-     * @see org.greenstone.gatherer.checklist.Entry
-     */
-    public CheckList(ArrayList list_data, boolean show_selected_row) {
-	super();
-	this.show_selected_row = show_selected_row;
-	// Create a new model.
-	DefaultListModel model = new DefaultListModel();
-	for(int i = 0; i < list_data.size(); i++) {
-	    Entry entry = null;
-	    Object temp = list_data.get(i);
-	    if(temp instanceof Entry) {
-		entry = (Entry) temp;
-	    }
-	    else {
-		entry = new Entry(list_data.get(i));
-	    }
-	    temp = null;
-	    String name = entry.toString();
-	    int index = 0;
-	    boolean found = false;
-	    while(index < model.size() && !found) {
-		Object sibling = model.getElementAt(index);
-		if(name.compareTo(sibling.toString()) <= 0) {
-		    model.add(index, entry);
-		    found = true;
-		}
-		index++;
-	    }
-	    if(!found) {
-		model.addElement(entry);
-	    }
-	}
-	setModel(model);
-	setCellRenderer(new CellRenderer());
-	addMouseListener(new CheckListListener());
-	setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    }
-
-    /** Constructor. */
-    public CheckList(ListModel data_model, boolean show_selected_row) {
-	super(data_model);
-	this.show_selected_row = show_selected_row;
-	setCellRenderer(new CellRenderer());
-	addMouseListener(new CheckListListener());
-	setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    }
-
-    public void addEntry(Entry entry) {
-	DefaultListModel model = (DefaultListModel) getModel();
+
+
+    public void addEntry(Entry entry)
+    {
+	DefaultListModel model = (DefaultListModel) getModel();
+
+	// Add the entry in alpabetical order
 	String name = entry.toString();
-	int index = 0;
-	boolean found = false;
-	while(index < model.size() && !found) {
-	    Object sibling = model.getElementAt(index);
-	    if(name.compareTo(sibling.toString()) <= 0) {
-		model.add(index, entry);
-		found = true;
-	    }
-	    index++;
-	    sibling = null;
-	}
-	if(!found) {
-	    model.addElement(entry);
-	}		  
-	name = null;
-	model = null;
-    }
-
-    public void clearSelection() {
-	DefaultListModel model = (DefaultListModel) getModel();
-	int size = model.size();
-	for(int i = 0; i < size; i++) {
-	    Entry entry = (Entry) model.get(i);
-	    entry.setSelected(false);
+	for (int i = 0; i < model.size(); i++) {
+	    Object sibling = model.getElementAt(i);
+	    if (name.compareTo(sibling.toString()) <= 0) {
+		model.add(i, entry);
+		return;
+	    }
+	}
+
+	model.addElement(entry);
+    }
+
+
+    public void clearSelection()
+    {
+	DefaultListModel model = (DefaultListModel) getModel();
+	for (int i = 0; i < model.size(); i++) {
+	    ((Entry) model.get(i)).setSelected(false);
 	}
 	updateUI();
     }
 
-    public Entry get(int index) {
-	DefaultListModel model = (DefaultListModel) getModel();
-	return (Entry) model.get(index);
-    }
 
     /** Retrieve the currently ticked entries from this list.
@@ -163,11 +102,11 @@
      * @see org.greenstone.gatherer.checklist.Entry
      */
-    public ArrayList getSelected() {
+    public ArrayList getSelected()
+    {
 	ArrayList result = new ArrayList();
 	DefaultListModel model = (DefaultListModel) getModel();
-	int size = model.size();
-	for(int i = 0; i < size; i++) {
+	for (int i = 0; i < model.size(); i++) {
 	    Entry entry = (Entry) model.get(i);
-	    if(entry.isSelected()) {
+	    if (entry.isSelected()) {
 		result.add(entry.getObject());
 	    }
@@ -176,86 +115,49 @@
     }
 
-    public boolean isSelected(int index) {
-	DefaultListModel model = (DefaultListModel) getModel();
-	Entry entry = (Entry) model.get(index);
-	return entry.isSelected();
-    }
-
-    public boolean isSelectionEmpty() {
-	DefaultListModel model = (DefaultListModel) getModel();
-	int size = model.size();
-	for(int i = 0; i < size; i++) {
+
+//     public boolean isSelectionEmpty()
+//     {
+// 	System.err.println("In CheckList.isSelectionEmpty()...");
+// 	DefaultListModel model = (DefaultListModel) getModel();
+// 	for (int i = 0; i < model.size(); i++) {
+// 	    Entry entry = (Entry) model.get(i);
+// 	    if (entry.isSelected()) {
+// 		return false;
+// 	    }
+// 	}
+
+// 	return true;
+//     }
+
+
+    public void setListData(ArrayList list_data)
+    {
+ 	// Create a new model.
+	setModel(new DefaultListModel());
+
+	// Add the items from the list to the model
+ 	for (int i = 0; i < list_data.size(); i++) {
+ 	    Object list_object = list_data.get(i);
+ 	    if (list_object instanceof Entry) {
+ 		addEntry((Entry) list_object);
+ 	    }
+	    else {
+		addEntry(new Entry(list_object));
+	    }
+ 	}
+    }
+
+
+    public void setSelectedObjects(Object objects[])
+    {
+	if (objects == null) {
+	    return;
+	}
+
+	DefaultListModel model = (DefaultListModel) getModel();
+	for (int i = 0; i < model.size(); i++) {
 	    Entry entry = (Entry) model.get(i);
-	    if(entry.isSelected()) {
-		entry = null;
-		model = null;
-		return false;
-	    }
-	    entry = null;
-	}
-	model = null;
-	return true;
-    }
-
-    public int getEntryCount() {
-	return getModel().getSize();
-    }
-
-    public void setListData(Object[] list_data) {
-	// Create a new model.
-	DefaultListModel model = new DefaultListModel();
-	for(int i = 0; i < list_data.length; i++) {
-	    Entry entry = null;
-	    Object temp = list_data[i];
-	    if(temp instanceof Entry) {
-		entry = (Entry) temp;
-	    }
-	    else {
-		entry = new Entry(temp);
-	    }
-	    temp = null;
-	    String name = entry.toString();
-	    int index = 0;
-	    boolean found = false;
-	    while(index < model.size() && !found) {
-		Object sibling = model.getElementAt(index);
-		if(name.compareTo(sibling.toString()) <= 0) {
-		    model.add(index, entry);
-		    found = true;
-		}
-		index++;
-	    }
-	    if(!found) {
-		model.addElement(entry);
-	    }
-	}
-	setModel(model);
-    }
-
-    /** Checks the entries in the list whose name appear in the given array.
-     * @param names The name of entries to be checked as a <strong>String[]</strong>.
-     * @see org.greenstone.gatherer.checklist.Entry
-     */
-    public void setSelected(String names[]) {
-	DefaultListModel model = (DefaultListModel) getModel();
-	int size = model.size();
-	for(int i = 0; i < size; i++) {
-	    Entry entry = (Entry) model.get(i);
-	    for(int j = 0; names != null && j < names.length; j++) {
-		if(entry.toString().equals(names[j])) {
-		    entry.setSelected(true);
-		    
-		}
-	    }
-	}		  
-    }
-
-    public void setSelectedObjects(Object objects[]) {
-	DefaultListModel model = (DefaultListModel) getModel();
-	int size = model.size();
-	for(int i = 0; i < size; i++) {
-	    Entry entry = (Entry) model.get(i);
-	    for(int j = 0; objects != null && j < objects.length; j++) {
-		if(entry.getObject().equals(objects[j])) {
+	    for (int j = 0; j < objects.length; j++) {
+		if (entry.getObject().equals(objects[j])) {
 		    entry.setSelected(true);
 		}
@@ -263,14 +165,16 @@
 	}
 	updateUI();
-
-
-    }
+    }
+
+
     private void selectionChanged(int index) {
 	fireSelectionValueChanged(index, index, false);
     }
+
 
     /** A custom list cell renderer for producing rows which contain clickable check boxes. */
     protected class CellRenderer 
 	implements ListCellRenderer {
+
 	/** Return a component that has been configured to display the specified value. That component's paint method is then called to "render" the cell. If it is necessary to compute the dimensions of a list because the list cells do not have a fixed size, this method is called to generate a component on which getPreferredSize  can be invoked.
 	 * @param list The </strong>JList</strong> we're painting.
@@ -300,9 +204,10 @@
 	}
     }
+
+
     /** Listens for clicks apon the checks within the list, and updates as necessary. */
     private class CheckListListener 
 	extends MouseAdapter {
 
-	//private Entry previous_checkbox = null;
 	/** Called whenever the mouse is clicked over our list. We find the nearest checkbox and change its state.
 	 * @param e A <strong>MouseEvent</strong> containing everything you ever wanted to know about the mouse event but were afraid to ask.
Index: /trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java	(revision 8495)
+++ /trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java	(revision 8496)
@@ -76,6 +76,4 @@
     /** The currently selected collection for deletion. */
     private BasicCollectionConfiguration collection = null;
-    /** The model behind the list. */
-    private DefaultListModel list_model = null;
     /** A reference to ourself so any inner-classes can dispose of us. */
     private ExportCollectionPrompt prompt = null;
@@ -88,6 +86,4 @@
     /** The label above the list. */
     private JLabel list_label = null;
-    /** The list of available collections. */
-    //private JList list = null;
     /** The text area used to display details about the collection selected. */
     private JTextArea details_textarea = null;
@@ -133,6 +129,4 @@
 	Dictionary.registerText(instructions_textarea, "ExportCollectionPrompt.Instructions");
 
-	//list = new JList();
-	//list_model = new DefaultListModel();
 	all_collections = new ArrayList();
 	list = new CheckList(true);
@@ -148,5 +142,5 @@
 	Dictionary.setText(title_label, "ExportCollectionPrompt.CD_Name");
 	scanForCollections();
-	list.setListData(all_collections.toArray());
+	list.setListData(all_collections);
 
 	prompt = this;
Index: /trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 8495)
+++ /trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java	(revision 8496)
@@ -734,11 +734,13 @@
 		Gatherer.g_man.modeChanged(new_mode);
 	    }
+
 	    // Warning preferences
-	    for(int i = 0; i < warning_preferences_check_list.getEntryCount(); i++) {
-		Entry entry = warning_preferences_check_list.get(i);
+	    ListModel warning_preferences_check_list_model = warning_preferences_check_list.getModel();
+	    for (int i = 0; i < warning_preferences_check_list_model.getSize(); i++) {
+		Entry entry = (Entry) warning_preferences_check_list_model.getElementAt(i);
 		Configuration.set(entry.getProperty(), true, entry.isSelected());
 	    }
 
-	    if (Gatherer.GS3 && site_changed && Gatherer.c_man.getCollection()!=null) {
+	    if (Gatherer.GS3 && site_changed && Gatherer.c_man.getCollection() != null) {
 		// shut down the collection
 		System.err.println("shutting down teh collection");
