GWT hashed css style names not properly added
I have a bizarre experience with GWT styles.
I'm using UiBinder as well as some programmatic access to style my GWT widgets:
<ui:UiBinder xmlns:ui="..." xmlns:g="...">
<ui:style src="bindings.css"/>
<g:VerticalPanel >
<g:Label addStyleNames="{style.stationTitle}" ui:field="stationName"></g:Label>
<g:FlexTable ui:field="routesTable"></g:FlexTable>
</g:VerticalPanel>
</ui:UiBinder>
As you can see I also have a FlexTable. I'm the example at http://code.google.com/webtoolkit/doc/latest/tutorial/style开发者_StackOverflow社区.html#secondary
to add styles to a cell in a FlexTable like this:routesTable.getFlexCellFormatter().setStyleName(row, 1, "route");
Results: The style to the label stationName has been added succesfuly but the style to the tables' cells was not. A look in the HTML served to the browser finds the problem
The styles were compiled and given hashed names: .G1gm2rpjA and .G1gm2rpjB The HTML element that represents the label has been given the correct hashed style name G1gm2rpjA, but the cell in the table has been given the original style name "route"... What's wrong? is this a gwt bug?Ok, I think I got it,
I had to use a CssResource interface to access
my styles in the code.
I don't know how I didn't see this link before
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Programmatic_access
精彩评论