Problems with Renderers

Howdy folks.

I’m back with another question about theming.
I’ve managed to extend/modify a button renderer for my grid

In my “server side” packages i have my renderer i use in my grid

[code]
import com.vaadin.ui.renderers.ButtonRenderer;

@SuppressWarnings(“serial”)
public class HtmlButtonRenderer extends ButtonRenderer {

public HtmlButtonRenderer() {
    super();
}

public HtmlButtonRenderer(RendererClickListener listener) {
    this();
    addClickListener(listener);
}

}
[/code]and then under the widgetset.client package i have the connector

[code]
import com.vaadin.client.connectors.ButtonRendererConnector;
import com.vaadin.shared.ui.Connect;

@SuppressWarnings(“serial”)
@Connect(package.to.serversiderenderer.HtmlButtonRenderer.class)
public class HtmlButtonRendererConnector extends ButtonRendererConnector {
@Override
public VHtmlButtonRenderer getRenderer() {
return (VHtmlButtonRenderer) super.getRenderer();
}
}
[/code]and the client implementation

[code]
import com.google.gwt.user.client.ui.Button;
import com.vaadin.client.renderers.ButtonRenderer;
import com.vaadin.client.widget.grid.RendererCellReference;

public class VHtmlButtonRenderer extends ButtonRenderer {
@Override
public void render(RendererCellReference cell, String text, Button button) {
if (text != null) {
button.setHTML(text);
}
button.addStyleName(“v-button”);
button.addStyleName(“v-button-borderless”);
button.addStyleName(“no-padding”);
button.setVisible(text != null);
}
}
[/code]Aight, you compile and this works like a charm.
Now, i have a nice “commons” project and i wanted to put this in there. Same structure.
I put the jar in my original project, compile, but then the button is not rendered correctly.
Basically the “text” in the client renderer is always rendered as plain text, and the styles are not applied…it basically seems the client implementation is not even called.

I’ve tried also to make it an addon: compiled theme and widgetset, exported as vaadin addon (.jar), included the jar in my original project and linked the jar widgetset file in the widgetset.gwt.xml declaration.
Compiled ( and i see the addon being processed in the compilation) and … doesn’t work either.

Am I doing something wrong? SOmething missing? Any suggestion is very welcomed!

Cheers.

Bump. No ideas?

Hi, did you find any solutions?

I kind of have a similar problem.
I’m trying to use a ButtonRenderer an it’s just plain text until I refresh the page.
I tryed the addon
ComponentRenderer
but I have the same probleme, it just shows a Button.toString (e.g. "
com.vaadin.ui.Button@4a3ec953"
) until I refresh the page…

Hi! It has been quite some time since i touched this. Can you give me a bit more of background? Are you facing this problem like me when the renderer is imported into the project?

No, it’s more with the setColumns(), I change the columns shown in function of the parameters on enter.

switch (event.getParameters()){
  case "offers":
     grid.setColumns(NAME, CONTACT, LOCATION, OFFERS, STATUS);
     break;
  case"requests":
     grid.setColumns(DETAILS, NAME, CONTACT, LOCATION, REQUESTS, STATUS);
     break;
  case "exchanges":
     grid.setColumns(DETAILS, NAME, CONTACT, LOCATION, REQUESTS,OFFERS, STATUS);
     break;
  default:
     setOffersContent();
     break;
}

So when a column that was not shown before appears it is not rendered.