JGoView refresh


#1

I have a JGoView which sometimes gets rendered in a background thread.
I’m trying to make the impact of this background activity as minimal as possible (from a user perspective).
When I run the following code:
targetView.setDocument(targetDocument);

if (selectedStep != null) {
lastNode = (IAnalysisStepNode) nodesMap.get(new Long(selectedStep.getUniqueID()));
}
targetView.selectObject((JGoObject) lastNode);
if (lastNode != null) { //May occur on an empty tree
targetView.setViewPosition(((JGoObject) lastNode).getLocation());
}

I encounter a problem whereby the UI is updated with the new view (when targetView.setDocument() is called. It is then re-refreshed when setViewPosition is called. I’d like to disable the first refresh. Is there a way to do this?
I tried looking at the JComponent listeners, but there don’t seem to be any - is this refresh handled by the JGOViewListeners ?
I saw another post on a bug in that method, which I’m also observing and currently prevents me from disabling those listeners (temporarily)


#2

Off hand, I can’t think of a standard way of doing that in JComponents, but there may well be one.
You could implement this yourself in a JGoView subclass by overriding updateView(Rectangle) to be a no-op or to call the base method, depending on a boolean flag that you define.
Events happening to a JGoView or to its view objects are handled by JGoViewListeners; events happening to a JGoDocument or its objects are handled by a JGoDocumentListener, and JGoView implements a JGoDocumentListener (JGoView.documentChanged) in order to keep the display up-to-date with the document.


#3

OK thanks, that seems to be working. One problem that remains is synchronization with an Overview which I have set to observe the main view.
Even though the main view refresh is temporarily disabled, the overview still tries to refresh itself .
I tried adding the same logic to my overview (sub) class, but it did not make any difference - what method should I override in the overview class to prevent it from refreshing?