UiBinder ERROR: "Attribute 'from' does not have a computed value Element"

184 views
Skip to first unread message

jopaki

unread,
Aug 26, 2012, 1:51:08 PM8/26/12
to google-we...@googlegroups.com
I get this error when trying to parse/compile my uiBinder LoginPanel.ui.xml:

Rebinding com.tll.client.ui.LoginPanel.LoginPanel2UiBinder
   Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
      [ERROR] Attribute 'from' does not have a computed value Element <ui:text from='res.constants.loginTitle'> (:45)
[ERROR] Deferred binding failed for 'com.tll.client.ui.LoginPanel.LoginPanel2UiBinder'; expect subsequent failures

LoginPanel.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:g="urn:import:com.google.gwt.user.client.ui">
  <ui:with field='res' type='com.tll.client.ui.Resources' />
  <g:HTMLPanel styleName="loginPanel">
    <form ui:field="form" action="post" target="{res.constants.formLoginTarget}">
      <div ui:field="title" styleName="title">
        <ui:text from="res.constants.loginTitle" />
      </div>
      <div ui:field="statusMsg" styleName="statusMsg"></div>
      <table>
        <tr>
          <td>
            <label ui:field="lblUsername" for="{tbUsername.getElement.getId}">
              <ui:text from="{res.constants.labelUsername}" />
            </label>
          </td>
...

LoginPanel.java
public class LoginPanel extends Composite implements ClickHandler, SubmitHandler {

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

interface LoginPanel2UiBinder extends UiBinder<Widget, LoginPanel> {
}

static enum Mode {
LOGIN,
FORGOT_PASSWORD,
}

Mode mode = Mode.LOGIN; // default

@UiField DivElement title;
@UiField DivElement statusMsg;

@UiField LabelElement lblUsername;
@UiField TextBox tbUsername;
@UiField LabelElement lblPassword;
@UiField PasswordTextBox tbPassword;
@UiField Anchor lnkTgl; // toggles btwn view modes
@UiField Button btnSubmit;
@UiField FormElement form;

/**
* Because this class has a default constructor, it can be used as a binder
* template. In other words, it can be used in other *.ui.xml files as
* follows: <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
* xmlns:g="urn:import:**user's package**">
* <g:**UserClassName**>Hello!</g:**UserClassName> </ui:UiBinder> Note that
* depending on the widget that is used, it may be necessary to implement
* HasHTML instead of HasText.
*/
public LoginPanel() {
}
...


I can't for the life of me figure this out!  Pls help!

-Jon

Thomas Broyer

unread,
Aug 26, 2012, 7:18:10 PM8/26/12
to google-we...@googlegroups.com
As the error says, 'from' expects a computed value: <ui:text from='{res.constants.loginTitle}'>

(Note "Element" is not part of the error message, but the element's serialization)

jopaki

unread,
Aug 26, 2012, 7:47:13 PM8/26/12
to google-we...@googlegroups.com
Thank you for the reply.   Yes embarasingly I missed the { }.  I fixed and works.  One more question: When will com.google.gwt.i18n.Constants be usable in a ui.xml file ??  AFAICT, only TextResources are available !  Am I missing something?

thanks, Jon

jopaki

unread,
Aug 26, 2012, 7:50:23 PM8/26/12
to google-we...@googlegroups.com
I know that one can take the  DevGuideUiBinderI18n  approach but this seems like such overkill.  I merely want to leverage constants in a properties file directly in a ui.xml file.

Thomas Broyer

unread,
Aug 27, 2012, 1:39:41 AM8/27/12
to google-we...@googlegroups.com


On Monday, August 27, 2012 1:47:13 AM UTC+2, jopaki wrote:
Thank you for the reply.   Yes embarasingly I missed the { }.  I fixed and works.  One more question: When will com.google.gwt.i18n.Constants be usable in a ui.xml file ??  AFAICT, only TextResources are available !  Am I missing something?

What's wrong with <ui:with field="myConstants" type="com.example.myproject.client.MyConstants" /> and <ui:text from="{myConstants.foo}" /> ? 

jopaki

unread,
Aug 27, 2012, 1:50:02 AM8/27/12
to google-we...@googlegroups.com
An compile error like "can't implement the constants interface:  It must implement TextResource or _____".  I forget the other type the error states.

My semantics here are:

interface MyResources extends ClientBundle {
  
  @Source("MyConstants.properties")
  MyConstants constants();

}

where MyConstants interface is auto-generated via the gwt-maven-plugin.

I'm on 2.4

--
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/-/7_HoE4a7YmQJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
-jpk-

Thomas Broyer

unread,
Aug 27, 2012, 4:01:41 AM8/27/12
to google-we...@googlegroups.com


On Monday, August 27, 2012 7:50:02 AM UTC+2, jopaki wrote:
An compile error like "can't implement the constants interface:  It must implement TextResource or _____".  I forget the other type the error states.

My semantics here are:

interface MyResources extends ClientBundle {
  
  @Source("MyConstants.properties")
  MyConstants constants();

}

where MyConstants interface is auto-generated via the gwt-maven-plugin.

I'm on 2.4

Why are you trying to put the Constants within a ClientBundle?

jopaki

unread,
Aug 27, 2012, 5:48:47 AM8/27/12
to google-we...@googlegroups.com
ahh  - and therein lies the rub.  ty!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
-jpk-
Reply all
Reply to author
Forward
0 new messages