I don’t know what you are trying to accomplish here, and i’m not a vaadin guru, and not even a developper, let’s say i’m just a Hobbist with a techi-minded thinking, who have fun playing with java and vaadin (love it) in particular. but enought about me. all this to say take what i’m saying with a grain of salt.
here is the général step involved in client server communication in Vaadin 7, assuming you have server side component talking (mapping) to a client widget counterpart :
-
server side component : the server Component must extend com.vaadin.ui.AbstractComponent for example MyButton extend AbstractComponent
-
client side widget : you can extend any type of widget you want. my WidgetButton can extend com.google.gwt.user.client.ui.Button as an exemple. or even com.github.gwtbootstrap.client.ui.Button ( from gwt-bootstrap widget Library, it’s awesome , you should try it)
-
Connector : to link the serverSide component to the clientSide widget you need a special class, in vaadin semantic that class is where things happen,and it’s called a Connector. for example WidgetbuttonConnector extend com.vaadin.client.ui.AbstractComponentConnector
-
State : then happens a time when you would want to share some state between serverSide Component and clientSide Widget, this is where your componentState class come into play, for example WidgetButtonState which must extend com.vaadin.shared.AbstractComponentState
if you’re still following me then we should have :
Mybutton (server side component )
WidgetButton ( client side widget )
WidgetbuttonConnector
WidgetbuttonState
One thing to note is that shared state class is exactly what it means a placeholder for both server component and client widget to share the same information and “maintain some sort of synchronization”
So you can put some getter and setter in it to retrieve the field state between client/server . getText, setText to set a Label text component for example.
Another thing to note is that The Connector Class can be seen has a Listener for state change event, meaning it react as change happen, so you usualy have a onStateChange Method in the connector class of your widget to implement a particular behavior that you want.
It will also have a getState() method that you will have to Override from in the server Side component for example, my server side component “Mybutton” class has this :
@Override WidgetbuttonState getState() {
return (WidgetbuttonState) super.getState();
}
Finaly if you’re still with me , To send update to the client widget you must request it explicitly like this for example :
public void setText(String text ) {
getState().setText(text);
markAsDirty();
}
The markAsDirty() method is the Vaadin 7 way to requestRepaint() i think so, in my understanding, So that the client get updated automatically.
Vaadin 7 has gone through a lot of change , many API break regarding vaadin 6, so it might be a good idea to go through example in the wiki to get a practical feel of all the new client/server communication, most of what i said come from the wiki.
hope it helps , sorry for being verbose .
reference :
https://vaadin.com/wiki/-/wiki/Main/Vaadin%207
http://morevaadin.com/
https://github.com/jojule Very Good example of Hybrid application with server side component with client side widget.
The Book of vaadin has a good chapter ( maybe not complete) on the subject
Following this i managed to get some nice looking component from GWT-BootStrap Library talking to my serverside component …it’s a lot of boilter plate code /connector/rpc/state …etc but it’s more easy than the UIDL Cérémony that the vaadin old timers are familiar with. since even a non developper can tackle it …hum almost
René