Can I use DI in widget cells,because it doesn't seem to be working with me?

36 views
Skip to first unread message

Mohammad Al-Quraian

unread,
Apr 20, 2013, 3:12:12 AM4/20/13
to google-we...@googlegroups.com
I was just wondering if DI can be used in cell widget or not? I tried constructor and method injection but it seems that DI is never fired up on cell widgets.

Thomas Broyer

unread,
Apr 20, 2013, 5:36:31 AM4/20/13
to google-we...@googlegroups.com

On Saturday, April 20, 2013 9:12:12 AM UTC+2, Mohammad Al-Quraian wrote:
I was just wondering if DI can be used in cell widget or not? I tried constructor and method injection but it seems that DI is never fired up on cell widgets.

You can use DI everywhere object creation can be done by the DI container (for instance, it means using @UiField(provided=true) or @UiFactory for UiBinder).

So the question is: how are your cells instantiated? 

Mohammad Al Quraian

unread,
Apr 20, 2013, 5:46:45 AM4/20/13
to google-we...@googlegroups.com
Good question, I don't even know how they are instantiated!

I just got a CellList declared as:
private final CellList<Presentable> cellList = new CellList<Presentable>(new TileCell());

and call this method to update the list:

public void setTilesStartingAt(int start, List<Presentable> tiles) {
cellList.setRowData(start, tiles);
}

How are they instaniated, sorry I just started learning about cells.

Thanks Thomas
--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/MS3J-6W7BBg/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Sent from Mailbird for Windows

Thomas Broyer

unread,
Apr 20, 2013, 9:38:39 AM4/20/13
to google-we...@googlegroups.com


On Saturday, April 20, 2013 11:46:45 AM UTC+2, Mohammad Al-Quraian wrote:
Good question, I don't even know how they are instantiated!

I just got a CellList declared as:
private final CellList<Presentable> cellList = new CellList<Presentable>(new TileCell());

'new' TileCell. If you have dependencies in TileCell that you want to be automatically injected, then have TileCell injected into your class as well.

How are they instaniated, sorry I just started learning about cells.

It's not about cells, it's about Java. DI doesn't magically plug into the compiler; GIN et al. only generate code that you could have written yourself.
Start to learn about DI "by hand" (ever seen the ClientFactory from the GWT tutorials?) to "get" the concept, then use a tool that will generate that ClientFactory for you (ClientFactory will be an interface extending Ginjector if you use GIN).
Alternatively, look at the code generated by GIN (pass -gen to the compiler or DevMode)
Reply all
Reply to author
Forward
0 new messages