use of org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent in project nebula.widgets.nattable by eclipse.
the class Selection_events method addCustomSelectionBehaviour.
private void addCustomSelectionBehaviour() {
this.nattable.addLayerListener(new ILayerListener() {
// Default selection behavior selects cells by default.
@Override
public void handleLayerEvent(ILayerEvent event) {
if (event instanceof CellSelectionEvent) {
CellSelectionEvent cellEvent = (CellSelectionEvent) event;
log("Selected cell: [" + cellEvent.getRowPosition() + ", " + cellEvent.getColumnPosition() + "], " + Selection_events.this.nattable.getDataValueByPosition(cellEvent.getColumnPosition(), cellEvent.getRowPosition()));
}
}
});
// Events are fired whenever selection occurs. These can be use to
// trigger
// external actions as required. Also you can use this data to pull out
// the backing data from the IRowDataProvider. Example:
// rowDataProvider.getRowObject(natTable.getRowIndexByPosition(selectedRowPosition));
this.nattable.addLayerListener(new ILayerListener() {
@Override
public void handleLayerEvent(ILayerEvent event) {
if (event instanceof RowSelectionEvent) {
RowSelectionEvent rowEvent = (RowSelectionEvent) event;
log("Selected Row: " + ObjectUtils.toString(rowEvent.getRowPositionRanges()));
}
}
});
this.nattable.addLayerListener(new ILayerListener() {
@Override
public void handleLayerEvent(ILayerEvent event) {
if (event instanceof ColumnSelectionEvent) {
ColumnSelectionEvent columnEvent = (ColumnSelectionEvent) event;
log("Selected Column: " + columnEvent.getColumnPositionRanges());
}
}
});
}
Aggregations