Hi.

I crawled the archives but could not find the answer to the following
question. I read the UIBinder doc too.

I would like to create a library of components created using UIBinder.

I would typically have in the

    com.my.company.common

package

a

    test2

component, implemented in a .java and a .ui.xml files.

This component would be used by another component

    test1

defined in the

    com.my.company.client

package.

Please find below this simple test project.

When I start/debug this simple case, I get a :
«
Rebinding com.mycompany.client.test1.test1UiBinder
    Invoking generator
com.google.gwt.uibinder.rebind.UiBinderGenerator
        Package not found : com.my.company.common
    Deferred binding failed for
'com.my.company.client.test1.test1UiBinder'; expect subsequent
failures
    Unable to load module entry point (...)
»

As far as I understand, the compiler has no reason to include things
from com.my.company.common, as these are not used at compile time. How
can I force it ?

Thanks in advance for your help,

Ludovic
=======
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='test_uibinder_multi'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
  <entry-point class='com.my.company.client.Test_uibinder_multi'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>
  <inherits name="com.my.company.Test_uibinder_multi"/>

</module>

======
package com.my.company.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Test_uibinder_multi implements EntryPoint {
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
                test1 toto = new test1();
                RootPanel.get().add(toto);
        }
}
=====
package com.my.company.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.my.company.common.test2;

public class test1 extends Composite {

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

        interface test1UiBinder extends UiBinder<Widget, test1> {
        }
        @UiField Button button;

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

        @UiHandler("button")
        void onClick(ClickEvent e) {
                Window.alert("Hello!");
        }
}
======
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
        xmlns:g="urn:import:com.google.gwt.user.client.ui"
        xmlns:tata="urn:import:com.my.company.common">
        <ui:style>

        </ui:style>
        <g:HTMLPanel>
                <g:Button ui:field="button">Test1</g:Button>
        <tata:test2 ui:field="turlu"></tata:test2>
        </g:HTMLPanel>
</ui:UiBinder>
=======
package com.my.company.common;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;

public class test2 extends Composite implements HasText {

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

        interface test2UiBinder extends UiBinder<Widget, test2> {
        }

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

        @UiField
        Button button;

        public test2(String firstName) {
                initWidget(uiBinder.createAndBindUi(this));
                button.setText(firstName);
        }

        @UiHandler("button")
        void onClick(ClickEvent e) {
                Window.alert("Hello!");
        }

        public void setText(String text) {
                button.setText(text);
        }

        public String getText() {
                return button.getText();
        }

}
=====
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
        xmlns:g="urn:import:com.google.gwt.user.client.ui">
        <ui:style>
                .important {
                        font-weight: bold;
                }
        </ui:style>
        <g:HTMLPanel>
                Hello,
                <g:Button styleName="{style.important}" ui:field="button" />
        </g:HTMLPanel>
</ui:UiBinder>
======
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>

<web-app>

  <!-- Servlets -->

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>Test_uibinder_multi.html</welcome-file>
  </welcome-file-list>

</web-app>
======
<!doctype html>
<!-- The DOCTYPE declaration above will set the    -->
<!-- browser's rendering engine into               -->
<!-- "Standards Mode". Replacing this declaration  -->
<!-- with a "Quirks Mode" doctype may lead to some -->
<!-- differences in layout.                        -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html;
charset=UTF-8">

    <!--
-->
    <!-- Consider inlining CSS to reduce the number of requested files
-->
    <!--
-->
    <link type="text/css" rel="stylesheet"
href="Test_uibinder_multi.css">

    <!--                                           -->
    <!-- Any title is fine                         -->
    <!--                                           -->
    <title>Web Application Starter Project</title>

    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->
    <script type="text/javascript" language="javascript"
src="test_uibinder_multi/test_uibinder_multi.nocache.js"></script>
  </head>

  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position:absolute;width:0;height:0;border:0"></iframe>

    <!-- RECOMMENDED if your web app will not function without
JavaScript enabled -->
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-
left: -11em; color: red; background-color: white; border: 1px solid
red; padding: 4px; font-family: sans-serif">
        Your web browser must have JavaScript enabled
        in order for this application to display correctly.
      </div>
    </noscript>

  </body>
</html>
======
/** Add css rules here for your application. */


/** Example rules used by the template application (remove for your
app) */
h1 {
  font-size: 2em;
  font-weight: bold;
  color: #777777;
  margin: 40px 0px 70px;
  text-align: center;
}

.sendButton {
  display: block;
  font-size: 16pt;
}

/** Most GWT widgets already have a style name defined */
.gwt-DialogBox {
  width: 400px;
}

.dialogVPanel {
  margin: 5px;
}

.serverResponseLabelError {
  color: red;
}

/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
  margin: 15px 6px 6px;
}

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