0

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

JDT
  • 109
  • 1
  • 2
  • 10

2 Answers2

1

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>"));
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • I am using GWT 2.5 but not creating any columns. I am currently working on GWT showcase project. – JDT Apr 03 '13 at 10:18
  • Otherwise while creating cell itself you can ovveride the render method,In that you can add your class. – Suresh Atta Apr 03 '13 at 10:29
  • Sorry cannot post code. But lets take it to be GWT showcase at http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCellBrowser – JDT Apr 03 '13 at 10:52
0

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.

Terrell Plotzki
  • 2,014
  • 17
  • 17