[rules-dev] Fwd: [gwt-contrib] Introducing CustomScrollPanel, a subclass of ScrollPanel that lets users define their own scroll... (issue1427804)

Michael Anstis michael.anstis at gmail.com
Wed Apr 20 16:47:12 EDT 2011


Useful to know.

---------- Forwarded message ----------
From: <jlabanca at google.com>
Date: 20 April 2011 21:38
Subject: [gwt-contrib] Introducing CustomScrollPanel, a subclass of
ScrollPanel that lets users define their own scroll... (issue1427804)
To: rchandia at google.com
Cc: google-web-toolkit-contributors at googlegroups.com,
reply at gwt-code-reviews.appspotmail.com


Reviewers: rchandia,

Description:
Introducing CustomScrollPanel, a subclass of ScrollPanel that lets users
define their own scrollbars. By default, we use NativeVerticalScrollbar
and NativeHorizontalScrollbar, but in the future we might introduce thin
scrollbars for mobile devices. The scrollbars are semi-transparent until
the user hovers them, at which time they transition to 100% opacity (on
browsers that do not support CSS transitions, they immediately become
opaque). In RTL, the vertical scrollbar appears on the left side (many
browsers get this wrong natively).

CustomScrollPanel looks and acts almost exactly like a normal scrollable
div, with one important exception.  The scrollbars in a
CustomScrollPanel are overlaid on top of the content instead of adjacent
to it, so when scrollbars appear, the content does not require relayout.
This can be useful for layout when aligning items directly above and/or
below the CustomScrollPanel, because the content will always flow to the
end of the panel.  CustomScrollPanel is a pre-requisite for a CellTable
with fixed headers/footers and scrollable content area.  It allows the
header/footer tables to be the same width as the content table
regardless of whether or not scrollbars appear.  If we tried to a
regular ScrollPanel, we would need active layout to adjust the width of
the header/footer tables to account for the appearance of scrollbars.

In terms of implementation details, the content is actually in a
scrollable div, but the scrollbars of the div are hidden behind the
outer viewport.  So, all of the normal scrolling mechanisms (click and
drag text, mousewheel, page up/down) work normally. We use the
ResizeLayoutPanel implementation to detect when the content is resize,
and show/hide scrollbars accordingly.

You can view a demo here: http://cscroll.jlabanca-testing.appspot.com/


Please review this at http://gwt-code-reviews.appspot.com/1427804/

Affected files:
 M user/src/com/google/gwt/user/ResizeLayoutPanel.gwt.xml
 A user/src/com/google/gwt/user/Scroll.gwt.xml
 D user/src/com/google/gwt/user/ScrollPanel.gwt.xml
 M user/src/com/google/gwt/user/User.gwt.xml
 A user/src/com/google/gwt/user/client/ui/AbstractNativeScrollbar.java
 M user/src/com/google/gwt/user/client/ui/AttachDetachException.java
 A user/src/com/google/gwt/user/client/ui/CustomScrollPanel.css
 A user/src/com/google/gwt/user/client/ui/CustomScrollPanel.java
 A user/src/com/google/gwt/user/client/ui/HorizontalScrollbar.java
 A user/src/com/google/gwt/user/client/ui/NativeHorizontalScrollbar.css
 A user/src/com/google/gwt/user/client/ui/NativeHorizontalScrollbar.java
 A user/src/com/google/gwt/user/client/ui/NativeHorizontalScrollbar.ui.xml
 A
user/src/com/google/gwt/user/client/ui/NativeHorizontalScrollbarTransparent.css
 A user/src/com/google/gwt/user/client/ui/NativeVerticalScrollbar.css
 A user/src/com/google/gwt/user/client/ui/NativeVerticalScrollbar.java
 A user/src/com/google/gwt/user/client/ui/NativeVerticalScrollbar.ui.xml
 A
user/src/com/google/gwt/user/client/ui/NativeVerticalScrollbarTransparent.css
 M user/src/com/google/gwt/user/client/ui/ResizeLayoutPanel.java
 A user/src/com/google/gwt/user/client/ui/ScrollImpl.java
 M user/src/com/google/gwt/user/client/ui/ScrollPanel.java
 A user/src/com/google/gwt/user/client/ui/VerticalScrollbar.java
 M user/test/com/google/gwt/user/UISuite.java
 A user/test/com/google/gwt/user/client/ui/CustomScrollPanelTest.java
 A
user/test/com/google/gwt/user/client/ui/NativeHorizontalScrollbarTest.java
 A user/test/com/google/gwt/user/client/ui/NativeScrollbarTestBase.java
 A user/test/com/google/gwt/user/client/ui/NativeVerticalScrollbarTest.java
 M user/test/com/google/gwt/user/client/ui/ScrollPanelTest.java


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110420/5885e58b/attachment.html 


More information about the rules-dev mailing list