Event handling for newbie

Hi there.

I’m new to both the conventional app-development and also to vaadin, so I really don’t know how to handle a couple of things.

In my app, I have a form that when submitted, it will change a couple of values in an object (oh, really). This object is used in two different places: In the form, and in a “tree”. The values are overridden as they should be, but the tree doesn’t update. The old value is still there, but the new value is set if I manually check it. I suppose I have to fire some kind of event to the tree to make it update, but how?

Might sound confusing, but I hope you understand

Thanks for a very interesting and handy library!

Put your Pojo into an Item, BeanItem for example and everything will happen autonatically.

Greets Stefan

Thanks. You did answer my question and I did solve it (in the tree), but I still have one problem… I used a value in a tab-caption as well and would like that to change as well, but the tab caption is just a regular string that don’t change automatically. How do I make that one change as well? It’s just a regular tabsheet.addTab(component, string, resourse) , in which the string is what I want to have automatically editable.

It’s the exact thing if I want the form caption to change automatically on changes:
personForm.setCaption(p.getItemProperty(PersonContainer.P_FIRSTNAME).toString())

That would make the caption static, so how would it be possible to make that use “the magic” as well?

Thanks for your earlier answer, its appreciated!

Hey Erik, I had the same issue and didnt found a good solution. It is hard for a language without anonymous functions
to manage that. In the end you’ll end up with a hard to read callback code, maybe. You could try to just replace the tab caption by an event fired when your model has been changed. Another possibilty is to solve the problem on a level of visual design. I would try the first option first. Tell if you made it. I am also interested in it.

Greets
Stefan

I did solve it in a perhaps stupid way, but I think it can be manageable. I used the BlackBoard addon and fired an event when the specific form was submitted. Then I registered a listener in the tab-class (which I wanted to change a tab-caption for) and I just changed it from there. Could be pretty ugly but thats how I solved it for now :slight_smile: