Search in sources :

Example 1 with LabelStack

use of net.sourceforge.nattable.layer.LabelStack in project translationstudio8 by heartsome.

the class EditUtils method isEditorSame.

public static boolean isEditorSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry, ICellEditor lastSelectedCellEditor) {
    PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells();
    boolean isAllSelectedCellsHaveSameEditor = true;
    for (PositionCoordinate selectedCell : selectedCells) {
        LabelStack labelStack = selectionLayer.getConfigLabelsByPosition(selectedCell.columnPosition, selectedCell.rowPosition);
        ICellEditor cellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, labelStack.getLabels());
        if (cellEditor != lastSelectedCellEditor) {
            isAllSelectedCellsHaveSameEditor = false;
        }
    }
    return isAllSelectedCellsHaveSameEditor;
}
Also used : LabelStack(net.sourceforge.nattable.layer.LabelStack) PositionCoordinate(net.sourceforge.nattable.coordinate.PositionCoordinate) ICellEditor(net.sourceforge.nattable.edit.editor.ICellEditor)

Example 2 with LabelStack

use of net.sourceforge.nattable.layer.LabelStack in project translationstudio8 by heartsome.

the class CellLabelMouseEventMatcher method matches.

@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
    NatEventData eventData = NatEventData.createInstanceFromEvent(event);
    LabelStack customLabels = natTable.getConfigLabelsByPosition(eventData.getColumnPosition(), eventData.getRowPosition());
    return super.matches(natTable, event, regionLabels) && customLabels.getLabels().contains(labelToMatch);
}
Also used : LabelStack(net.sourceforge.nattable.layer.LabelStack) NatEventData(net.sourceforge.nattable.ui.NatEventData)

Example 3 with LabelStack

use of net.sourceforge.nattable.layer.LabelStack in project translationstudio8 by heartsome.

the class EditUtils method allCellsEditable.

public static boolean allCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry) {
    PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells();
    for (PositionCoordinate cell : selectedCells) {
        LabelStack labelStack = selectionLayer.getConfigLabelsByPosition(cell.columnPosition, cell.rowPosition);
        IEditableRule editableRule = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, labelStack.getLabels());
        int columnIndex = selectionLayer.getColumnIndexByPosition(cell.columnPosition);
        int rowIndex = selectionLayer.getRowIndexByPosition(cell.rowPosition);
        if (!editableRule.isEditable(columnIndex, rowIndex)) {
            return false;
        }
    }
    return true;
}
Also used : LabelStack(net.sourceforge.nattable.layer.LabelStack) IEditableRule(net.sourceforge.nattable.config.IEditableRule) PositionCoordinate(net.sourceforge.nattable.coordinate.PositionCoordinate)

Example 4 with LabelStack

use of net.sourceforge.nattable.layer.LabelStack in project translationstudio8 by heartsome.

the class RowHeaderLayer method getConfigLabelsByPosition.

@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
    LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition);
    final int selectionLayerRowPosition = LayerUtil.convertRowPosition(this, rowPosition, selectionLayer);
    if (selectionLayer.isRowFullySelected(selectionLayerRowPosition)) {
        labelStack.addLabel(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
    }
    return labelStack;
}
Also used : LabelStack(net.sourceforge.nattable.layer.LabelStack)

Example 5 with LabelStack

use of net.sourceforge.nattable.layer.LabelStack in project translationstudio8 by heartsome.

the class ColumnHeaderLayer method getConfigLabelsByPosition.

@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
    LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition);
    final int selectionLayerColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, selectionLayer);
    if (selectionLayer.isColumnFullySelected(selectionLayerColumnPosition)) {
        labelStack.addLabel(SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE);
    }
    return labelStack;
}
Also used : LabelStack(net.sourceforge.nattable.layer.LabelStack)

Aggregations

LabelStack (net.sourceforge.nattable.layer.LabelStack)9 PositionCoordinate (net.sourceforge.nattable.coordinate.PositionCoordinate)2 TimerTask (java.util.TimerTask)1 IEditableRule (net.sourceforge.nattable.config.IEditableRule)1 IndexCoordinate (net.sourceforge.nattable.coordinate.IndexCoordinate)1 ICellEditor (net.sourceforge.nattable.edit.editor.ICellEditor)1 RowUpdateEvent (net.sourceforge.nattable.layer.event.RowUpdateEvent)1 NatEventData (net.sourceforge.nattable.ui.NatEventData)1