Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] problem with the size change for DefaultRangeModel

Hi,

 

I have been working on the gef’s text sample code to enhance its functionality.  While I was working on scrolling, I have encountered a problem.  The problem is that when a user types a character at the end of a line AND at the end of the viewport (that means the viewport should ‘move’ to right so that the typed character gets displayed on the screen), I can’t scroll the viewport properly.  After some debugging, I have found that when I try to scroll the viewport, the horizontal range model still has the previous size.  I’m using FigureCanvas.scrollToX (int) to do the scrolling.  This method though, checks the size of the horizontal range model, and returns the max location of the viewport I can set.  But at this point, the range model still contains the size without the new character inserted; therefore, the viewport is always off by the new character typed.

 

Here’s how I’m implementing the scrolling.  I have created a class that implements UpdateListener.  This one gets registered to the UpdateManager and my notifyValidating does all the work (it’s exactly the same work flow as refreshing the caret).  The event gets fired in DeferredUpdateManager.validateFigures() by the call to fireValidating() method.  But the problem is that the size of the horizontal range model is updated in IFigure.validate() in DeferredUpdateManager.validateFigures() which occurs AFTER fireValidating()!

 

Since there doesn’t seem to be a way to do anything after IFigure.validate() in DeferredUpdateManager.validateFigures(), I’m stuck with this problem.  Is this a bug?  Shouldn’t the range model updated earlier?  Or is there a workaround that I could use?

 

BTW, I have fixed other scrolling and caret location problems.

 

Thanks in advance,

 

Takahiro Kato


Back to the top