Why is HorizontalSplitPanel a final class?

8 views
Skip to first unread message

shoe54

unread,
Jul 31, 2009, 1:17:10 AM7/31/09
to Google Web Toolkit
I want to override final void onSplitterResize(int x, int y) but that
method and the class itself are both final. Or is there any other way
to detect when the splitter has moved?

jay

unread,
Jul 31, 2009, 2:35:11 PM7/31/09
to Google Web Toolkit
We needed the same thing, so we just copied the source into our own
source tree and made the necessary modifications.

jay

Sumit Chandel

unread,
Aug 4, 2009, 1:55:57 PM8/4/09
to Google-We...@googlegroups.com
Hi shoe54,

The reason why the HorizontalSplitPanel (and other split panels and widgets) are declared as final classes is because when these widgets were first introduced, we wanted to make them very easy to use the right way, and very hard to use the wrong way. Implementing something like a split panel can be tricky, and so subclassing such a class and overriding key methods might have easily led to a broken implementation, and an unhappy developer.

That said, widgets like the split panels seemed to have passed the test of time, and it seems like allowing them as well as other widgets to be subclassed should now be part of The Right Way, while continuing to make it difficult to use or subclass the widgets the wrong way.

Issue #1394 in the Issue Tracker talks about opening up the split panel class or perhaps replacing it with widgets that provide easier access to their inner workings. Feel free to start the issue report to get updates as the team figures out the best way to open it up while leaving it easy to use correctly.

Issue #1394:

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages