The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov

Kirill Grouchnikov's Blog

Borrowing from Vista - part II

Posted by kirillcool on April 28, 2007 at 02:07 PM | Comments (14)

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.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Very cool !

    Posted by: claudio on April 28, 2007 at 04:28 PM

  • I love this. This should be added as an option to JTree in the core, for all L&Fs.

    Posted by: benloud on April 29, 2007 at 09:14 PM

  • Thanks Ben. I surely hope this will be eventually added to Windows LAF on Vista, since this is the integral "feel" part of the native component. The implementation is actually not very complicated :)

    Posted by: kirillcool on April 29, 2007 at 09:43 PM

  • that's a really handy feature!

    Posted by: francisdb on April 30, 2007 at 12:51 AM

  • I agree. That ought to at least be an available feature in all PLAFs but perhaps only enabled by default on Vista. I'd turn it on myself tho for everyone elses benefit :-)

    Posted by: alski on April 30, 2007 at 05:08 AM

  • krill please join the sun team and enhance the existing look n feel !!

    Posted by: psychostud on April 30, 2007 at 05:11 AM

  • I agree, it's extremely useful.

    Posted by: fabriziogiudici on April 30, 2007 at 05:50 AM

  • wish this were possible in web apps.

    Posted by: dxxvi on April 30, 2007 at 08:14 AM

  • It is extremely useful, and should be merged into standard JTree as an optional Scrollable behaviour. Very nice.
    P.S.: I noticed from the video the tree lines sometimes are not painted

    Posted by: thorar on April 30, 2007 at 08:25 AM

  • Thorar - the tree lines are not painted when the mouse is not over the tree itself. See the the first part of this series that describes this effect. During the video capture, i moved the mouse from the scrollbar to the tree itself, and you can see the tree lines for a few seconds. This is intentional, showing that these two effects can peacefully coexist at the same time.

    Posted by: kirillcool on April 30, 2007 at 08:45 AM

  • That is very nice, "thorar" mentioned adding it to the standard and I would really like it. But is it possible?

    Posted by: levmatta on April 30, 2007 at 11:12 AM

  • levmatta - this is not my decision since i'm not a part of Swing team. The code is available under BSD license, and anyone (including Swing team) is free to reuse some or all of it.

    Posted by: kirillcool on April 30, 2007 at 11:15 AM

  • this looks great. I've been looking for this addon since vista beta phase. what other vista compliant features will you add?

    Posted by: rudisoft on August 29, 2007 at 07:43 AM

  • rudisoft - what do you have in mind?

    Posted by: kirillcool on August 29, 2007 at 09:41 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds