Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing GIN-created resource in UiBinder xml
    text
    copied!<p>Our application uses GIN to instantiate its GWT Resource bundle dynamically. This is done to enable loading different stylesheets at runtime for different display modes. In general, this means that I can create the singleton instance of the resources using something like <code>MyApp.ginjector.getResources()</code> as opposed to the standard <code>GWT.create(MyAppResources.class)</code>. </p> <p>This works well for everything but UiBinder code. We have been using <code>&lt;ui:with ref="res" type="com.company.MyAppResources" /&gt;</code> and I would like the instance of <code>MyAppResources</code> to be created with GIN rather than <code>GWT.create</code>.</p> <p>According to the <a href="https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Share_resource_instances" rel="nofollow">GWT UiBinder docs</a>, there are two ways to handle this. Either use a <code>@UiField(provided=true)</code> or a <code>@UiFactory</code> in the component. Both of these methods are undesirable because they require people on my team (including myself) to remember to put this boilerplate code into every widget. Worse, if the creation code is omitted, everything will still appear to work, since <code>GWT.create</code> will create an instance of our Resources, just not the one we want.</p> <p>I am looking for a method of creating some sort of global <code>@UiFactory</code> method which all my components will use, which will delegate to GIN. Alternatively, some way of hooking into <code>GWT.create</code> for specific classes and having client-side runtime code create the instance would work as well, as I could then delegate the object creation to my static <code>Ginjector</code>. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload