Search in sources :

Example 6 with IUniqueIndexLayer

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

the class FreezeLayer method getStartXOfColumnPosition.

@Override
public int getStartXOfColumnPosition(int columnPosition) {
    if (columnPosition < 0 || columnPosition >= getColumnCount()) {
        return -1;
    }
    IUniqueIndexLayer underlyingLayer = getUnderlyingLayer();
    final int underlyingColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, underlyingLayer);
    if (underlyingColumnPosition < 0) {
        return -1;
    }
    return underlyingLayer.getStartXOfColumnPosition(underlyingColumnPosition) - underlyingLayer.getStartXOfColumnPosition(this.topLeftPosition.columnPosition);
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)

Example 7 with IUniqueIndexLayer

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

the class FreezeLayer method getRowPositionByY.

@Override
public int getRowPositionByY(int y) {
    IUniqueIndexLayer underlyingLayer = getUnderlyingLayer();
    int yOffset = underlyingLayer.getStartYOfRowPosition(this.topLeftPosition.rowPosition);
    return underlyingToLocalRowPosition(underlyingLayer, underlyingLayer.getRowPositionByY(yOffset + y));
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)

Example 8 with IUniqueIndexLayer

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

the class FreezeLayer method getColumnPositionByX.

@Override
public int getColumnPositionByX(int x) {
    IUniqueIndexLayer underlyingLayer = getUnderlyingLayer();
    int xOffset = underlyingLayer.getStartXOfColumnPosition(this.topLeftPosition.columnPosition);
    return underlyingToLocalColumnPosition(underlyingLayer, underlyingLayer.getColumnPositionByX(xOffset + x));
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)

Example 9 with IUniqueIndexLayer

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

the class FreezeLayer method getStartYOfRowPosition.

@Override
public int getStartYOfRowPosition(int rowPosition) {
    if (rowPosition < 0 || rowPosition >= getRowCount()) {
        return -1;
    }
    IUniqueIndexLayer underlyingLayer = getUnderlyingLayer();
    final int underlyingRowPosition = LayerUtil.convertRowPosition(this, rowPosition, underlyingLayer);
    if (underlyingRowPosition < 0) {
        return -1;
    }
    return underlyingLayer.getStartYOfRowPosition(underlyingRowPosition) - underlyingLayer.getStartYOfRowPosition(this.topLeftPosition.rowPosition);
}
Also used : IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)

Example 10 with IUniqueIndexLayer

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

the class RowGroupExpandCollapseLayer method isRowIndexHidden.

// Expand/collapse
@Override
public boolean isRowIndexHidden(int rowIndex) {
    // This can happen if a row has just been removed.
    if (rowIndex >= this.model.getDataProvider().getRowCount()) {
        return true;
    }
    IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer();
    boolean isHiddeninUnderlyingLayer = RowGroupUtils.isRowIndexHiddenInUnderLyingLayer(rowIndex, this, underlyingLayer);
    // Get the row and the group from our cache and model.
    final T row = this.model.getRowFromIndexCache(rowIndex);
    IRowGroup<T> rowGroup = this.model.getRowGroupForRow(row);
    if (rowGroup == null) {
        return false;
    }
    boolean isCollapsedAndNotStaticRow = RowGroupUtils.isCollapsed(this.model, rowGroup) && !rowGroup.getOwnStaticMemberRows().contains(row);
    return isHiddeninUnderlyingLayer || isCollapsedAndNotStaticRow;
}
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