Search in sources :

Example 6 with NullComparator

use of org.eclipse.nebula.widgets.nattable.config.NullComparator in project nebula.widgets.nattable by eclipse.

the class SortIntegrationTest method shouldNotSortUnsortableColumns.

@Test
public void shouldNotSortUnsortableColumns() {
    assertColumn2BeforeSort();
    // Register custom label on column 2 (index 1)
    DataLayer colHeaderDataLayer = this.gridLayerStack.getColumnHeaderDataLayer();
    this.nattable.registerLabelOnColumnHeader(colHeaderDataLayer, 1, TEST_LABEL);
    // Disable sorting on column 2 - null comparator
    this.nattable.getConfigRegistry().registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new NullComparator(), DisplayMode.NORMAL, TEST_LABEL);
    altClickColumn2Header();
    // Assert no sort icon is displayed
    List<String> labels = this.nattable.getConfigLabelsByPosition(2, 0).getLabels();
    assertEquals(2, labels.size());
    assertTrue(labels.contains("COLUMN_HEADER"));
    assertTrue(labels.contains(TEST_LABEL));
    assertColumn2BeforeSort();
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) NullComparator(org.eclipse.nebula.widgets.nattable.config.NullComparator) Test(org.junit.Test)

Aggregations

NullComparator (org.eclipse.nebula.widgets.nattable.config.NullComparator)6 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)2 ColumnOverrideLabelAccumulator (org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)2 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)2 SortedList (ca.odell.glazedlists.SortedList)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)1 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)1 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)1 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)1 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)1 Person (org.eclipse.nebula.widgets.nattable.dataset.person.Person)1 GlazedListsEventLayer (org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer)1 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)1 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)1 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)1