18.8. Using your new generator

You want to use your generator on all widgets. To do that, you need to define the <generate-with> tag as follows:

<generate-with class="com.manning.rebind.MyGenerator">
   <when-type-assignable class="com.google.gwt.user.client.ui.Widget"/>
</generate-with>

But there’s a problem. Such a simple definition allows your generator to run on UiBinder code itself, and that unfortunately causes some issues. You won’t normally have this problem because it’s unlikely you’ll run a generator on widgets, but because you are, you have to exclude UiBinder code. You’ll also hit a conflict issue with the Logging window from GWT, so you need to exclude that too.

Luckily, these are easy to exclude by adding some conditionals in your ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.