Skip to main content



      Home
Home » Eclipse Projects » NatTable » ColumnOverrideLabelAccumulator - addLabel for entire row to set row border
ColumnOverrideLabelAccumulator - addLabel for entire row to set row border [message #1779169] Wed, 03 January 2018 07:34 Go to next message
Eclipse UserFriend
I want to achieve visual feedback that shows row border when at least one cell in the row is selected. I try to do it by using custom ColumnOverrideLabelAccumulator in function accumulateConfigLabels
but as LabelStack there represent one cell my question is how to get LabelStack of another cells in this row to add there custom label? Or maybe it can be achieved simplier?
Re: ColumnOverrideLabelAccumulator - addLabel for entire row to set row border [message #1779203 is a reply to message #1779169] Wed, 03 January 2018 13:58 Go to previous messageGo to next message
Eclipse UserFriend
The ColumnOverrideLabelAccumulator is a special implementation intended to apply labels to all cells in a column.

I would implement a custom IConfigLabelAccumulator that has a reference to the SelectionLayer. Then register it on the SelectionLayer and check for the row position if it is selected. The SelectionLayer should provide api for this.

Maybe our getting started tutorial helps. There is an example http://www.vogella.com/tutorials/NatTable/article.html

Also in our examples app there should be an example for this.
Re: ColumnOverrideLabelAccumulator - addLabel for entire row to set row border [message #1779324 is a reply to message #1779203] Fri, 05 January 2018 06:49 Go to previous message
Eclipse UserFriend
Ok done. For those who are looking for solution:
1. add custom ColumnOverrideLabelAccumulator with code like this:
@Override
	public void accumulateConfigLabels(LabelStack pConfigLabels, int pColumnPosition, int pRowPosition) {
		super.accumulateConfigLabels(pConfigLabels, pColumnPosition, pRowPosition);
		if(_table.getGridLayer().getBaseBodyLayer().getSelectionLayer().isRowPositionSelected(pRowPosition))
			pConfigLabels.addLabel("TEST");
	}


and add custom theme based on "TEST" - label something in Your custom implementation of AbstractRegistryConfiguration, like this:
Style lCellStyle = new Style();
lCellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, new Color(Display.getCurrent(), 100, 100, 100));
pConfigRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, lCellStyle, DisplayMode.NORMAL, "TEST");
Previous Topic:Reset to original order (PopupMenuBuilder)
Next Topic:Layer type to stack type mapping
Goto Forum:
  


Current Time: Sun Jul 20 18:48:09 EDT 2025

Powered by FUDForum. Page generated in 0.25338 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top