Possible to consume a click event?

Following scenario - a tree with nodes which are associated with form fields. If the user selects an other node of the tree, a warning will be displayed that the form data isn’t saved and the form will not be upated with the data of the selected node. But the tree jumps to the selected node.

It is possible to consume a click event before updating the UI?

Hi Peter, I don’t unserstand your problem here. Isn’t it completely up to you what will happen after a click in the tree? Why should your application code not be able to react in the way you want it?

User clicks a node - some checks are done, and in some cases the node will be NOT selected, if the checks indicates a problem. In short form - no selection, no high lighting of the node inspite of the fact, that the node was selected by the user.

Use a ValueChangeListener, keep track of the “old” value, if the checks indicate a problem, revert the value change in the listener with tree.setValue(oldValue). This is not ideal, as the visual selection “flickers” a bit on the client side, but it can’t really be helped without somehow moving the checks to the client side, or changing the client-side selection only after the server says it’s okay (which in most cases makes the UI feel sluggish in a quite unacceptable way).

Peter, have you ever considered a change in the transactional behaviour of your application? It is typical to run into such design problems if the user can immediately modify data without being in a special edit mode. Maybe you could include some OK/Cancel Buttons in the form while editing and disable the whole navigation tree as long as the changes are not committed/discarded.

I’m having a problem where my app is running on several tablets. This app is only used to display information, not to interact with it. The problem is that currently you can do two things which you shouldn’t really be able to do:

[list]

[]
Scroll the App (might been avoided by adjusting the layout height better although when i tried that i ran into a more significant problem with the tablets)
[
]
Click and hold the Mouse (Finger) long enough so that a popup opens, asking the user whether he/she wants to save the background image

[/list]Is there any way to avoid this by swallowing the click on the Vaadin-Side so that the browser can’t use this click for his actions anymore (maybe a LayoutClickListener?).

Your are right - an explicit edit mode is the better way. But for my application, only user with admin rights have access to the data/edit tabs. I implemented Dahlström proposal - reselect the node with the unsaved data and display a notification, that the actual node contains unsaved data.