3

I am working on a ClojureScript wrapper for qx.mobile and would like to programmatically build a cljs type hierarchy mirroring the qx class hierarchy.

Is there a way to get all the subclasses of a qooxdoo class?

How about a programmatic way to query the superclass of a class?

I am already putting qx.Class.getProperties to good use.

Thx, kt

kennytilton
  • 994
  • 1
  • 6
  • 16

2 Answers2

4

The programmatic way of getting the superclass of a given class is documented at http://demo.qooxdoo.org/current/apiviewer/#qx.Class

<classname>.superclass

or getting the name of the superclass as a string

<classname>.superclass.classname

which means that e.g.

qx.ui.core.Widget.superclass.classname

will return the string "qx.ui.core.LayoutItem".

Regarding the programmatic way to retreive all subclasses of a class: This is currently not possible without iterating the whole class hierarchy/tree and testing the objects against being subclasses of the given class.

We discussed at https://gitter.im/qooxdoo/qooxdoo that it maybe would be usefull to create an array for each class holding the subclasses. This could be added to the code of the private method __createClass in qx.Class.

We would like to encourage everyone who needs this (or other) functionalities to join us on https://github.com/qooxdoo/qooxdoo/ and help extending qooxdoo by creating a pull requests. Thank you.

level420
  • 829
  • 5
  • 8
2

After digging arround a bit in qx.Class we decided to implement a method qx.Class.getSubclasses which returns a hash object with all subclasses of a given class.

var subclasses = qx.Class.getSubclasses(qx.ui.core.Widget);

gets all subclasses of qx.ui.core.Widget.

Landed in qooxdoo master with commit https://github.com/qooxdoo/qooxdoo/pull/9037

level420
  • 829
  • 5
  • 8
  • Great. Checking it out now. Thanks for the speedy response. – kennytilton Jun 07 '16 at 20:49
  • Please report back if this works for you. And please use the github issue tracker at https://github.com/qooxdoo/qooxdoo/issues for reporting bugs since the bugzilla tracker will be shut down soon. – level420 Jun 08 '16 at 08:59