Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » configRegistry.registerConfigAttribute dont work on CompositeLayer
configRegistry.registerConfigAttribute dont work on CompositeLayer [message #1016982] Fri, 08 March 2013 13:17 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 257
Registered: July 2012
Senior Member
Hello Dirk,

I stuck again.
My table, has labels registered for every column and ICellPainter objects associated with labels.

Everything worked fine - ICellPainter were used by table.


Then I replaced the base layer in of my table through a CompositeLayer.
I wrapped the BaseLayer with it, which allready did work.

After the change the ICellPainter are no triggered any more.


Do you have an Idea what the reason could be?

Raw structure of my table:

configRegistry = new ConfigRegistry();

...
//BODYSTACK
dataProvider = getWrappedIDataProvider(filteredBodyDataProvider);
// 1.
layerCompositeAll = new CompositeLayerMine(dataProvider); //using a concrete Layer here - works. Using a CompositeLayer everything I register in configRegistry 
// 2.
columnReorderLayer = new ColumnReorderLayer(layerCompositeAll);
// 3. can disable some columns
columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
// 4. can handle selection
selectionLayer = new SelectionLayer(columnHideShowLayer);
// 5.
viewportLayer = new ViewportLayer(selectionLayer);
...


// add new Labels and CellRenderer
cellLabelAccumulator.registerColumnOverrides(columnNumber, customColumnLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellRenderer, DisplayMode.NORMAL,	customColumnLabel);


...

//NATTABLE

gridLayer = new GridLayer(bodyStack.viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer, false);
natTable = new NatTable(parent, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
Re: configRegistry.registerConfigAttribute dont work on CompositeLayer [message #1016984 is a reply to message #1016982] Fri, 08 March 2013 13:30 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1407
Registered: July 2012
Senior Member
Not sure, maybe because there is no DataLayer. Maybe the accumulator is added to the wrong layer or not interpreted by the composite layer.
Re: configRegistry.registerConfigAttribute dont work on CompositeLayer [message #1016989 is a reply to message #1016984] Fri, 08 March 2013 13:52 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 257
Registered: July 2012
Senior Member
Thnx again Dirk, as you said - the accumulator was not propagated to the childLayers by the CompositeLayer.

The following saved the day:

    /*
     * Necessary, because otherwise the labels, registered to this compositeLayer - are not
     * propagated to the child layers! As the result the cellPainters, celleditos etc. are not used.
     */
    @Override
    public void setConfigLabelAccumulator(IConfigLabelAccumulator cellLabelAccumulator) {
        super.setConfigLabelAccumulator(cellLabelAccumulator);
        this.layerNewObjectsTop.setConfigLabelAccumulator(cellLabelAccumulator);
        this.layerExistingObjectsSecond.setConfigLabelAccumulator(cellLabelAccumulator);
    }
Re: configRegistry.registerConfigAttribute dont work on CompositeLayer [message #1017251 is a reply to message #1016984] Mon, 11 March 2013 10:12 Go to previous messageGo to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
Dirk Fauth wrote on Fri, 08 March 2013 08:30
... Maybe the accumulator is added to the wrong layer or not interpreted by the composite layer.


Would you be so kind to explain which layer would be right or wrong? Which layer should be passed to the constructor of the ColumnOverrideLabelAccumulator and why? Thank you.

J
Re: configRegistry.registerConfigAttribute dont work on CompositeLayer [message #1017252 is a reply to message #1017251] Mon, 11 March 2013 10:19 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1407
Registered: July 2012
Senior Member
As you can see here http://eclipse.org/nattable/documentation.php?page=styling you typically attach the IConfigLabelAccumulator to the DataLayer.
It should be possible to attach it on any layer, but doing it like this you don't have to care about index/position transformation.
Also it is the lowermost layer in your layer composition. If any functional layer on top appends specific labels, it is ensured that the label stack is created correctly.
Previous Topic:MultiRowHideCommand
Next Topic:row resizing according to text inside
Goto Forum:
  


Current Time: Wed Nov 26 18:02:42 GMT 2014

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

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