use of net.sourceforge.nattable.coordinate.IndexCoordinate in project translationstudio8 by heartsome.
the class BlinkLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
if (!blinkingEnabled) {
return getUnderlyingLayer().getConfigLabelsByPosition(columnPosition, rowPosition);
}
int rowIndex = getUnderlyingLayer().getRowIndexByPosition(rowPosition);
int columnIndex = getUnderlyingLayer().getColumnIndexByPosition(columnPosition);
String rowId = rowIdAccessor.getRowId(rowDataProvider.getRowObject(rowIndex)).toString();
String key = updateEventsCache.getKey(columnIndex, rowId);
LabelStack underlyingLabelStack = getUnderlyingLayer().getConfigLabelsByPosition(columnPosition, rowPosition);
IndexCoordinate coordinate = new IndexCoordinate(columnIndex, rowIndex);
// Cell has been updated
if (updateEventsCache.isUpdated(key)) {
PropertyUpdateEvent<T> event = updateEventsCache.getEvent(key);
// Old update in middle of a blink - cancel it
if (blinkingUpdates.containsKey(key)) {
blinkingTasks.get(key).cancel();
getStopBlinkTimer().purge();
blinkingTasks.remove(key);
blinkingUpdates.remove(key);
}
LabelStack blinkingConfigTypes = resolveConfigTypes(event.getOldValue(), event.getNewValue(), coordinate, getUnderlyingLayer());
// start blinking cell
if (blinkingConfigTypes != null) {
TimerTask stopBlinkTask = getStopBlinkTask(key, this);
blinkingUpdates.put(key, event);
blinkingTasks.put(key, stopBlinkTask);
updateEventsCache.remove(key);
getStopBlinkTimer().schedule(stopBlinkTask, blinkDurationInMilis);
return blinkingConfigTypes;
} else {
return new LabelStack();
}
}
// Previous blink timer is still running
if (blinkingUpdates.containsKey(key)) {
PropertyUpdateEvent<T> event = blinkingUpdates.get(key);
return resolveConfigTypes(event.getOldValue(), event.getNewValue(), coordinate, getUnderlyingLayer());
}
return underlyingLabelStack;
}
Aggregations