Search in sources :

Example 16 with IUniqueIndexLayer

use of org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer in project nebula.widgets.nattable by eclipse.

the class RowGroupExpandCollapseLayer method getHiddenRowIndexes.

@Override
public Collection<Integer> getHiddenRowIndexes() {
    Collection<Integer> hiddenRowIndexes = new HashSet<Integer>();
    IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer();
    int underlyingColumnCount = underlyingLayer.getRowCount();
    for (int i = 0; i < underlyingColumnCount; i++) {
        int rowIndex = underlyingLayer.getRowIndexByPosition(i);
        if (isRowIndexHidden(rowIndex)) {
            hiddenRowIndexes.add(Integer.valueOf(rowIndex));
        }
    }
    return hiddenRowIndexes;
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer) HashSet(java.util.HashSet)

Example 17 with IUniqueIndexLayer

use of org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer in project nebula.widgets.nattable by eclipse.

the class AbstractRowHideShowLayer method getStartYOfRowPosition.

@Override
public int getStartYOfRowPosition(int localRowPosition) {
    Integer cachedStartY = this.startYCache.get(localRowPosition);
    if (cachedStartY != null) {
        return cachedStartY;
    }
    IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer();
    int underlyingPosition = localToUnderlyingRowPosition(localRowPosition);
    if (underlyingPosition < 0) {
        return -1;
    }
    int underlyingStartY = underlyingLayer.getStartYOfRowPosition(underlyingPosition);
    if (underlyingStartY < 0) {
        return -1;
    }
    for (Integer hiddenIndex : getHiddenRowIndexes()) {
        int hiddenPosition = underlyingLayer.getRowPositionByIndex(hiddenIndex);
        // layertherefore the underlying layer should handle the positioning
        if (hiddenPosition >= 0 && hiddenPosition <= underlyingPosition) {
            underlyingStartY -= underlyingLayer.getRowHeightByPosition(hiddenPosition);
        }
    }
    this.startYCache.put(localRowPosition, underlyingStartY);
    return underlyingStartY;
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)

Aggregations

IUniqueIndexLayer (org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)17 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)4 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)3 DummyGridLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack)3 Shell (org.eclipse.swt.widgets.Shell)3 HashSet (java.util.HashSet)2 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 ColumnGroup (org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup)2 RowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand)2 HideRowPositionsEvent (org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent)2 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)2 StructuralDiff (org.eclipse.nebula.widgets.nattable.layer.event.StructuralDiff)2 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)2 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)2 Before (org.junit.Before)2 Test (org.junit.Test)2 Properties (java.util.Properties)1 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)1