ergobyte / qookery

Declarative UI Building for Qooxdoo
http://www.qookery.org/
Apache License 2.0
9 stars 5 forks source link

Support for qxObjectId #7

Closed cboulanger closed 2 years ago

cboulanger commented 5 years ago

(updated) I am using the new (optional) object id feature of qooxdoo

http://www.qooxdoo.org/devel/api/#qx.core.Id http://www.qooxdoo.org/devel/api/#qx.core.MObjectId

which lets you use well-known application-wide ids to address widgets. They are declared in a relative way, i.e. each qx.core.Object is assigned a (non-unique) id and then attached to a logical parent ("owner"), which is distinct from the layout parent and can be any arbitrary qooxdoo object. The topmost object needs to be registered with the API. The owner-owned relationship results in a unique id composed of the individual object ids.

In my form, I declare them this way:

    <button label="Hide script" id="toggleLeftEditorButton">
       ...
      <script>
        this.getMainWidget().setQxObjectId(this.getId());
        $.Form.addOwnedQxObject(this.getMainWidget());
      </script>
      ...
    </button> 

It would be nice to have an xml syntax to get rid of these script tags this, either by an additional attribute

<button label="Hide script" id="toggleLeftEditorButton" qxObjectId="toggleLeftEditorButton">

or, my preference, the Qookery id is automatically re-used as the object id (to be overridden by code if necessary). It would need a check of the environment variable "module.objectId" because object ids are an optional feature.

cboulanger commented 5 years ago

updated to fix code and add missing $.Form.addOwnedQxObject(this.getMainWidget());

gnikolaidis commented 5 years ago

The "module.objectId" feature looks great- I see it completely supplanting the Qookery ID system which was devised to cover the same needs and with the same goals. As with any object registration system, there are many secondary complications (garbage collection, ID collisions, etc), so let's keep the issue open until QX6 is released.

cboulanger commented 5 years ago

Any ETA for this feature? Would be great to have it...

gnikolaidis commented 5 years ago

I opted for a full replace of former IDs by the new support provided by Qooxdoo 6. So far the results are very satisfying. I will wait for your feedback before closing this issue.