No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Contextualized global ids for componentXML


    my current idea/approach was to use componentXML (or parts of it) as some sort of template from which actual views/widgets could be instantiated (c.f. how Android's LayoutInflator works).
    This implies two objects (canvases) originated from the same componentXML definition (e.g. with ID="canvas0" in the componentXML definition file) can be instantiated.

    If globalIds are used (i.e. putting "canvas0" into the globalIds array of the loadScreen() method, it is possible to get hold of exactly one instance which neither can be cloned nor can its ID be changed.

    If globalIds are not declared (i.e. omitted), it is possible to load multiple instances by calling loadScreen multiple times.

    However, I then have problems retrieving the components defined in it (to attach handlers and the like). The only way I see how this might work is to define a top level dummy component comprising a global id and then "muddle down" in the component/object hierarchy (which is likely to break if the component definition changes).

    The only way I could think of to overcome these issues is to create a customized screenLoader servlet that evaluates some requestProperty (e.g. localIdPrefix) which is then prefixed to all globalIds, giving them some kind of context.

    Would that be the way to go?
    If, it would be nice if this was added as a optional parameter to the loadScreen method (and processed on the server as described).

    By the way, are the global ids converted into sequential generated ones just by "search and replace" in the character stream or is there a more complex processing involved?


    Just read the docs for loadScreen() in 4.0 - you are returned the top-level component without the need for any global IDs.


      I see, thanks, unfortunately, I can only resort to 3.1.


        Any comment on the first post for 3.1?