PDA

View Full Version : [FIXED] Rename field ToolButton.style



Konstantin.Scheglov
16 Jan 2012, 8:59 PM
...or make it private.

Problem is that in UiBinder it is usual to use code like this:



<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.panel {
background-color: ivory;
}
</ui:style>


<g:FlowPanel styleName="{style.panel}"/>
</ui:UiBinder>




...which generates field with name "style" if you don't specify "field" attribute for <style>.
As you understand, almost nobody does this, so people will get cryptic GWT error message.

Colin Alworth
17 Jan 2012, 6:37 AM
I'm not sure I understand - are you extending ToolButton? Your UiBinder doesn't list a ToolButton instance, so I'm not sure how that comes into the picture here.

Neither ToolButton (nor its superclass IconButton) have a field called style, just a constructor with an argument named style - and that isn't a constructor that is called from UiBinder.

It does have a static field called style, but that would only possibly be an issue if you are using uibinder to extend ToolButton instead of using an appearance, as should be done. Is that the use case you are after?

Konstantin.Scheglov
17 Jan 2012, 8:14 AM
I've posted example of code which uses <ui:style>, and by default GWT generates for it field with name "style". And static field with same name exists in ToolButton. So, if you do

<ui:importfield='com....ToolButton.*'>

...GWT UiBinder will try to import also "style" from ToolButton and you will have ugly error.

Colin Alworth
23 Jan 2012, 5:21 PM
Thanks, I understand now (and was previously unaware of the ui:importfield element). From the looks of things, ToolButton.style should be private anyway - that should deal with this issue, yes?

Konstantin.Scheglov
23 Jan 2012, 5:44 PM
Yes, making "style" field private looks as good solution.

Colin Alworth
24 Jan 2012, 2:53 PM
This change has been made in SVN, you can get it from there, or in the next release.

WesleyMoy
2 Mar 2012, 5:42 PM
Thanks for tracking this issue down. This change should be reflected in beta 4 (http://www.sencha.com/forum/showthread.php?184556-Ext-GWT-3.0-Beta-4-Now-Available). Try your code again and post a reply if you still notice problems with visibility.