Search in sources :

Example 6 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class EditUtilsTest method testIsConverterSameWithMultiSelectionOneChangedConverter.

@Test
public void testIsConverterSameWithMultiSelectionOneChangedConverter() {
    this.selectionLayer.selectCell(1, 1, false, true);
    this.selectionLayer.selectCell(2, 2, false, true);
    this.selectionLayer.selectCell(3, 3, false, true);
    DataLayer bodyDataLayer = (DataLayer) this.gridLayerStack.getBodyDataLayer();
    this.natTable.registerLabelOnColumn(bodyDataLayer, 1, TEST_LABEL);
    this.natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultBooleanDisplayConverter(), DisplayMode.EDIT, TEST_LABEL);
    assertFalse(EditUtils.isConverterSame(this.selectionLayer, this.natTable.getConfigRegistry()));
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultBooleanDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter) Test(org.junit.Test)

Example 7 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class EditUtilsTest method testIsEditorSameWithMultiSelectionOneChangedEditor.

@Test
public void testIsEditorSameWithMultiSelectionOneChangedEditor() {
    this.selectionLayer.selectCell(1, 1, false, true);
    this.selectionLayer.selectCell(2, 2, false, true);
    this.selectionLayer.selectCell(3, 3, false, true);
    DataLayer bodyDataLayer = (DataLayer) this.gridLayerStack.getBodyDataLayer();
    this.natTable.registerLabelOnColumn(bodyDataLayer, 1, TEST_LABEL);
    this.natTable.getConfigRegistry().registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor(), DisplayMode.EDIT, TEST_LABEL);
    assertFalse(EditUtils.isEditorSame(this.selectionLayer, this.natTable.getConfigRegistry()));
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) CheckBoxCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor) Test(org.junit.Test)

Example 8 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class RowSelectionEditUtilsTest method testIsConverterSameWithMultiSelectionOneChangedConverter.

@Test
public void testIsConverterSameWithMultiSelectionOneChangedConverter() {
    this.selectionLayer.selectCell(1, 1, false, true);
    this.selectionLayer.selectCell(2, 2, false, true);
    this.selectionLayer.selectCell(3, 3, false, true);
    DataLayer bodyDataLayer = (DataLayer) this.gridLayerStack.getBodyDataLayer();
    this.natTable.registerLabelOnColumn(bodyDataLayer, 1, TEST_LABEL);
    this.natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultBooleanDisplayConverter(), DisplayMode.EDIT, TEST_LABEL);
    // the result is true here because using the IRowSelectionModel the
    // anchor is used to determine the cells to edit
    assertTrue(EditUtils.isConverterSame(this.selectionLayer, this.natTable.getConfigRegistry()));
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultBooleanDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter) Test(org.junit.Test)

Example 9 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class RowSelectionEditUtilsTest method testIsEditorSameWithMultiSelectionOneColumnEditorMultiSelection.

@Test
public void testIsEditorSameWithMultiSelectionOneColumnEditorMultiSelection() {
    DataLayer bodyDataLayer = (DataLayer) this.gridLayerStack.getBodyDataLayer();
    this.natTable.registerLabelOnColumn(bodyDataLayer, 1, TEST_LABEL);
    this.natTable.getConfigRegistry().registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CheckBoxCellEditor(), DisplayMode.EDIT, TEST_LABEL);
    this.selectionLayer.selectCell(1, 1, false, true);
    this.selectionLayer.selectCell(1, 2, false, true);
    this.selectionLayer.selectCell(1, 3, false, true);
    assertTrue(EditUtils.isEditorSame(this.selectionLayer, this.natTable.getConfigRegistry()));
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) CheckBoxCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor) Test(org.junit.Test)

Example 10 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.

the class RowSelectionEditUtilsTest method testIsConverterSameWithSingleSelectionOneChangedConverter.

@Test
public void testIsConverterSameWithSingleSelectionOneChangedConverter() {
    DataLayer bodyDataLayer = (DataLayer) this.gridLayerStack.getBodyDataLayer();
    this.natTable.registerLabelOnColumn(bodyDataLayer, 1, TEST_LABEL);
    this.natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultBooleanDisplayConverter(), DisplayMode.EDIT, TEST_LABEL);
    this.selectionLayer.selectCell(1, 1, false, false);
    assertTrue(EditUtils.isConverterSame(this.selectionLayer, this.natTable.getConfigRegistry()));
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultBooleanDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter) Test(org.junit.Test)

Aggregations

DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)227 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)150 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)99 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)96 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)93 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)91 HashMap (java.util.HashMap)83 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)82 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)78 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)77 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)77 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)76 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)75 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)75 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)74 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)74 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)70 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)64 Test (org.junit.Test)62 GridLayout (org.eclipse.swt.layout.GridLayout)56