GUI Persistence

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 fieldsData type
        USERNAMEString
        PASSWORDbyte[]
        ......
        VIEWNAMEString
        VIEWDATAString
    • Persist multiple views: To persist multiple views, you need another VIEWS table that is connected to the USER table using an n:1 relation. 
      • USER

        Data fieldsData type
        USERNAMEString
        PASSWORDbyte[]
        ......
        VIEWS_IDInteger
      • VIEWS

        Data fieldsData type
        IDInteger
        VIEWNAME
        String
        VIEWDATAString



  • UI Session: The GUI data can be globally saved during the session. As long as the session exists, the interface can be restored. 
  • Browser cookie: The GUI data can be saved as a cookie on the user's local computer.  
Examples:
  • 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();

Go to GUI Persistence Javadoc 


XDEV Software Corp. - One Embarcadero Center, San Francisco, CA 94111, US
Copyright © 2015. XDEV Software Corp. All rights reserved.