Skip to main content

Borrowing from Vista - part II

Posted by kirillcool on April 28, 2007 at 2:07 PM PDT

The first part of this series described the fade effects on tree decorations (lines and expand / collapse icons) that happen under Vista and were added to the latest stable release of Substance. In this part, i'm going to show another nice feature that is present in Vista trees. I call this feature "smart scroll", and it is a real time saver for scrolling multi-level trees with limited horizontal space.

I first noticed this in Eclipse. Usually, i leave something like 200-250 pixels for the package / navigator view, and when i start scrolling up and down, in most cases i have to scroll horizontally as well, especially if i'm looking at classes that are 4-6 levels deep. This is rather time consuming, since you can easily wind up looking at a completely blank view of the tree, and then you have to scroll the tree either to the left or to the right to get your bearings. At that point, you're back again to the vertical scrollbar. Rinse and repeat. However, under Vista this process no longer exists - once you scroll the tree to an (almost) blank view, it automatically scrolls horizontally (as needed to the left or to the right) to bring you in sync with the visible (informational) part of the tree. Needless to say, this is a real time saver, since you're only operating the vertical scroll bar and never get lost in blank areas.

And so, the latest drop of 4.0dev version of Substance (code-named Key Largo) provides this functionality to the applications. As with the tree decorations fade, it is disabled by default and can be enabled by using the relevant FadeConfigurationManager APIs. The matching fade kind constant is SubstanceLookAndFeel.TREE_SMART_SCROLL_ANIMATION_KIND. Here is a video demonstrating it in action - note how the viewport is adjusted to scroll to the relevant tree section. In addition, note that the horizontal scroll doesn't kick in immediately (same as in Vista) - if you continue scrolling on vertically, it will wait until you stop.

If you want to see it in action, you're welcome to install the latest NetBeans module and play with the different tree views.

Related Topics >>