Today I have the following code for rendering my CellList-Item (changing 
the background-image dynamically in dependence of my model):


in my View.java:
    cellList = new CellList<ActivityItem>(new ActivityItemCell());

in my ActivityItemCell.java:

    private static final String styleCellItem = "" +
            "min-height:70px;" +
            "background-repeat:no-repeat;" +
            "color:white;" +
            "text-shadow: black 3px 3px 5px;" +
            "vertical-align: middle;" +
            "font-size: x-large;"
            ;
    
    //define html structure for model {0} is for each field
    //load picture-url here
    public interface Template extends SafeHtmlTemplates{
        @SafeHtmlTemplates.Template("<div 
style=\"background-image:url({0});" + styleCellItem + "\">{1}</div>")
        SafeHtml content(String pic, String cellContents);
    }
    
    //define html markup
    @Override
    public void render(SafeHtmlBuilder safeHtmlBuilder, ActivityItem model) 
{
        SafeHtml content = TEMPLATE.content(model.getImage(),model.getTitle
());
        safeHtmlBuilder.append(content);
    }

Now I want to do the same with the UIBinder approach. But I did not find a 
way to get it working with UIBinder-Code (XML and corresponding JAVA) 
because the background-image is set via css in ui:style. Is there a way to 
change in ui:style the background-image dynamically in dependence of the 
cell-item-data (model) as in the code above?

Maybe someone could post a working UIBinder-Example-Template-Code for my 
posted code (above)??

I think my working solution (for now - see code above) with css saving in a 
string is not easy to maintain and the UIBinder approach would be much 
prettier and clearer.

Thanks in advance
-- marian

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to