Skip to content

Commit de11151

Browse files
Refresh quality control state only when necessary (#901)
* add modification counters refresh only once a mod count that matters changes. * Remove selected attribute change avoidance
1 parent f3d733f commit de11151

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/daemon/QualityControlAutoVetter.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
import au.gov.asd.tac.constellation.graph.schema.visual.concept.VisualConcept;
2828
import au.gov.asd.tac.constellation.plugins.PluginException;
2929
import au.gov.asd.tac.constellation.plugins.PluginExecution;
30+
import au.gov.asd.tac.constellation.plugins.PluginInfo;
3031
import au.gov.asd.tac.constellation.plugins.PluginInteraction;
32+
import au.gov.asd.tac.constellation.plugins.PluginType;
3133
import au.gov.asd.tac.constellation.plugins.parameters.PluginParameters;
3234
import au.gov.asd.tac.constellation.plugins.templates.SimpleReadPlugin;
3335
import au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent;
@@ -51,13 +53,13 @@
5153
public final class QualityControlAutoVetter implements GraphManagerListener, GraphChangeListener {
5254

5355
private static QualityControlAutoVetter INSTANCE = null;
54-
5556
private static final List<QualityControlAutoVetterListener> buttonListeners = new ArrayList<>();
5657

5758
private QualityControlState state;
5859

5960
private Graph currentGraph;
6061
private long lastGlobalModificationCounter;
62+
private long lastCameraModificationCounter;
6163

6264
private final List<QualityControlListener> listeners;
6365

@@ -152,10 +154,17 @@ public void graphChanged(final GraphChangeEvent event) {
152154
if (graph != null) {
153155
final ReadableGraph readableGraph = graph.getReadableGraph();
154156
try {
157+
final int cameraAttribute = VisualConcept.GraphAttribute.CAMERA.get(readableGraph);
158+
155159
final long thisGlobalModificationCounter = readableGraph.getGlobalModificationCounter();
160+
final long thisCameraModificationCounter = readableGraph.getValueModificationCounter(cameraAttribute);
161+
156162
if (thisGlobalModificationCounter != lastGlobalModificationCounter) {
157-
updateQualityControlState(graph);
163+
if (lastCameraModificationCounter == thisCameraModificationCounter) {
164+
updateQualityControlState(graph);
165+
}
158166
lastGlobalModificationCounter = thisGlobalModificationCounter;
167+
lastCameraModificationCounter = thisCameraModificationCounter;
159168
}
160169
} finally {
161170
readableGraph.release();
@@ -288,6 +297,7 @@ public static synchronized QualityControlAutoVetter getInstance() {
288297
return INSTANCE;
289298
}
290299

300+
@PluginInfo(pluginType = PluginType.UPDATE, tags = {"LOW LEVEL"})
291301
private static class QualityControlViewStateUpdater extends SimpleReadPlugin {
292302

293303
@Override
@@ -352,7 +362,7 @@ public void read(final GraphReadMethods graph, final PluginInteraction interacti
352362

353363
@Override
354364
public String getName() {
355-
return "Quality Control View: Save State";
365+
return "Quality Control View: Update State";
356366
}
357367
}
358368

0 commit comments

Comments
 (0)