JDT
JDT

Reputation: 109

GWT: Setting specific styles for Cell in Cell Browser

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

Upvotes: 0

Views: 853

Answers (2)

Suresh Atta
Suresh Atta

Reputation: 122026

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>"));

Upvotes: 1

Terrell Plotzki
Terrell Plotzki

Reputation: 2034

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.

Upvotes: 0

Related Questions