- private boolean rangeModified = false;
-
- @Override
- public void onChanged() {
- try {
- UndoContext undoContext = undoRedoSupport.getUndoContext(session);
- int ucount = undoContext.getAll().size();
- int rcount = undoContext.getRedoList().size();
- if (DEBUG) System.out.println("Previous U:" + undoOpCount +" R:" + redoOpCount +" Current U:"+ucount+" R:"+rcount);
- if (ucount < undoOpCount) {
- runUndo = true;
- } else {
- runUndo = false;
- }
- if (!runUndo && rcount > 0)
- runRedo = true;
- else
- runRedo = false;
- undoOpCount = ucount;
- redoOpCount = rcount;
-
- if (DEBUG) System.out.println("Undo " + runUndo + " Redo " + runRedo);
- } catch (DatabaseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void updateRenderObjectsFor(E node) {
- List<vtkProp> toDelete = new ArrayList<vtkProp>();
- view.lock();
- for (vtkProp prop : nodeToActor.getValues((E)node)) {
- if (prop.GetVTKId() != 0) {
- view.getRenderer().RemoveActor(prop);
- //prop.Delete();
- toDelete.add(prop);
- }
- actorToNode.remove(prop);
- }
- view.unlock();
- nodeToActor.remove((E)node);
- Collection<vtkProp> coll = getActors((E)node);
- if (coll != null) {
- for (vtkProp prop : coll) {
- nodeToActor.add((E)node,prop);
- actorToNode.put(prop, (E)node);
- toDelete.remove(prop);
- }
- }
- for (vtkProp p : toDelete)
- p.Delete();
- }
-
- protected abstract Collection<vtkProp> getActors(E node);
-
- @SuppressWarnings("unchecked")
- private void receiveAdd(E node, String id, boolean db) {
- if (DEBUG) System.out.println("receiveAdd " + debugString(node) + " " + id + " " + db);
- synchronized (syncMutex) {
- for (Pair<E, String> n : added) {
- if (n.first.equals(node))
- return;
- }
- if (changeTracking) {
- mapping.rangeModified((E)node.getParent());
- }
- added.add(new Pair<E, String>(node, id));
- rangeModified = true;
- }
- view.refresh();
- }
-
- @SuppressWarnings("unchecked")
- private void receiveRemove(E node, String id, boolean db) {
- if (DEBUG) System.out.println("receiveRemove " + debugString(node) + " " + id + " " + db);
- synchronized (syncMutex) {
- for (Pair<E, String> n : removed) {
- if (n.first.equals(node))
- return;
- }
- if (changeTracking && !db)
- mapping.rangeModified((E)node.getParent());
- removed.add(new Pair<E, String>(node, id));
- rangeModified = true;
- }
- repaint();
- }
-
- @SuppressWarnings("unchecked")
- private void receiveUpdate(E node, String id, boolean db) {
- if (DEBUG) System.out.println("receiveUpdate " + debugString(node) + " " + id + " " + db);
- synchronized (syncMutex) {
+ private List<Pair<E,String>> added = new ArrayList<Pair<E,String>>();
+ private List<Pair<E,String>> removed = new ArrayList<Pair<E,String>>();
+ private MapSet<E, String> updated = new MapSet.Hash<E, String>();
+
+ private boolean rangeModified = false;
+
+ public boolean isRangeModified() {
+ return rangeModified;
+ }
+
+ @Override
+ public void onChanged() {
+ try {
+ UndoContext undoContext = undoRedoSupport.getUndoContext(session);
+ int ucount = undoContext.getAll().size();
+ int rcount = undoContext.getRedoList().size();
+ if (DEBUG) System.out.println("Previous U:" + undoOpCount +" R:" + redoOpCount +" Current U:"+ucount+" R:"+rcount);
+ if (ucount < undoOpCount) {
+ runUndo = true;
+ } else {
+ runUndo = false;
+ }
+ if (!runUndo && rcount > 0)
+ runRedo = true;
+ else
+ runRedo = false;
+ undoOpCount = ucount;
+ redoOpCount = rcount;
+
+ if (DEBUG) System.out.println("Undo " + runUndo + " Redo " + runRedo);
+ } catch (DatabaseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+
+ @Override
+ public void updateRenderObjectsFor(E node) {
+ List<vtkProp> toDelete = new ArrayList<vtkProp>();
+ view.lock();
+ for (vtkProp prop : nodeToActor.getValues(node)) {
+ if (prop.GetVTKId() != 0) {
+ view.getRenderer().RemoveActor(prop);
+ //prop.Delete();
+ toDelete.add(prop);
+ }
+ actorToNode.remove(prop);
+ }
+ view.unlock();
+ nodeToActor.remove(node);
+ Collection<vtkProp> coll = getActors(node);
+ if (coll != null) {
+ for (vtkProp prop : coll) {
+ nodeToActor.add(node,prop);
+ actorToNode.put(prop, node);
+ toDelete.remove(prop);
+ }
+ }
+ for (vtkProp p : toDelete)
+ p.Delete();
+ }
+
+ protected abstract Collection<vtkProp> getActors(E node);
+
+ @SuppressWarnings("unchecked")
+ private void receiveAdd(E node, String id, boolean db) {
+ if (DEBUG) System.out.println("receiveAdd " + debugString(node) + " " + id + " " + db);
+ synchronized (syncMutex) {
+ for (Pair<E, String> n : added) {
+ if (n.first.equals(node))
+ return;
+ }
+ if (changeTracking) {
+ mapping.rangeModified((E)node.getParent());
+ mapping.rangeModified((E)node);
+ }
+ added.add(new Pair<E, String>(node, id));
+ rangeModified = true;
+ }
+ repaint();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void receiveRemove(E node, String id, boolean db) {
+ if (DEBUG) System.out.println("receiveRemove " + debugString(node) + " " + id + " " + db);
+ synchronized (syncMutex) {
+ for (Pair<E, String> n : removed) {
+ if (n.first.equals(node))
+ return;
+ }
+ if (changeTracking && !db) {
+ mapping.rangeModified((E)node);
+ mapping.rangeModified((E)node.getParent());
+ }
+ removed.add(new Pair<E, String>(node, id));
+ rangeModified = true;
+ }
+ repaint();
+ }
+
+ private void receiveUpdate(E node, String id, boolean db) {
+ if (DEBUG) System.out.println("receiveUpdate " + debugString(node) + " " + id + " " + db);
+ synchronized (syncMutex) {