Wednesday, June 29, 2016

gwt material and uibinder

Hello. 
I'm totally new on gwt and I would like to use gwt material to make my application's UI.

I'm not really confortable with maven, so I downloaded the .jar and imported it in my project. I can so use the component like that :
MaterialButton myButton1 = new MaterialButton();
myButton1.setTextColor("white");
myButton1.setText("myButton1");
myButton1.setType(ButtonType.RAISED);
myButton1.setWaves(WavesType.DEFAULT);

RootPanel.get("divContainer").add(myButton1);

My button is shown in my page and it is perfect. 
But I would like to do the same with uiBinder cause it's a lot more confortable to develop a huge application in my opinion ! 

So I created a myButton2.ui.xml file with this : 
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
    xmlns:g='urn:import:com.google.gwt.user.client.ui'
    xmlns:m="urn:import:gwt.material.design.client.ui">

    <m:MaterialButton text="myButton2" waves="DEFAULT" backgroundColor="white" textColor="black"/>

</ui:UiBinder>

And the respective class : 
package com.google.gwt.sample.testGwtMaterial.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class myButton2 extends Composite {

interface MyUiBinder extends UiBinder<Widget, HelloWorld> {
}

private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

        public myButton2() {
        }
}

But when I change my RootPanel.add thing to :
myButton2 fooBtn = new myButton2();
RootPanel.get("divContainer").add(fooBtn);

There is nothing printed in my page. What I did wrong ?
Thanks for tips !

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment