Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Custom WidgetSet ClassCastException

David Norman
6 years ago Jun 16, 2015 11:53am

A little background first. I am writing a standalone application running on embedded jetty. It is not compiled as a war, but does deploy a WebContent folder with VAADIN and WEB-INF (with a web.xml for use in embedded jetty running alongside a guice container). Currently this is using vaadin 7.4.4 and Java 1.7. All other features are currently working in this configuration.

Right now, I want to add a custom renderer (call it for now a currency renderer). I cannot use the one present in the add-ons as that was built for 6.0 and I am taking the opportunity to figure out the under-the-covers items of vaadin/gwt. Based on the basics I know ...

  • created a CurrencyRenderer.java that extends import com.vaadin.ui.Grid.AbstractRenderer
  • created a CurrencyRendererWidgetset.gwt.xml with

<module>
   <inherits name="com.vaadin.DefaultWidgetSet" />
   <inherits name="com.google.gwt.resources.Resources" />
</module>

  • created a client component CurrencyRendererClient which inherits import com.vaadin.client.renderers.Renderer
  • created a connector class to put these all together

@Connect(CurrencyRenderer.class)
public class CurrencyRendererConnector extends AbstractRendererConnector<Currency> {
  @Override
  public CurrencyRendererClient getRenderer() {
    return (CurrencyRendererClient) super.getRenderer();
  }
}

  • compile the gwt widgetset, put into WebContent/VAADIN/widgetsets deployed
  • compile the jars and placed into WebContent/WEB-INF/lib

So, when I run this and try to use it in a vaadin grid, I get the following error (via Chrome javascript debugger, no error on the server):

Tue Jun 16 05:50:06 GMT-600 2015 com.vaadin.client.ApplicationConnection
SEVERE: Error sending state change eventscom.google.gwt.event.shared.UmbrellaException: Exception caught: undefined
    at Unknown.Eg(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Ig(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Og(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Ex(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Hx(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.cx(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.IAb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.WAb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Ywb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Swb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.cwb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.awb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Dxb(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.Jx(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.ey(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.eval(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.li(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.oi(com.vaadin.DefaultWidgetSet-0.js)
    at Unknown.eval(com.vaadin.DefaultWidgetSet-0.js)
Caused by: java.lang.ClassCastException
   ...

Clearly I missed something in a step to create custom widgets, but I am not sure what. Anyone know or have a good custom widgetset guide? The vaadin one is missing some items about creating when not using the eclipse plugin.

 

Petar Petrov
6 years ago Jul 03, 2015 7:49am
Esau Betancourt
6 years ago Jul 21, 2015 4:00pm
David Norman
6 years ago Jul 21, 2015 4:02pm
Esau Betancourt
6 years ago Aug 20, 2015 8:14pm
Marius Reinwald
6 years ago Aug 21, 2015 12:11pm