GWT UiBinder - ui:style type attribute not working correctly

Hi,

I'm trying out the Idea X EAP (the latest build, 311) and am running into what I believe is a bug in the GWT facet - but perhaps I'm not doing something correctly? Basically, in my UiBinder XML, I've got something like the following defined:

<ui:style src="MyView.css" type="com.myapp.ui.MyView.Style"/>

So I've externalized the CSS, and then I have in the backing class an inner interface that implements the stylesheet, and an annotated @UiField field to reference the style:

public class MyView extends Composite {
...
  interface Style extends CssResource {
    ...
  }

  @UiField Style style;

...
}

The problem is, IDEA seems to flag the field declaration with an inspection error, stating that " 'style' field isn't bound to tag in 'MyView.ui.xml' file".

This suggests that IDEA is not recognizing that the annotation can bind to a ui:style that has a specified type attribute, so long as the type of the field matches the type specified in the attribute... or am I doing something wrong?

5 comments
Comment actions Permalink

The problem will be fixed in the next EAP (see http://youtrack.jetbrains.net/issue/IDEA-57422).

Hi,

>

I'm trying out the Idea X EAP (the latest build, 311) and am running into what I believe is a bug in the GWT facet - but perhaps I'm not doing something correctly? Basically, in my UiBinder XML, I've got something like the following defined:

>

<ui:style src="MyView.css" type="com.myapp.ui.MyView.Style"/>

>

So I've externalized the CSS, and then I have in the backing class an inner interface that implements the stylesheet, and an annotated @UiField field to reference the style:

>

public class MyView extends Composite {
..
   interface Style extends CssResource {
     ...
   }

>

   @UiField Style style;

>

..
}

>

The problem is, IDEA seems to flag the field declaration with an inspection error, stating that " 'style' field isn't bound to tag in 'MyView.ui.xml' file".

>

This suggests that IDEA is not recognizing that the annotation can bind to a ui:style that has a specified type attribute, so long as the type of the field matches the type specified in the attribute... or am I doing something wrong?

>

---
Original message URL: http://devnet.jetbrains.net/message/5277447#5277447



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

http://youtrack.jetbrains.net/issue/IDEA-57422 suggests that this issue was fixed in build 319; I just checked in the latest preview build (382), and it seems that the problem I was initially running into still exists?

Specifically, the inspection error that appears to be faulty is that the annotated CssResource field is flagged as not being bound to an element in the UiBinder.

I did notice, however, that now I am getting (valid) inspection errors about CSS classes not having corresponding methods (my CssResource interface does not expose all the classes that are defined in the stylesheet resource), so that's good at least :)

EDIT: I just noticed that in my UiBinder XML, I was missing the 'field' attribute to bind the annotated class member to the UiBinder element... however, my code was actually (surprisingly!) working, so I'm not sure if there's either a GWT bug which allows you to specify a <ui:style .../> declaration without needing to specify the field attribute, or if omitting this attribute is actually a valid use case. If it is actually valid, then IDEA perhaps should only flag this as a warning?

0
Comment actions Permalink

It works for me. Could you please post your ui.xml and java files here?

http://youtrack.jetbrains.net/issue/IDEA-57422 suggests that this issue was fixed in build 319; I just checked in the latest preview build (382), and it seems that the problem I was initially running into still exists?

>

Specifically, the inspection error that appears to be faulty is that the annotated CssResource field is flagged as not being bound to an element in the UiBinder.

>

I did notice, however, that now I am getting (valid) inspection errors about CSS classes not having corresponding methods (my CssResource interface does not expose all the classes that are defined in the stylesheet resource), so that's good at least :)

>

---
Original message URL: http://devnet.jetbrains.net/message/5277794#5277794



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

I've attached a UiBinder XML and Java source file as a simple repro for this issue. Also, it looks like there's at least one other person who's been able to repro this, see IDEA-57422.



Attachment(s):
MyView.ui.xml
MyView.java.zip
0
Comment actions Permalink

Thank you, this will be fixed in the next EAP build.

I've attached a UiBinder XML and Java source file as a simple repro for this issue. Also, it looks like there's at least one other person who's been able to repro this, see http://youtrack.jetbrains.net/issue/IDEA-57422.

>

---
Original message URL: http://devnet.jetbrains.net/message/5277881#5277881



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.