I have a CellList with AbstractCell. There are some text fields and one picture for each record, just like friend list, everybody has his/her own picture. In GWT showcase, the CellList sample gives one picture to all person with AbstractImagePrototype.create(imageResource). It is not a real world case. How to show these pictures in GWT?
I tried for 1 night with ClientBundle, only got result like 1 static picture in 1 main panel. Also, I don’t know where these pictures should be placed, in MySql’s Blob column or just in file system. Can you give me some suggestion on GWT side or server side? Thanks a lot.
Just now, I saw someone suggested a servlet on server side to provide these pictures. But it will cause another server access, and another permission check should be done on it. Can these pictures be downloaded with text data of CellList and show in browser together? thanks.
In 2.5rc, AbstractCell can work with UiRender with ui.xml. If it works with ui.xml fine, it will be the best solution.
Well it depends how do you transmit the pictures of each user to your GWT app.
ClientBundle
is not a good fit as it defines resources during compile time and I guess the avatar images of your users are quite dynamic (i.e new users, users changing picture, etc).So you have two solutions:
DTO
that backs yourCellList
and in therender
method of yourAbstractCell
just create an Image on the fly.DTO
and inrender
method of yourAbstractCell
you can just create aImage
or<a href=
with the corresponding url.Solution 2 will create a separate HTTP request for each image. Solution 1 won't, however the amount of data you transmit to the client will increase.
Regarding storage:
Storing them as blob field in the database is easier because when you delete the user record also the image will be automatically deleted. However your database size will increase and that's always an issue for backup.