gwt material and uibinder

483 views
Skip to first unread message

Pierre Mineaud

unread,
Jun 29, 2016, 10:40:11 AM6/29/16
to GWT Users
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 !

Pierre Mineaud

unread,
Jun 29, 2016, 10:50:16 AM6/29/16
to GWT Users
I didn't mentionned : 
So I added well the "<inherits name="gwt.material.design.GwtMaterialWithJQuery" />" in my app.gwt.xml.

Pierre Mineaud

unread,
Jun 29, 2016, 12:12:19 PM6/29/16
to GWT Users
Ok... I finally found my error... 
Here is what I have done :

in my myButton2.java code : 
public class myButton2 extends Composite {

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

@UiTemplate("myButton2.ui.xml")
interface MyUiBinder extends UiBinder<Widget, myButton2> {
}
public myButton2() {
initWidget(uiBinder.createAndBindUi(this));
}
}

And in my "main" I simply did that : 
RootPanel.get("stockList").add(new HelloWorld());

All is fine now, exept one thing ! :D (Yeah... nothing can directly be perfect !)
My wave effect when I'm clicking on the button don't show up. 
My waves attribute is still there in my .ui.xml like that :
<m:MaterialButton text="Button" waves="DEFAULT" backgroundColor="white" textColor="black" />


Gilberto

unread,
Jul 2, 2016, 6:39:18 AM7/2/16
to GWT Users
Hi Pierre!

Welcome to GWT and GWT Material =)

If you want a faster, direct communication with the developers from GWT Material, join us at the Gitter chat: https://gitter.im/GwtMaterialDesign/gwt-material

Also, I advise you to really try to use Maven. I know it's hard and sometimes frustrating, but when you finally get it working, can save you a lot of time when using continuous integration, and allows your project to be IDE independent (which is really important to have - you'll never know when a vi expert will join your team).

About your problem with the waves, I imagine it's something related to the layout of your entire view. I'd have to test. Do you have a complete working example so I can copy-paste-and-test ?

Pierre Mineaud

unread,
Jul 4, 2016, 2:58:10 AM7/4/16
to GWT Users
Hi Gilberto and thanks for your answer ! ;)
 
 Thanks too for the invitation on the gwt material chat, I will come !

About maven, you're probably right. But at the moment in my enterprise, we are switching direction for our web development (we were on meteor, a javascript framework client and server side), and for all developers and director, maven were most a barrier than a real help. But I'm agree with you, you must be right when we see all gwt dev on maven ! :) But to be honest, we will try to learn gwt and his environment before trying maven with.

And finally, my problem is solved. I really don't know what I did to get it, but after some days on manipulating gwt and gwt material, I understood how it works and I can't reproduce my initial problem :)

Thomas Broyer

unread,
Jul 4, 2016, 3:32:42 AM7/4/16
to GWT Users


On Monday, July 4, 2016 at 8:58:10 AM UTC+2, Pierre Mineaud wrote:
About maven, you're probably right. But at the moment in my enterprise, we are switching direction for our web development (we were on meteor, a javascript framework client and server side), and for all developers and director, maven were most a barrier than a real help. But I'm agree with you, you must be right when we see all gwt dev on maven ! :) But to be honest, we will try to learn gwt and his environment before trying maven with.

A little off-topic but, before going Maven (unless you know it already) explore Gradle too (and, why not, Ant+Ivy, Buildr, SBT, or even Pants or Bazel); then make an informed choice. Just sayin'

Gilberto

unread,
Jul 4, 2016, 4:46:49 AM7/4/16
to GWT Users
Yes, Thomas is right: you should try other dependency/build management tools before making a final decision on which one to use. The important thing, in my opinion, is to use something that can read the maven central repository and can automate and standardize your build.

Glad your problems are solved!

By the way, out of curiosity, can you share your experience a little bit about the transition from meteor to GWT? What aspects of GWT made you and your team to choose it? I'd like to hear from you because I have a similar scenario in one company.

Vassilis Virvilis

unread,
Jul 4, 2016, 4:57:18 AM7/4/16
to google-we...@googlegroups.com
I use ant+ivy. It's not perfect for sure but with time it grew deep roots in my company. If you invest on it you can do anything (Turing complete). Right now it's a major undertaking for me to leave ant+ivy for maven. I am not event sure that I like maven that much to do the necessary work...

One big plus form maven is that is hot and everybody is using it these days. That was also true for ant in the previous years but not so much anymore.

One big minus for ant+ivy (ivy looks deadish - last release Dec 2014)

Another problem is the transitive dependencies. Let me explain
Project P depends on libA and libB. libA and libB depend on differenct versions of log4j or worse slf4j

P: libA libB

libA: log4j-v1

libB: log4j-v2


Guess what happens. Answer: both are included in the final war, jar etc.

Guess what happens when you are using commons-logging or slf4j and a third party library pulls in log4j. Your logging configuration is flipped to use a new probably unconfigured backend. So you are writing exceptions but the exceptions are in the scope of Project P (and not in the libA, libP scope) because project P knows what transitive libraries has in total. So it's a kind of a mess... Does happen handle things better? I seriously doubt it.

Oups totally of topic: Sorry

    Vassilis












--
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-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

Pierre Mineaud

unread,
Jul 4, 2016, 9:25:32 AM7/4/16
to GWT Users
Oups... This topic is really gone ! :) 
But last answer for Gilberto : 

Without entering too much in detail, our project is about making a huge platform (intranet) for our enterprise with different real application in there with different rules for each login. This can be planning scheduler and comptability gestion for the administration, gestion of production for the concrete maker, Vehicule consomation for driver's formaters and printer administration (cups style) / server admin and terminal spying for our Info Team... etc etc...
We began our dev on meteor for reactivity (especially the native mongoDB <-> meteor communication), multiplatform, and easy development. But we encoured some problems with meteor and we are working with physical device like truk's can bus, gps, old database (cisam). Java is a needed part of our project. So the promise of gwt to develop web app and android stuff is really interesting for us to develop our project with the same langage. 

Michael Joyner

unread,
Jul 5, 2016, 10:39:34 AM7/5/16
to google-we...@googlegroups.com
two dimes:

We find Gradle much easier to work with than Maven here at my shop.
Especially for "loosely coupled" project dependency setup. We never
could get Maven to simply reference other projects arbitrarily. We find
Maven is too strict in specifying how projects are connected up with
each other.

Plus we use Gretty to automatically run our projects server and client
code from multiple projects together as a single localhost tomcat server.
Reply all
Reply to author
Forward
0 new messages