Search in sources :

Example 1 with ResizeStructuralRefreshEvent

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

the class DataLayer method doCommand.

@Override
public boolean doCommand(ILayerCommand command) {
    if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
        ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
        boolean refresh = false;
        if (isColumnPercentageSizing()) {
            this.columnWidthConfig.calculatePercentages(this.columnWidthConfig.downScale(clientAreaResizeCommand.getCalcArea().width), getColumnCount());
            refresh = true;
        }
        if (isRowPercentageSizing()) {
            this.rowHeightConfig.calculatePercentages(this.rowHeightConfig.downScale(clientAreaResizeCommand.getCalcArea().height), getRowCount());
            refresh = true;
        }
        if (refresh) {
            fireLayerEvent(new ResizeStructuralRefreshEvent(this));
        }
        return refresh;
    } else if (command instanceof StructuralRefreshCommand) {
        // that the percentage values are re-calculated
        if (isColumnPercentageSizing()) {
            this.columnWidthConfig.updatePercentageValues(getColumnCount());
        }
        if (isRowPercentageSizing()) {
            this.rowHeightConfig.updatePercentageValues(getRowCount());
        }
    }
    return super.doCommand(command);
}
Also used : StructuralRefreshCommand(org.eclipse.nebula.widgets.nattable.command.StructuralRefreshCommand) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) ResizeStructuralRefreshEvent(org.eclipse.nebula.widgets.nattable.layer.event.ResizeStructuralRefreshEvent)

Aggregations

StructuralRefreshCommand (org.eclipse.nebula.widgets.nattable.command.StructuralRefreshCommand)1 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)1 ResizeStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.ResizeStructuralRefreshEvent)1