Search code examples
gwtrequestfactorygwt-editors

RequestFactoryEditorDriver#getPaths() usage?


HI: Below code is from RequestFactoryEditorDriver:

 /**
   * Returns a new array containing the request paths.
   * 
   * @return an array of Strings
   */
  String[] getPaths();

My question is,

  1. When and in what place to use this method, there is no place to set paths to the RequestFactoryEditorDriver, is the paths generated when creating the driver? if so, what's the rule of "generating paths"?
  2. I think the client should provide the paths themselves, such as:

    factory.find( proxyId ).with( myPaths).fire(...)

other than from RequestFactoryEditorDriver#getPaths(), if the paths get from 1 is not specified.


Solution

  • The paths are computed from the editor hierarchy. The list basically includes all the properties being edited that are not simple values (primitives, strings, dates, etc.)

    If you have the following:

    TextBox name;
    DateBox dateOfBirth;
    
    @Path("manager.name")
    Label managerName;
    
    AddressEditor address;
    

    getPaths would return "manager", "address".

    The idea is that you can pass the value directly to with() and you'll retrieve all the objects needed by the editor. If you add or remove a subeditor down the hierarchy, you don't have to change your request code, the getPaths value will be different and contain what's needed by the editor.