Bug 78717 - Contents figure of FreeformViewport is not always validated
Summary: Contents figure of FreeformViewport is not always validated
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-16 07:42 EST by Dmitry Stadnik CLA
Modified: 2011-09-28 15:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Stadnik CLA 2004-11-16 07:42:26 EST
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.
Comment 1 Randy Hudson CLA 2004-11-16 11:57:12 EST
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.
Comment 2 Alexander Nyßen CLA 2011-09-28 15:48:27 EDT
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);
				}
			}
		}
	}