add class name to element in uibinder xml file

前端 未结 2 1706
执笔经年
执笔经年 2021-02-07 05:28

The following replaces any current css class names. It appears to call setStyleName.




        
相关标签:
2条回答
  • 2021-02-07 06:11

    Use addStyleNames in such situations, like this:

    <g:DecoratorPanel addStyleNames="{style.myCssClass}">
    

    It's a little trick I picked up on the GWT's Google Group - too bad it's not (?) mentioned in the official documentation.

    PS: I'm actually missing a really comprehensive documentation for UiBinder. I grepped the GWT sources for addStyleNames and found this file: WidgetBasedUi.ui.xml - it seems to contain some interesting use cases for UiBinder, including the one with addStyleNames.
    If someone knows any other good/secret references for UiBinder, please share :)

    0 讨论(0)
  • 2021-02-07 06:11

    Yes addStyleNames is the solution. And it is actually mentioned in the documentation: UiObject. See section "Use in UiBinder Templates".

    0 讨论(0)
提交回复
热议问题