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.

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

fahdi jbeli
6 years ago Aug 28, 2015 2:02pm

Hello,

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.

Thanks.

Agata Vackova
6 years ago Aug 28, 2015 2:22pm
fahdi jbeli
6 years ago Aug 28, 2015 2:33pm

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?

Jens Jansson
6 years ago Aug 28, 2015 6:44pm

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.

fahdi jbeli
6 years ago Aug 30, 2015 12:11pm

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.

Jens Jansson
6 years ago Aug 31, 2015 5:41am