diffirence between com.vaadin.client.ui and com.vaadin.ui


Could you please explain the difference between for example com.vaadin.client.ui.VButton and com.vaadin.ui.Button,

whereas I tried the two components and I get the same result. as I understand each VXXX in client side has XXX in server

side with an abstraction of the protocol rpc (connector). in this case we should use directly the component in server side

I dont found any usefull use of the components in client side VXXX.


Have you read
Book of Vaadin
Chapter 3 - Architecture

yes I read it. The whole book didn’t talk about for example the use of VButton it just use Button from com.vaadin.ui

and I know it talks about server side and client side but i didn’t get the difference between Button and VButton,

for example if I want display a Button should I use Button or VButton?

This is the forum category for the product Vaadin Components, while the topic is about Vaadin Framework.

Anyhow. Components in Vaadin Framework consists of three parts; server side, client side and shared state. They are always used all together when you develop your app from the server side, as you seem to be doing. when you do a new Button() in your code, Vaadin will do (something similar to) new VButton() itself
within the browser
. VButton is compiled to javascript and tells how to render the component on the screen. Button on the server sends events to it and controls VButton.

There is no way to initalize VButton on the server side. You can do VButton vbutton = new VButton(); but you can’t do for example horizontalLayout.addComponent(vbutton) - the API doesn’t allow it. So when you develop server side your only option is to use Button. It’s another thing If you want to do fully client side applications with GWT that doesn’t have a server side - there you would use VButton instead, but that is a whole other topic.

ok thanks @jens Jansson for your response,

just I had been confused when vaadin talk about server side and they use a graphics elements like Button,

However and typicaly when we talk about server side we dont talk about these graphics components we talk just about

the logic of the application, I deeped in vaadin and I found that Button transformed to VButton thanks to ButtonState

from shared state library,

I dont know why vaadin let developper declare graphics components in server side thats my problem.

Thanks at all.

The key feature of Vaadin is that you are able to declare your UI in server side Java code. After all, Vaadin is a UI Framework and the components, steered from the server, is the meat of the product. Benefits are security, as every action is validated on the server and the client is a dummy, and a lot of people enjoy writing their UI in Java, without having to work with HTML/JS.