Editor/display changes
This commit is contained in:
parent
9c20d58678
commit
35102cbcc3
@ -32,7 +32,10 @@ public class CalculatorHistoryImpl implements CalculatorHistory {
|
|||||||
private final List<CalculatorHistoryState> savedHistory = new ArrayList<CalculatorHistoryState>();
|
private final List<CalculatorHistoryState> savedHistory = new ArrayList<CalculatorHistoryState>();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private volatile CalculatorEventData lastEventDataId = CalculatorUtils.createFirstEventDataId();
|
private volatile CalculatorEventData lastEventData = CalculatorUtils.createFirstEventDataId();
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final Object lastEventDataLock = new Object();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private volatile CalculatorEditorViewState lastEditorViewState;
|
private volatile CalculatorEditorViewState lastEditorViewState;
|
||||||
@ -182,11 +185,26 @@ public class CalculatorHistoryImpl implements CalculatorHistory {
|
|||||||
@Nullable Object data) {
|
@Nullable Object data) {
|
||||||
if (calculatorEventType.isOfType(editor_state_changed, display_state_changed, manual_calculation_requested)) {
|
if (calculatorEventType.isOfType(editor_state_changed, display_state_changed, manual_calculation_requested)) {
|
||||||
|
|
||||||
if (calculatorEventData.isAfter(this.lastEventDataId)) {
|
boolean sameSequence = false;
|
||||||
final boolean sameSequence = calculatorEventData.isSameSequence(this.lastEventDataId);
|
boolean afterSequence = false;
|
||||||
|
|
||||||
if (sameSequence || calculatorEventData.isAfterSequence(this.lastEventDataId)) {
|
boolean processEvent = false;
|
||||||
this.lastEventDataId = calculatorEventData;
|
|
||||||
|
synchronized (this.lastEventDataLock) {
|
||||||
|
if (calculatorEventData.isAfter(this.lastEventData)) {
|
||||||
|
|
||||||
|
sameSequence = calculatorEventData.isSameSequence(this.lastEventData);
|
||||||
|
if (!sameSequence) {
|
||||||
|
afterSequence = calculatorEventData.isAfterSequence(this.lastEventData);
|
||||||
|
processEvent = afterSequence;
|
||||||
|
} else {
|
||||||
|
processEvent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (processEvent) {
|
||||||
|
this.lastEventData = calculatorEventData;
|
||||||
|
|
||||||
switch (calculatorEventType) {
|
switch (calculatorEventType) {
|
||||||
case manual_calculation_requested:
|
case manual_calculation_requested:
|
||||||
@ -212,5 +230,4 @@ public class CalculatorHistoryImpl implements CalculatorHistory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user