Skip to main content



      Home
Home » Eclipse Projects » NatTable » FixedSummaryRowLayer(The suggested order of layers)
FixedSummaryRowLayer [message #1715334] Sun, 22 November 2015 06:33 Go to next message
Eclipse UserFriend
Hello,

I would need some directions on how to set the FixedSummaryRowLayer, and hints on how the correct order of the layers should be.

I have the following body layer stack:

bodyDataLayer = new DataLayer(rowDataProvider); // rowDataProvider - custom created row provider

final HoverLayer hoverLayer = new HoverLayer(bodyDataLayer);

selectionLayer = new SelectionLayer(hoverLayer);
selectionProvider = new RowSelectionProvider<NatTreeNode>(selectionLayer, rowDataProvider, false); 

treeLayer = new TreeLayer(selectionLayer, new TreeRowModel<NatTreeNode>(rowDataProvider));
			
setUnderlyingLayer(new ViewportLayer(treeLayer));


and i would like to know where exactly should the FixedSummaryRowLayer be created. I tried multiple times, took in consideration the fact that it must be created as closer to the data layer as it can get, before any other layers that are able to transform indexes and positions are added. I even tried creating a separate data layer as suggested in another post on this forum, but no luck. Please let me know what would be the best solution.
Thank you very much!
Re: FixedSummaryRowLayer [message #1715340 is a reply to message #1715334] Sun, 22 November 2015 08:13 Go to previous messageGo to next message
Eclipse UserFriend
The FixedSummaryRowLayer needs to be put next to the body layer stack, as it should be fixed. So you need a CompositeLayer. Please have a look at the corresponding examples to see how it should look like.

[Updated on: Sun, 22 November 2015 08:14] by Moderator

Re: FixedSummaryRowLayer [message #1715398 is a reply to message #1715340] Mon, 23 November 2015 05:02 Go to previous messageGo to next message
Eclipse UserFriend
It works! Thank you very much for your answer! Very Happy
Re: FixedSummaryRowLayer [message #1723950 is a reply to message #1715340] Fri, 19 February 2016 03:30 Go to previous messageGo to next message
Eclipse UserFriend
if the table few records, it looks like this: index.php/fa/25045/0/
How can I do to FixedSummaryRowLayer remained at the bottom, like this: index.php/fa/25046/0/
  • Attachment: 1.png
    (Size: 5.86KB, Downloaded 294 times)
  • Attachment: 2.png
    (Size: 16.23KB, Downloaded 305 times)
Re: FixedSummaryRowLayer [message #1723997 is a reply to message #1723950] Fri, 19 February 2016 10:13 Go to previous messageGo to next message
Eclipse UserFriend
This is not supported
Re: FixedSummaryRowLayer [message #1724999 is a reply to message #1723997] Sun, 28 February 2016 23:24 Go to previous messageGo to next message
Eclipse UserFriend
Dirk Fauth wrote on Fri, 19 February 2016 15:13
This is not supported

Hi Dirk. What may be implementation?
Is it possible to fix the ViewportLayer?

Implemented something:
public class MyViewportLayer extends ViewportLayer {

	private NatTable natTable;
	private GridLayer gridLayer;
	private FixedSummaryRowLayer summaryRowLayer;
	
	public MyViewportLayer(IUniqueIndexLayer underlyingLayer) {
		super(underlyingLayer);
	}
	
	@Override
    public int getHeight() {
		return natTable.getClientArea().height - summaryRowLayer.getHeight() - 
				gridLayer.getColumnHeaderLayer().getHeight();
    }

      
    @Override
    public int getRowPositionByY(int y) {
        return getRowPositionByY(this, y);
    }
    
    private int getRowPositionByY(ILayer layer, int y) {
        int height = super.getHeight();
        if (y < 0) {
            return -1;
        }else if (y>=height){
        	return findRowPosition(0, 0, layer, y, height, super.getRowCount());
        }
        return findRowPosition(0, 0, layer, y, height, layer.getRowCount());
    }

    private int findRowPosition(
            int yOffset, int rowOffset, ILayer layer, int y, int totalHeight, int rowCount) {

        double size = (double) (totalHeight - yOffset) / (rowCount - rowOffset);
        int rowPosition = rowOffset + (int) ((y - yOffset) / size);

        int startY = layer.getStartYOfRowPosition(rowPosition);
        int endY = startY + layer.getRowHeightByPosition(rowPosition);
        if (y < startY) {
            if (startY == totalHeight) {
                return rowCount;
            }
            return findRowPosition(yOffset, rowOffset, layer, y, startY, rowPosition);
        }
        else if (y >= endY) {
            return findRowPosition(endY, rowPosition + 1, layer, y, totalHeight, rowCount);
        }
        else {
            return rowPosition;
        }
    }

	public NatTable getNatTable() {
		return natTable;
	}

	public void setNatTable(NatTable natTable) {
		this.natTable = natTable;
	}

	public GridLayer getGridLayer() {
		return gridLayer;
	}

	public void setGridLayer(GridLayer gridLayer) {
		this.gridLayer = gridLayer;
	}

	public FixedSummaryRowLayer getSummaryRowLayer() {
		return summaryRowLayer;
	}

	public void setSummaryRowLayer(FixedSummaryRowLayer summaryRowLayer) {
		this.summaryRowLayer = summaryRowLayer;
	}
    
}

[Updated on: Wed, 02 March 2016 23:51] by Moderator

Re: FixedSummaryRowLayer [message #1725381 is a reply to message #1724999] Thu, 03 March 2016 02:50 Go to previous message
Eclipse UserFriend
Might work but it is a dirty hack. You probably get serious issues regarding interactions.

As I said, this is not supported in NatTable because there is nothing that increases one layer in a composition to some maximum. The only thing that might work is to create two NatTable instances, one for the content and one for the summary row, connect the two viewports for scrolling and layout using a SWT layout manager.
Previous Topic:Filtering filter dropdown
Next Topic:getConfigLabelsByPosition
Goto Forum:
  


Current Time: Tue Jun 24 13:28:23 EDT 2025

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

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

Back to the top