Index: /gli/trunk/src/org/greenstone/gatherer/cdm/FormatManager.java
===================================================================
--- /gli/trunk/src/org/greenstone/gatherer/cdm/FormatManager.java	(revision 14744)
+++ /gli/trunk/src/org/greenstone/gatherer/cdm/FormatManager.java	(revision 14745)
@@ -29,4 +29,5 @@
 import java.awt.*;
 import java.awt.event.*;
+import java.lang.reflect.Field;
 import java.util.*;
 import javax.swing.*;
@@ -166,4 +167,27 @@
   }
   
+  public String getDefaultFormatString(String name){
+    String default_str = "";
+    try{
+      String field_name = name.toUpperCase()+"_DEFAULT_FORMAT";    
+      Field field = this.getClass().getDeclaredField(field_name);
+      Class fieldType = field.getType();
+      default_str = (String) field.get(fieldType);
+    } catch (SecurityException e) {
+      //System.err.println("Debug: "+e.getMessage());
+      default_str = VLIST_DEFAULT_FORMAT;
+    } catch (NoSuchFieldException e) {
+      //System.err.println("Debug: "+e.getMessage());
+      default_str = VLIST_DEFAULT_FORMAT;
+    } catch (IllegalArgumentException e) {
+      //System.err.println("Debug: "+e.getMessage());
+      default_str = VLIST_DEFAULT_FORMAT;
+    } catch (IllegalAccessException e) {
+      //System.err.println("Debug: "+e.getMessage());		
+      default_str = VLIST_DEFAULT_FORMAT;
+    }
+    return default_str;
+  }
+  
   /** Method to retrieve this managers controls.
    * @return the Control for this collection.
@@ -225,5 +249,5 @@
     return part_model;
   }
-  
+    
   private ArrayList buildVariableModel() {
     ArrayList variable_model = new ArrayList();
@@ -555,5 +579,5 @@
       
       public void update() {
-        
+	
         // Determine if replace should be enabled
         if(!format_list.isSelectionEmpty()) {
@@ -563,5 +587,5 @@
           if (shouldSave){
             String format_str = editor_textarea.getText().trim();
-            format_str = (format_str.equals(""))? VLIST_DEFAULT_FORMAT : format_str;
+            format_str = (format_str.equals(""))? getDefaultFormatString(format.getName()) : format_str;
             format.setValue(format_str);
             model.refresh((DOMProxyListEntry)format);
@@ -608,6 +632,11 @@
           // Step one: reset part
           if (entry.canHavePart()) {
+            // update AffectedComponents according to current entry             
+            part_model = entry.getPartModel();
+            part_combobox.setModel(new DefaultComboBoxModel(part_model.toArray()));
+            part_combobox.updateUI();            
+            
             part_combobox.setEnabled(true);
-            part_combobox.setSelectedIndex(part_combobox.getModel().getSize()-1);
+            part_combobox.setSelectedIndex(part_combobox.getModel().getSize()-1);                        
             
           } else {
@@ -718,6 +747,6 @@
             Format format = (Format)format_list.getSelectedValue();
             // Try to match the target, remembering the entries within are Entry's
-            Entry an_entry = new Entry(format.getFeature());
-            feature_combobox.setSelectedItem(an_entry);
+            Entry an_entry = new Entry(format.getFeature());            
+            feature_combobox.setSelectedItem(an_entry);            
             // If we didn't match anything, add it and select it again
             Entry result_entry = (Entry) feature_combobox.getSelectedItem();
@@ -746,4 +775,10 @@
               if (format.canHavePart()) {
                 part_combobox.setEnabled(true);
+                
+                // Should update the part list and re-render the part ComboBox here
+                part_model = result_entry.getPartModel();
+                part_combobox.setModel(new DefaultComboBoxModel(part_model.toArray()));
+                part_combobox.updateUI();      
+                
                 // Try to match the part.
                 String part_entry = format.getPart();
@@ -1081,4 +1116,27 @@
     }
     
+    public ArrayList getPartModel(){
+      DebugStream.println("getPartModel(): get appopriate affected components of this classifier");
+      String classifier_name = classifier == null ? "" : classifier.toString();
+      if(!classifier_name.equals("")){
+        classifier_name = classifier_name.substring(0, classifier_name.indexOf("-")).trim();        
+      }      
+      ArrayList part_model = new ArrayList();
+      // DateList only has DateList component
+      if(classifier_name.equals("DateList")){
+        part_model.add(new Part(DATELIST, DATELIST_DEFAULT_FORMAT));
+      } 
+      // Other Format Entries, display the default Affected Components
+      else if(classifier_name.equals("")){      
+        part_model = buildPartModel();      
+      }
+      // Other Classifiers have HList and VList as Affected Component
+      else {
+        part_model.add(new Part(HLIST, HLIST_DEFAULT_FORMAT));
+        part_model.add(new Part(VLIST, VLIST_DEFAULT_FORMAT));
+      }
+      return part_model;
+    }
+    
     public String toString() {
       if(classifier != null) {
