RapidClipse allows you to persist entire views to restore them at any time; e.g., after an application or system crash or to allow the user to locate his or her custom interface at each login. However, the entire interface is not saved automatically, only the UI components for which you set the following property: Properties > GUI Persistence > Persist. All parameters required for a later building of the GUI are automatically read out and combined into a single string, which you need to save. It is also possible to persist the values the user enters and the selections he or she makes by setting Properties > GUI Persistence > Persist > PersistValue. It is, however, for the user to decide how to save the generated string. You can implement any strategy that is aligned with your needs. Some examples are outlined below.
Database: Save the UI information on the user data in the respective USER table.
Persist 1 View: To persist one view, you only need to create one further VIEW data field.
USER
Data fields | Data type |
USERNAME | String |
PASSWORD | byte[] |
... | ... |
VIEWNAME | String |
VIEWDATA | String |
USER
Data fields | Data type |
USERNAME | String |
PASSWORD | byte[] |
... | ... |
VIEWS_ID | Integer |
VIEWS
Data fields | Data type |
ID | Integer |
VIEWNAME | String |
VIEWDATA | String |
Generate string with GUI data
String viewData = GuiPersistence.save(this, this.getClass().getName()); //TODO: Persisting viewData into Database |
Assign GUI data to a view
//TODO: Loading viewData from database first GuiPersistence.load(this, this.getClass().getName(), viewData); |
Store GUI data globally in UI Session
UI.getCurrent().getSession().setAttribute("ProductView", viewData); |
Retrieve GUI data from UI Session
Object attribute = UI.getCurrent().getSession().getAttribute("ProductView"); String viewData = attribute.toString(); |