The main Question is do you want YUI users to use Java or do you want  to
bring Java Devs to YUI ?
I think you will get more traction by choosing the latter.

While a zero overhead API gives you the ability to  easely write YUI code
in java soon you will get users request  like "Why cant i extends class X
to add my own functions". Overlay types dont give you.

We had this problems while implementing our libraries. We started first
with 1:1 match of the JS API. Until our users start complaining about the
API not beeing extensible. What you would expect  when using an OO language
like Java.


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());
                        }
                });

        }
});



That looks pretty cool. Now what if i want to extend Button  and override
some methods ?




2012/9/8 Sebastián Gurin <[email protected]>

> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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.

Reply via email to