Parameters/Action between components classes.

Hi All,

I have the following scenario and I’m not really sure how to accomplish my goal.

I have one class, ProductLayout which extends VerticalLayout and is the main layout for an specific functionality. Inside this class, I add two components, ProductSelection and ProductDetails.

  • ProductSelection.class, extends VerticalLayout and has on it a BeanItemContainer and a ComboBox for product selection, and a button to accept the product selected AND ADD THIS ITEM TO ANOTHER COMPONENT: ProductDetails.class

  • ProductDetails.class, extends VerticalLayout. This component has a form with product details, and THIS INFORMATION SHOULD BE ADDED ONCE THAT A PRODUCT IS SELECTED on ProductSelection.class and the button is pressed.

Currently I developed component ProductDetails.class as a simple java SINGLETON, so I get the instance of ProductDetails on ProductLayout when I first added, and then on ProductSelection I have a listener on the button, which calls the instance of ProductDetails and has a method to fill its component, but of course as this is a SINGLETON, when I restart the Vaadin application, this data is still there, and it keeps in there until I restart the server.

I’m sure there should be a better way to do this, but I just can’t figure it out.

Any ideas or suggestion will be highly appreciated,
Thanks!
Lean