1

I was trying to use the MD-Library from Central Maven Repo by just downloading the jar's and just using a normal Java-Project in Eclipse.

From the Central Maven Repo I used the jar gwt-material and since it said during compilation I need MD-jQuery-lib as well, I integrated that jar for gwt-material-jQuery, too.

So following you will find

  • gwt.xml: where I inherit all the required libraries for the gwt-project
  • the entryPoint-class (Addressbook2) with onModuleLoad()-method
  • UIBinder-class, of which an instance should be added in the entryPoint-class
  • UIBinder.ui.xml-file where the MatDes-Lib is integrated as resource-field

Sorry in advance for such a huge post. Did not know how to pack it more compact.

So running and compiling this in Eclipse does work now with GWT Development Mode with Jetty, after integrating MatDes-jQuery-Lib, but when I open the address at the local host http://127.0.0.1:8888/Addressbook.html I am just getting an white browser window without content and even can not open the Dev-Tools. Am I missing something in the configuration or is the code just not correct and I have to adjust it?

gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN"
  "http://gwtproject.org/doctype/2.8.2/gwt-module.dtd">
<module rename-to='addressbook'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <inherits name='gwt.material.design.jquery.JQuery'/>
  <inherits name='gwt.material.design.GwtMaterialDesignBasic'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>
  <entry-point class='addressbook.client.Addressbook2'/>
  <!-- allow Super Dev Mode -->
  <add-linker name="xsiframe"/>
  <set-configuration-property name="CssResource.enableGss" value="true" />
  <extend-property name="locale" values="de, en"/>
  <set-property-fallback name="locale" value="en"/>
</module>

EntryPoint-Class

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootLayoutPanel;

import addressbook.client._2view.MainViewUIB;
public class Addressbook2 implements EntryPoint {

    @Override
    public void onModuleLoad() {
        Window.alert("Hello, World!");
        RootLayoutPanel.get().add(new MainViewUIB());
    }
}

MainViewUIB-Class

package addressbook.client._2view;

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

import gwt.material.design.client.resources.MaterialResources;

public class MainViewUIB extends Composite {

    private static final MainViewUIBUiBinder uiBinder = GWT.create(MainViewUIBUiBinder.class);

    interface MainViewUIBUiBinder extends UiBinder<Widget, MainViewUIB> {
    }

    public MainViewUIB() {
        initWidget(uiBinder.createAndBindUi(this));
    }

    @UiField(provided = true)
    MaterialResources res;
}

MainViewUI.ui.xml

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:m="urn:import:gwt.material.design.client.ui">
    <ui:with type="gwt.material.design.client.resources.MaterialResources" field="res"></ui:with>
    <m:MaterialPanel>
        <m:MaterialIcon marginTop="120" iconType="POLYMER" iconSize="LARGE"/>
        <m:MaterialLabel text="Hello MD World" fontSize="2em"/>
        <m:MaterialLabel text="Start building now your gwt-material apps." fontSize="0.8em"/>
    </m:MaterialPanel>
</ui:UiBinder>

That is the result I am getting by inspecting the page in chrome I just get one Element on the page:

<iframe id="addressbook" tabindex="-1" style="position: absolute; width: 0px; height: 0px; border: none; left: -1000px; top: -1000px;">
<script src="http://127.0.0.1:9876/addressbook/0A7EA82001E95E9BED1D0ABA0EF89DEF.cache.js"></script>
</iframe>
  • You appear to have double posted your entrypoint class, and skipped your view class and the html file. Can you also add any browser console messages (rt click the browser, "Inspect", click Console) and any output in the dev mode view? – Colin Alworth Dec 06 '18 at 13:17
  • hi @ColinAlworth nope I can't rt click browser and see console or inspector, changed the failure with double ep class > html actually is my ui.xml-file –  Dec 06 '18 at 18:12
  • Right click in the browser will have "Inspect", or use the browser's menus to open the developer tools, and in there will be a tab called "Console". The .ui.xml file is _not_ the same as the index.html which uses a – Colin Alworth Dec 06 '18 at 21:45
  • yep I found that, I edited the question with the result I am getting when inspecting the page in chrome, inside the index.html there is an iframe and inside that iframe there is another head and body construct and in THAT body-tag there is the script which is up there, I just left out the additional head and body tags –  Dec 07 '18 at 13:18
  • The iframe doesnt matter, that's an internal detail of how it works, but it indirectly answers the question I was trying to ask. The browser console shows no other errors? I only see one obvious problem here which I'll put in an answer in case it helps, otherwise something else may be wrong with how you are using the material widgets. – Colin Alworth Dec 07 '18 at 13:48

1 Answers1

1
@UiField(provided = true)
MaterialResources res;

The provided=true means that the .ui.xml doesn't need to create this resource, because you will provide it before calling createAndBind. Failing to do this may cause NullPointerExceptions to happen while trying to make the widget, which would result in no content being visible on this path. However, nothing in your .ui.xml actually seems to use res (except for being declared in the ui:with, which is like declaring it as a variable), so you can probably remove both the field and the ui:with pointing at it.

Colin Alworth
  • 17,801
  • 2
  • 26
  • 39
  • tried that (uncommenting in .ui.xml and .java), but still no content on the page –  Dec 07 '18 at 15:22