|
|
Re: Default: case sensitive sort, change to case insensitive [message #1711122 is a reply to message #1711009] |
Tue, 13 October 2015 08:57 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
thats what i actually did, but whenever i remove
configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator());
sorting is fully disabled.
even though i added my custom comparators, registered labels and added a label accumulator.
so my code does this:
// Add label accumulator
ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
List<FieldInfo> infos = ds.getFieldInfoCollection().getAllWithFeaturePath();//
for (int i = 0; i < infos.size(); i++) {
FieldInfo fi = infos.get(i);
labelAccumulator.registerColumnOverrides(ds.getColumnIndexOfProperty(fi.getInternal()),
fi.getFieldType().name().toUpperCase());
System.out.println(String.format("register label %s for column %s", fi.getFieldType().name().toUpperCase(),
fi.getInternal()));
}
// Register custom comparators for each field type
FieldType[] types = FieldType.values();
for (int i = 0; i < types.length; i++) {
configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, types[i].getComparator(),
DisplayMode.NORMAL, types[i].name().toUpperCase());
System.out.println(String.format("register %s for %s", types[i].getComparator().getClass().getSimpleName(),
types[i].name().toUpperCase()));
}
here the code of my CustomSingleClickSortConfiguration (actually a copy of the SingleClickSortConfiguration, but i removed the line with default sorting.
public class CustomSingleClickSortConfiguration implements IConfiguration {
public static final String SORT_DOWN_CONFIG_TYPE = "SORT_DOWN"; //$NON-NLS-1$
public static final String SORT_UP_CONFIG_TYPE = "SORT_UP"; //$NON-NLS-1$
/** The sort sequence can be appended to this base */
public static final String SORT_SEQ_CONFIG_TYPE = "SORT_SEQ_"; //$NON-NLS-1$
private ICellPainter cellPainter;
public CustomSingleClickSortConfiguration() {
this(new BeveledBorderDecorator(new SortableHeaderTextPainter()));
}
public CustomSingleClickSortConfiguration(ICellPainter cellPainter) {
this.cellPainter = cellPainter;
}
public void configureLayer(ILayer layer) {
}
public void configureRegistry(IConfigRegistry configRegistry) {
// removed as we defined our own Comparators for each column
// configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR,
// new DefaultComparator());
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL,
SORT_DOWN_CONFIG_TYPE);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL,
SORT_UP_CONFIG_TYPE);
}
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// Register new bindings
uiBindingRegistry.registerFirstSingleClickBinding(new ColumnHeaderClickEventMatcher(SWT.NONE, 1),
new SortColumnAction(false));
uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.ALT),
new SortColumnAction(true));
}
}
and the output for registering Labels and Comparators seems fine:
Quote:
// labels
register label INTEGER for column id
register label STRING for column guid
register label STRING for column generatedName
register label STRING for column oldName
register label STRING for column salutation
register label STRING for column title
register label STRING for column firstName
register label STRING for column lastName
register label DATE for column dateBirth
register label DATE for column dateDeath
register label STRING for column profession
register label STRING for column organisation
register label STRING for column department
register label STRING for column street
register label STRING for column zip
register label STRING for column city
register label STRING for column country
register label STRING for column phoneBusiness
register label STRING for column phonePrivate
register label STRING for column phoneMobile
register label STRING for column fax
register label ACTIONEMAIL for column email
register label ACTIONURL for column WWW
register label STRING for column categories
register label TEXT for column memo
register label TEXT for column text1
register label TEXT for column text2
register label TEXT for column text3
register label TEXT for column text4
register label TEXT for column text5
register label TEXT for column text6
register label TEXT for column text7
register label TEXT for column text8
register label TEXT for column text9
register label TEXT for column text10
register label INTEGER for column integer1
register label INTEGER for column integer2
register label INTEGER for column integer3
register label INTEGER for column integer4
register label INTEGER for column integer5
register label DOUBLE for column double1
register label DOUBLE for column double2
register label DOUBLE for column double3
register label DOUBLE for column double4
register label DOUBLE for column double5
register label DATE for column calendar1
register label DATE for column calendar2
register label BOOLEAN for column boolean1
register label BOOLEAN for column boolean2
register label BOOLEAN for column boolean3
register label BOOLEAN for column boolean4
register label BOOLEAN for column boolean5
register label DATETIME for column adminCreated
register label STRING for column adminCreator
register label DATETIME for column adminEdited
register label STRING for column adminEditor
register label STRING for column adminImport1
register label STRING for column adminImport2
// comparators
register NullComparator for UNDEFINED
register BooleanComparator for BOOLEAN
register IntegerComparator for INTEGER
register DoubleComparator for DOUBLE
register NullComparator for STRING
register StringComparator for TEXT
register StringComparator for ACTIONEMAIL
register StringComparator for ACTIONURL
register DoubleComparator for COORDINATE
register IntegerComparator for SHAPETYPE
register StringComparator for LOOKUP
register StringComparator for CHECKCOMBO
register StringComparator for HIERARCHICALLOOKUP
register StringComparator for EDITLINK
register StringComparator for EDITLINKS
register StringComparator for EDITSTRATIGRAPHYBUTTON
register CalendarComparator for DATE
register CalendarComparator for TIME
register CalendarComparator for DATETIME
NOTE: i also tried to move the registration of the custom comparators to the CustomSingleClickSortConfiguration, but it had no impact on the result.
can you see what i'm doing wrong?
NOTE: FieldInfoDataSource<E> ds, as used in first code is only a helper class to retrieve the field definition information for the table.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04732 seconds