Synchronized scrolling between two scrollable objects (i.e. panels). . .

I’m new at using Vaadin, so please be gentle. :wink:

Currently, I’m working on ‘wizard’ that guides the user through a process. At one point, I’d like to present two XML documents inside to scrollable panels laid out side by side horizontally. If the user scrolls vertically or horizontally in either panel, the other will scroll to the same positions. This is to assist them with comparison operations. I’m sure most of you have seen this in Eclipse.

Is there a way for me to mimic this behavior in Vaadin? First and foremost, I can’t seem to find some form of a scroll listener. Also, FocusableScrollPanel seems to be an object that would be of good use for this exercise as it appears to give the most control for setting scroll positions for both orientations.

Any insight, tips and/or tricks would be appreciated.

Hopefully, I’ll be able to return the favor one day as I get more acquainted with the big ‘V’.



Don’t think that you can do ‘doubled’ scrolling without creating an own component, and that is the more advanced part of ‘the big V’ :slight_smile: What you can do is have one common scroller for those both. It won’t sync row lines like eclipse diff does and you won’t get horizontal scrolling, but both will vertical scroll at least. Create a panel, put a HorizontalLayout into the panel, and Give the HL setWidth(“100%”) and setHeight(null), then put the two things you want to scroll (the xml thingies) into that HorizontalLayout.

To get all the advanced features you asked for, you’d have to learn some GWT and extend the panel component on the client side. That will most likely have some sort of scroll listeners that are just not transferred to the server side as it creates a bunch of extra communication between the server and the browser. Rembember that Vaadin does everything on the server side and it is better to have something like this handled in the browser.

Thanks for prompt response!

It seemed like an ‘opportunity’ for a new component to be developed. But I was really hoping that it would be already possible. :smiley:

The suggestion you offered may be a viable temporary solution. I’ll have to go back and talk to some people before proceeding. Might just do a ‘web start’ app just for this function as another temporary solution.

Thanks again!