Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Buttons not rendering
Buttons not rendering [message #1385929] Thu, 12 June 2014 10:06 Go to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
In my CreateControl class


 DefaultGridLayer gridLayer = new DefaultGridLayer (bodyDataProvider,columnHeaderDataProvider,rowHeaderDataProvider);
		DefaultBodyLayerStack bodyLayer = gridLayer.getBodyLayer(); 
		
	    // Grid
	    RiskReportCustomLabel cellLabelAccumulator = new RiskReportCustomLabel(bodyLayer);
	    bodyLayer.setConfigLabelAccumulator(cellLabelAccumulator);
	   
		NatTable natTable = new NatTable(parent, gridLayer, false);


cellLabelAccumulator assigns RiskEditable.REFRESH to a particular cell. Then I add the config

natTable.addConfiguration(natTableConfiguration);
natTable.addConfiguration(rowStyleConfiguration);
natTable.addConfiguration(selectionStyle);
natTable.addConfiguration(new CopyPasteBindings());
natTable.addConfiguration(new RiskEditorConfiguration());
natTable.configure();


RiskEditorConfiguration calls this method

private void registerRefresh(IConfigRegistry configRegistry) {
		
Style style = new Style();
style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WHITE);

		configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,	style, DisplayMode.NORMAL, RiskEditable.REFRESH);
		configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,	style, DisplayMode.SELECT, RiskEditable.REFRESH);
		configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,new ButtonCellPainter(new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(GUIHelper.getImage("preferences")))),RiskEditable.REFRESH);

}


Now the particular cell doesn't render the button at all. However, the architecture is correct (changing it to GUIHelper.COLOR_BLACK makes the cell black).

Any help on this? I've spent a lot of time trying this out.
Re: Buttons not rendering [message #1385932 is a reply to message #1385929] Thu, 12 June 2014 10:25 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Are you sure the label is added to your label stack? You can add a debug configuration which allows you to inspect a cell via right click.

natTable.addConfiguration(new DebugMenuConfiguration(natTable));
Re: Buttons not rendering [message #1385936 is a reply to message #1385932] Thu, 12 June 2014 11:14 Go to previous messageGo to next message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Yes it is, just checked.
Re: Buttons not rendering [message #1385937 is a reply to message #1385936] Thu, 12 June 2014 11:17 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Is it the first label in the stack or is there a label on top of it to which another painter is registered?

Is your code compiling? When specifying a label to which a configuration attribute is registered, you typically need to specify the DisplayMode to which it should be registered. I don't see that in your snippet.
Re: Buttons not rendering [message #1386243 is a reply to message #1385937] Mon, 16 June 2014 06:26 Go to previous message
Swapnil Basak is currently offline Swapnil BasakFriend
Messages: 12
Registered: June 2014
Junior Member
Yup that was it. Renders fine now. Thanks a lot!
Previous Topic:Listeners for scrolling
Next Topic:Zoom NatTable out
Goto Forum:
  


Current Time: Sun Dec 21 02:50:54 GMT 2014

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

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