GWT: Setting specific styles for Cell in Cell Browser

849 views Asked by At

I need to set up specific styles of Cell Browser cells in GWT from a CSS file. Any pointers on how to do it

2

There are 2 answers

0
Terrell Plotzki On

You should be able to set the css style on any widget using methods from UIObject. In this case something like this should work:

cellBrowserInstance.setStylePrimaryName("newStyle");

with "newStyle" being listed in your CSS.

3
Suresh Atta On

If you are using 2.4 or 2.5 sdk of GWT

Override getCellStyleNames() while creating column.

            TextColumn<String> col= new TextColumn<String>() {

                @Override
               public String getCellStyleNames(Context context, String  object) {
                     return "yourStylee";
                 }  

                @Override
                public String  getValue(String object) {                                            
                return object.getName();
                }           

              };

        };

If its cell

    public void render(com.google.gwt.cell.client.Cell.Context context, Meeting object, SafeHtmlBuilder sb) {

        sb.append(SafeHtmlUtils.fromString(" <div class=youclass><table>"));
        // Code goes here
        sb.append(SafeHtmlUtils.fromString("<table> </div>"));