GWT class in Server and client-side

Hello,

i’m having a little question and i’m not sure if this is possible: Is there a possibility to make a non-component gwt class available at the server- and client-side of a custom component?

My UseCase:
I’m currently integrating gwt visualizations inside vaadin:
The Charts use a class called Options for a lot of customization like title, width, height, … (so it’s just a variable container)
Now i thought: Is it possible to somehow make this class or an extension of it available in all classes of the component. (server class, connector, widget, state) so that i can easily let the user of the component set the variables like he would in gwt and then just send the entire object to the client without having to write 1 or 2 separate container classes which roughly have the same amount of data.

Is this behavior possible or do i just have to accept that i have to write these separate classes to bridge between server and client?

Regards,
M R

Hi,

not sure if I understood correctly, but can’t you just place your class into the same package where your widget’s state object is? The state object is anyway available from server- and client-side so your own class should be too. As long as every member field in your class is of allowed types for the state it should go through state/rpc just fine.

-tepi

Thank you for your reply Teppo,

the thing is i’m not talking about my own class. I’m talking about a gwt client-side class which is only available on the client-side right now. (com.google.gwt.visualization.client.visualiztaions.corechart.Options which is based on/uses com.google.gwt.core.client.JavaScriptObject)
Now i want to try to make the setters and getters available on the server side (as the gwt class is mainly a container class) so that i don’t have to rewrite them for the dozens of options to set.
I also tried to extend the class and then make this “extension” available on the server side. The problem is that even by calling the constructor you are trying to access client-side classes at runtime which aren’t loaded by the classloader. java.lang.NoClassDefFoundError: com/google/gwt/core/client/JavaScriptObject That’s why i’m almost certain that there is no way for me to do this without having to manually add a classloader reference of all the client-side classes which i don’t really want to do or of course writing my own temporary container to transport the values to the client-side.
On the other hand if there is a way please let me know.

Regards,
M R