I recently encountered a strange issue with GWT styles.
While using UiBinder and programmatically styling my GWT widgets, I ran into the following scenario:
<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>
In addition to the Label, there is also a FlexTable in the code. Following an example from
http://code.google.com/webtoolkit/doc/latest/tutorial/style.html#secondary,
adding styles to a cell in the FlexTable was attempted like this:
routesTable.getFlexCellFormatter().setStyleName(row, 1, "route");
The outcome was unexpected - The label stationName received the style successfully,
however, the cells in the table did not. Examination of the generated HTML revealed
that the styles had been compiled and assigned hashed names: .G1gm2rpjA and .G1gm2rpjB
The label element had the correct hashed name (G1gm2rpjA), while the table cell retained the original style name
"route"... What could be causing this discrepancy? Is it a bug in GWT?