Community
Participate
Working Groups
1. In Viewport class method validate() does: super.validate(); readjustScrollBars(); 2. In FreeformViewport method readjustScrollBars() is overridden and calls ff.setFreeformBounds(bounds); effectively changing contents bounds (it's bounds got changed and bounds of the nested freeform children too). 3. Method setBounds() in Figure class invalidates the figure (maybe it should revalidate it?) so contents figure is invalid and there is no request to validate it. Consequences: 1. We have invalid figures in hierarchy though update was performed; is it fine? 2. If there are normal (not freeform) figures in contents that depend on contents bounds (say stripes that partition the diagram somehow or a label that should be at the right-bottom corner of the diagram) then they won't be updated since their parent (contents figure) is not validated and layout is not performed.
At the end of performUpdate, no figure should be left in an INVALID state. Are you saying this happens in general with the use of Freeform? I'll try to reproduce in the logic example. My initial expectations are that freeform figures allow setting of their bounds without becoming invalid. That's why the setFreeformBounds API exists.
I changed DeferredUpdateManager#performUpdate() to the following implementation for debug purposes. Based on that I can easily reproduce (by resizing a Circuit within the logic example) that not all figures seem to be valid after the performUpdate() has been completed: public synchronized void performUpdate() { if (isDisposed() || updating) return; updating = true; try { performValidation(); updateQueued = false; repairDamage(); if (afterUpdate != null) { RunnableChain chain = afterUpdate; afterUpdate = null; chain.run(); // chain may queue additional Runnable. if (afterUpdate != null) queueWork(); } } finally { updating = false; } if (afterUpdate == null) { // check all figures are new valid List figuresToProcess = new ArrayList(); figuresToProcess.add(root); while (!figuresToProcess.isEmpty()) { IFigure current = (IFigure) figuresToProcess.remove(0); figuresToProcess.addAll(current.getChildren()); if (!((Figure) current).isValid()) { System.out.println("INVALID FIGURE AFTER UPDATE: " + current); } } } }