Changeset 12842


Ignore:
Timestamp:
2006-09-25T12:06:37+12:00 (18 years ago)
Author:
kjdon
Message:

Ian hated having a blank format list, so have added back in the default formats. SearchTypes and DateList only added if needed. Made the FeatureListener update the editor properly

File:
1 edited

Legend:

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

    r12828 r12842  
    105105    }
    106106         
    107 //          // Ensure the default formats for DateList, HList and VList are assigned
    108 //  if (getFormat(DATELIST) == null) {
    109 //             addFormat(new Format("",DATELIST,DATELIST_DEFAULT_FORMAT));       
    110 //  }
    111 
    112    
    113 //  if (getFormat(HLIST) == null) {
    114 //      addFormat(new Format("",HLIST,HLIST_DEFAULT_FORMAT));               
    115 //  }
    116 
    117      
    118 //  if (getFormat(VLIST) == null) {
    119 //      addFormat(new Format("",VLIST,VLIST_DEFAULT_FORMAT));           
    120 //  }
    121    
    122 
    123 //  if (getFormat(DOCUMENTHEADING) == null) {
    124 //      addFormat(new Format(DOCUMENTHEADING, "", DOCUMENTHEADING_DEFAULT_FORMAT));
    125 //          }
    126 
    127  
    128 //  if (getFormat(DOCUMENTTEXT)== null) {
    129 //      addFormat(new Format(DOCUMENTTEXT,"",DOCUMENTTEXT_DEFAULT_FORMAT));
    130 //      }
    131    
    132    
    133 
    134 //  if (getFormat(DOCUMENTBUTTONS) == null) {
    135 //      addFormat(new Format(DOCUMENTBUTTONS,"",DOCUMENTBUTTONS_DEFAULT_FORMAT));
    136        
    137 //  }
    138    
    139 //  // only for mgpp and lucene colls - change!
    140 //  if (getFormat(SEARCHTYPES)==null) {
    141 //      addFormat(new Format(SEARCHTYPES, "", SEARCHTYPES_DEFAULT_FORMAT));
    142 //  }
    143    
     107    // Ensure the default formats for important format statements are assigned
     108    if (getFormat(VLIST) == null) {
     109        addFormat(new Format("",VLIST,VLIST_DEFAULT_FORMAT));           
     110    }
     111    if (getFormat(HLIST) == null) {
     112        addFormat(new Format("",HLIST,HLIST_DEFAULT_FORMAT));
     113    }
     114    // only if DateList is used
     115    if (getFormat(DATELIST) == null && CollectionDesignManager.classifier_manager.isDateListClassifierAssigned()) {
     116        addFormat(new Format("",DATELIST,DATELIST_DEFAULT_FORMAT));       
     117    }
     118    if (getFormat(DOCUMENTHEADING) == null) {
     119        addFormat(new Format(DOCUMENTHEADING, "", DOCUMENTHEADING_DEFAULT_FORMAT));
     120        }
     121    if (getFormat(DOCUMENTTEXT)== null) {
     122        addFormat(new Format(DOCUMENTTEXT,"",DOCUMENTTEXT_DEFAULT_FORMAT));
     123    }
     124    if (getFormat(DOCUMENTBUTTONS) == null) {
     125        addFormat(new Format(DOCUMENTBUTTONS,"",DOCUMENTBUTTONS_DEFAULT_FORMAT));
     126    }
     127    // only for mgpp and lucene colls
     128    if (getFormat(SEARCHTYPES)==null && (CollectionDesignManager.index_manager.isMGPP()) || CollectionDesignManager.index_manager.isLucene()) {
     129        addFormat(new Format(SEARCHTYPES, "", SEARCHTYPES_DEFAULT_FORMAT));
     130    }
     131
     132
    144133    }
    145134
     
    689678                // Initial value
    690679
    691                 editor_textarea.setText((String) default_format_map.get(f.toString()));
     680                String feature_default_format = (String) default_format_map.get(f.toString());
     681                if (feature_default_format != null) {
     682                   
     683                    editor_textarea.setText(feature_default_format);
     684                }
     685                else {
     686                    editor_textarea.setText(part.getDefaultFormat());
     687                }
    692688                                editor_textarea.setCaretPosition(0);
    693689                       
Note: See TracChangeset for help on using the changeset viewer.