use of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration in project nebula.widgets.nattable by eclipse.
the class SortIntegrationTest method setup.
@Before
public void setup() {
EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList().subList(0, 4));
ConfigRegistry configRegistry = new ConfigRegistry();
this.gridLayerStack = new GlazedListsGridLayer<RowDataFixture>(GlazedLists.threadSafeList(eventList), RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap(), configRegistry);
this.nattable = new NatTableFixture(this.gridLayerStack, false);
this.nattable.setConfigRegistry(configRegistry);
this.nattable.addConfiguration(new DefaultNatTableStyleConfiguration());
this.nattable.addConfiguration(new DefaultSortConfiguration());
this.nattable.configure();
}
use of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration in project nebula.widgets.nattable by eclipse.
the class DefaultGlazedListsStaticFilterStrategyTest method init.
@BeforeClass
public static void init() {
// initialize the collection with a big amount of values
filterList = new FilterList<>(GlazedLists.eventList(PersonService.getFixedPersons()));
for (int i = 1; i < 1000; i++) {
filterList.addAll(PersonService.getFixedPersons());
}
configRegistry = new ConfigRegistry();
new DefaultNatTableStyleConfiguration().configureRegistry(configRegistry);
new DefaultFilterRowConfiguration().configureRegistry(configRegistry);
columnHeaderLayer = new DataLayerFixture(5, 2, 100, 50);
filterStrategy = new DefaultGlazedListsStaticFilterStrategy<>(filterList, new ReflectiveColumnPropertyAccessor<Person>(personPropertyNames), configRegistry);
dataProvider = new FilterRowDataProvider<>(filterStrategy, columnHeaderLayer, columnHeaderLayer.getDataProvider(), configRegistry);
}
use of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration in project nebula.widgets.nattable by eclipse.
the class FilterRowDataProviderTest method setup.
@Before
public void setup() {
this.columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50);
this.configRegistry = new ConfigRegistry();
new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
new DefaultFilterRowConfiguration().configureRegistry(this.configRegistry);
this.filterList = new FilterList<>(GlazedLists.eventList(RowDataListFixture.getList()));
this.dataProvider = new FilterRowDataProvider<>(new DefaultGlazedListsFilterStrategy<>(this.filterList, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()), this.configRegistry), this.columnHeaderLayer, this.columnHeaderLayer.getDataProvider(), this.configRegistry);
}
use of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration in project tdq-studio-se by Talend.
the class DataSampleTable method createTableControl.
/**
* create the NatTable according to the property, and list of data to display
*
* @param parent
* @param data
* @return
*/
public TControl createTableControl(Composite parent, List<Object[]> data) {
bodyDataProvider = setupBodyDataProvider(data);
bodyLayer = new BodyLayerStack(bodyDataProvider);
DefaultColumnHeaderDataProvider colHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabels);
ColumnHeaderLayerStack columnHeaderLayer = new ColumnHeaderLayerStack(colHeaderDataProvider);
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
RowHeaderLayerStack rowHeaderLayer = new RowHeaderLayerStack(rowHeaderDataProvider);
DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(colHeaderDataProvider, rowHeaderDataProvider);
CornerLayer cornerLayer = new CornerLayer(new DataLayer(cornerDataProvider), rowHeaderLayer, columnHeaderLayer);
GridLayer gridLayer = new GridLayer(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
if (natTable != null) {
clearTable();
}
natTable = new NatTable(parent, NatTable.DEFAULT_STYLE_OPTIONS | SWT.BORDER, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
{
// use the own painter to paint the group color
cellPainter = new RowBackgroundGroupPainter(new ForegroundTextPainter(false, false, false));
}
});
natTable.configure();
setNatTableFont(natTable);
natTable.getConfigRegistry().registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, // $NON-NLS-1$
"ODD_BODY");
natTable.getConfigRegistry().registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, // $NON-NLS-1$
"EVEN_BODY");
natTable.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
// add the listener for the column header selection
addCustomSelectionBehaviour();
TControl retObj = new TControl();
retObj.setControl(natTable);
// the width = (columnCount * DEFAULT_COLUMN_WIDTH) + 60, 60 is the width of first sequence number column
retObj.setWidth(colHeaderDataProvider.getColumnCount() * DataLayer.DEFAULT_COLUMN_WIDTH + 60);
return retObj;
}
use of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration in project nebula.widgets.nattable by eclipse.
the class _002_Using_a_custom_cell_painter method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// Setup the layer stack
final MyDataProvider myDataProvider = new MyDataProvider();
SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(myDataProvider));
ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new DummyColumnHeaderDataProvider(myDataProvider)), selectionLayer, selectionLayer);
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, selectionLayer, 0, 1);
NatTable natTable = new NatTable(parent, compositeLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// Add our custom painting configuration
natTable.addConfiguration(new CustomPaintingConfig());
natTable.configure();
return natTable;
}
Aggregations