java client-side code to control widget integration

I’m new to Vaadin,

I’m trying to use Vaadin in my on-going project, and after reading the Vaadin book I still have some questions about java in the client-side.

Is it possible to implement java client-side code to control components (Widget) integration without the need to connect to the server eveytime? For example, hide or display a field according to user selection in the form…

Anyway… The framework is really cool.

Regards,
Ricardo

Sure it’s possible, though I’m not sure if the benefit in responsiveness is often big enough to justify the effort.

You have two basic alternatives:

[list=1]

[]
Make a custom client-side GWT widget that (possibly) extends the widget in question or otherwise modifies it, catch the change events and make any client-side UI logic there. See for example
client-side validation
. (The Pure Java Way)
[
]
Inject JavaScript that does the same (the unclean way)

[/list]Both solutions are somewhat hard if you have to use them in non-generic fashion. A
possibility to add decorators
in the client-side widgets would make this sort of tasks easier, but I think you could solve the problem with some event handling as well.

I’ve occasionally been thinking of some sort of XForms implementation for Vaadin, as it allows defining some UI logic by XPath expressions and such. Well, it would be quite a huge task.

Notice also that any client-side UI logic is always a security risk.

Hi Marko,

Thanks for the prompt answer. I got very impressed with Vaadin.

Vaadin address increadbly weel some of the main issues that discourage me on using GWT (altough I think GWT is incredible), like client x server data binding and growth of the application in the client-side.

For me It’s too early to raise any issue against Vaadin, but in my opinion, to make it perfect it’s missing a better control over widgets in the client side. I noticed that server response is quite fast, but sometimes we need client-side code for better control.

I think your idea of using decorators quite promissing, and maybe it will solve the issue I raise above.

Anyway… Most probably I’ll test it in a new functionality in my application.

Thanks,
Ricardo