Changeset 4855
- Timestamp:
- Mar 27, 2009, 11:11:38 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java
r4548 r4855 67 67 import net.sf.basedb.util.Enumeration; 68 68 import net.sf.basedb.util.Values; 69 import net.sf.basedb.util.formatter.Formatter; 69 70 import net.sf.basedb.util.formatter.MultiFormatter; 70 71 import net.sf.basedb.util.formatter.ToStringFormatter; … … 242 243 List<String> columns = (List<String>)job.getValues(WHICH_PROPERTIES); 243 244 String columnPrefix = (String)job.getValue(COLUMN_PREFIX); 244 245 ItemContext cc = sc.getCurrentContext(itemType, subContext); 246 245 247 // Parse the WHICH_PROPERTIES parameter. It is a list of property:title entries 246 248 List<ExportedProperty> exportedProperties = … … 249 251 boolean annotatable = itemType.getItemClass() != null && 250 252 Annotatable.class.isAssignableFrom(itemType.getItemClass()); 251 MultiFormatter formatter = new MultiFormatter(new ToStringFormatter<Object>(), true);252 formatter.registerFormatter(Date.class, FormatterFactory.getDateFormatter(sc));253 MultiFormatter defaultFormatter = new MultiFormatter(new ToStringFormatter<Object>(), true); 254 defaultFormatter.registerFormatter(Date.class, FormatterFactory.getDateFormatter(sc)); 253 255 for (String column : columns) 254 256 { 257 Formatter<?> formatter = defaultFormatter; 258 int splitAt = column.indexOf(":"); 259 if (splitAt >= 0) 260 { 261 String property = column.substring(0, splitAt); 262 // Get a registered formatter and clear it to allow GC to reclaim it later 263 Object possibleFormatter = cc.setObject("export.formatter." + property, null); 264 if (possibleFormatter instanceof Formatter) 265 { 266 formatter = (Formatter<?>)possibleFormatter; 267 } 268 } 255 269 ExportedProperty ep = ExportedProperty.parse(dc, column, columnPrefix, 256 270 annotatable, formatter, sameUnits); … … 260 274 261 275 // Get the query from the current context 262 ItemContext cc = sc.getCurrentContext(itemType, subContext);263 276 Query query = cc.getQuery(); 264 277 Set<Integer>selectedItems = cc.getSelected();
Note: See TracChangeset
for help on using the changeset viewer.