Appearance Pattern - ok, is there a better explanation, a tutorial, a step-by-step?

371 views
Skip to first unread message

King_V

unread,
Jan 5, 2012, 4:14:33 PM1/5/12
to Google Web Toolkit
All,

Ok, I've read the article at http://code.google.com/p/google-web-toolkit/wiki/CellBackedWIdgets
in dealing with the Cell-backed Widgets, and I can't say I'm any
better off than I was before reading it.

First, the following line:
getCell().setTabIndex(tabIndex);

doesn't work at all - it requires a typecast.

Second, I don't understand how/why the methods for the Appearance
interface are chosen. Why are the methods called onHover and
onUnhover as opposed to, say onMouseOver and onMouseOut, or heck, any
other arbitrary names?

Third, and related to that, what determines the parameters for these
methods? Who/what is calling them, and how would I know, for example,
that not only does the mouseover method need to be called onHover in
the interface, and how would I know that it would need to be passed in
a Context, and Element, and a String?

Is there some sort of tutorial on this that goes step by step and uses
examples? I am really lost with this.

I've also read the Appearance Design Pattern article at Sencha as used
with GXT, but it doesn't clarify things much more over the original.

Thanks in advance....

Thomas Broyer

unread,
Jan 5, 2012, 4:57:49 PM1/5/12
to google-we...@googlegroups.com
Hey, that's what static typing is for:
  • if you're implementing an interface, you know which methods you have to implement, and it won't compile without them.
  • if you're writing your own interface, you're necessarily also writing the code that calls the methods, so you're responsible for defining the methods, their name, their parameters, etc.
If you want a concrete example, have a look at http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/widget/client/TextButton.java the only existing Cell-backed widget for now.
Reply all
Reply to author
Forward
0 new messages