qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
764 stars 259 forks source link

`qx.ui.tabview.TabButton` does not conform to the API of superclass `qx.ui.basic.Atom` #10642

Closed WillsterJohnsonAtZenesis closed 4 months ago

WillsterJohnsonAtZenesis commented 5 months ago

Due to the following code in TabButton;

https://github.com/qooxdoo/qooxdoo/blob/b3553384ed4a5194e67d4addd41b1795ea73704f/source/class/qx/ui/tabview/TabButton.js#L37-L41

A conflict arises with the following property apply methods in the Atom superclass;

https://github.com/qooxdoo/qooxdoo/blob/b3553384ed4a5194e67d4addd41b1795ea73704f/source/class/qx/ui/basic/Atom.js#L280-L282 https://github.com/qooxdoo/qooxdoo/blob/b3553384ed4a5194e67d4addd41b1795ea73704f/source/class/qx/ui/basic/Atom.js#L291-L293 https://github.com/qooxdoo/qooxdoo/blob/b3553384ed4a5194e67d4addd41b1795ea73704f/source/class/qx/ui/basic/Atom.js#L296-L298

This is due to qx.ui.basic.Atom prusuming that it's layout will always be a qx.ui.layout.Atom, which is untrue and unenforced.

This restricts the use of included appearance entries, as if TabButton includes one of it's superclass' appearances, that superclass cannot safely define these properties in it's appearance.

To Reproduce

Steps to reproduce the behavior:

  1. Add a TabView to a project
  2. Target the TabView button in appearances and set a gap value (or include a superclass' appearance which has a gap value)
  3. Observe the error

Expected behavior

The error should not be thrown, and the application of the gap property should be ignored. This mirrors the way in which the vast majority of layout-specific properties work in CSS.

This could be done by either detatching TabButton from the inheritance chain to Atom, or by modifying Atom to be permissive of alternative layouts (latter option implemented in this PR).

This PR

Provides a simple error prevention mechanism within the property applies in qx.ui.basic.Atom which ensures the layout supports the given property before attempting to set it, provides a warning in development environments if the layout does not support the property.