Nino: mmm that depends. In my case the first thing I want is to provide
Java and YUI users the possibility of using these two technologies
together. Secondary, I want 2 things: zero-overhead API and an easy
learning curve for YUI js users (so If you know Javascript YUI to be
trivial to learn my YUI java API).
These last two items, lead me to write a Java API that is almost the same
as the YUI Javascript API with the less Java sugar or Java helper classes I
can. Just learn a few rules on how to "do JavaScript in Java code" and just
use the Java API like you were using the js api. For example, compare these
two equivalent js and java codes:
YUI Javascript:
YUI().use('button', function (Y) {
var button1 = new Y.Button({
label: 'a simple button'
}).render(parent);
button1.on("click", function(e){
alert("clicked at x = "+e.clientX);
})
});
Java YUI Equivalent in YUIGWT:
YUI.Use(new String[]{"button"}, new YUICallback() {
@Override
public void ready(YuiContext Y) {
Widget button1 = Y.newButton(
ButtonConfig.create().label("a simple button")
).render(parent);
button1.on("click", new NodeEventCallback() {
@Override
public void call(YuiEvent e) {
Window.alert("button pressed at x
="+e.clientX());
}
});
}
});
hehe, a little weird to see for regular java users, but easy to understand
to YUI and Java users. Checkout an example gallery with java sources
online at http://cancerbero.mbarreneche.com/yuigwt/gallery/ and some of my
thoughts about this at http://code.google.com/p/yuigwt/wiki/YUIJavaApi .
One of the god things I discovered for this approach is that Java API
writing can me very mechanich, and I can take advance of eclipse java code
templates for agile writing java YUI code.
Regards.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/CXgAf0nZgSsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.