use of org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent in project nebula.widgets.nattable by eclipse.
the class DataChangeLayer method discardDataChanges.
/**
* Discards the tracked data changes. In case temporary data storage is
* disabled, the applied changes are undone by restoring the previous values
* via dedicated {@link UpdateDataCommand}s.
*/
public void discardDataChanges() {
if (!this.temporaryDataStorage) {
// avoid handling of DataUpdateEvents that are caused by restoring
// the previous data states
this.handleDataUpdateEvents = false;
// old values
for (Map.Entry<Object, UpdateDataCommand> entry : this.dataChanges.entrySet()) {
getUnderlyingLayer().doCommand(getUpdateDataCommand(entry.getKey(), entry.getValue()));
}
this.handleDataUpdateEvents = true;
}
clearDataChanges();
fireLayerEvent(new VisualRefreshEvent(this));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent in project nebula.widgets.nattable by eclipse.
the class DataChangeLayer method saveDataChanges.
/**
* Saves the tracked data changes. In case temporary data storage is enabled
* this means the underlying data model is updated. Otherwise the stored
* data changes are simply cleared.
* <p>
* <b>Note:</b> In case temporary data storage is disabled and a custom save
* operation should be performed on save, a custom
* {@link SaveDataChangesCommandHandler} should be registered that first
* performs a custom action and afterwards calls this method to ensure a
* clear state in this layer.
* </p>
*/
public void saveDataChanges() {
if (this.temporaryDataStorage) {
for (Map.Entry<Object, UpdateDataCommand> entry : this.dataChanges.entrySet()) {
getUnderlyingLayer().doCommand(getUpdateDataCommand(entry.getKey(), entry.getValue()));
}
}
clearDataChanges();
fireLayerEvent(new VisualRefreshEvent(this));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent in project nebula.widgets.nattable by eclipse.
the class ClearClipboardAction method run.
@Override
public void run(NatTable natTable, KeyEvent event) {
this.clipboard.clear();
natTable.fireLayerEvent(new VisualRefreshEvent(natTable));
}
use of org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent in project nebula.widgets.nattable by eclipse.
the class DisableFormulaEvaluationCommandHandler method doCommand.
@Override
public boolean doCommand(ILayer targetLayer, DisableFormulaEvaluationCommand command) {
this.formulaDataProvider.setFormulaEvaluationEnabled(false);
targetLayer.fireLayerEvent(new VisualRefreshEvent(targetLayer));
return true;
}
use of org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent in project nebula.widgets.nattable by eclipse.
the class DisplayColumnStyleEditorCommandHandler method doCommand.
@Override
public boolean doCommand(DisplayColumnStyleEditorCommand command) {
int columnIndexOfClick = command.getNattableLayer().getColumnIndexByPosition(command.columnPosition);
LabelStack configLabels = new LabelStack();
this.columnLabelAccumulator.accumulateConfigLabels(configLabels, columnIndexOfClick, 0);
configLabels.addLabel(getConfigLabel(columnIndexOfClick));
// Column style
Style clickedCellStyle = (Style) this.configRegistry.getConfigAttribute(CELL_STYLE, NORMAL, configLabels.getLabels());
this.dialog = new ColumnStyleEditorDialog(Display.getCurrent().getActiveShell(), clickedCellStyle);
this.dialog.open();
if (this.dialog.isCancelPressed()) {
return true;
}
int[] selectedColumns = getSelectedColumnIndeces();
if (selectedColumns.length > 0) {
applySelectedStyleToColumns(command, selectedColumns);
// fire refresh event
this.selectionLayer.fireLayerEvent(new ColumnVisualUpdateEvent(this.selectionLayer, this.selectionLayer.getSelectedColumnPositions()));
} else {
applySelectedStyle();
// fire refresh event
this.selectionLayer.fireLayerEvent(new VisualRefreshEvent(this.selectionLayer));
}
return true;
}
Aggregations