Persist the state of form UI components

Answered

Hi, 

I'm writing a tool window which consists of multiple tabs, and each tab is a form.

I want to persist the state of the form components (such as TextField and ComboBox). I managed to do it with the PropertiesComponent class and a 'save' JButton, but it feels to me that it is not the best option to do it, and I'm trying to do it with PersistentStateComponent class. 

What I'm struggling to understand is how to link my PersistentStateComponent class with the form?

Could you please suggest or supply an example?

Thanks

 

0
1 comment

Standard practice is to separate the state into a separate class (persistent state component) and have the form classes get/set their data from the state class not to combine forms with persistent state.

On form initialization load data from state into controls, when a form control changes it should update the state with new data.

 

 

0

Please sign in to leave a comment.