Hi!

I'm implementing a Gallery component with many galleryItems to show. It
includes a shortcut bar for navigating randomly through the gallery, and
controls for next/previous.
It seems natural for me to include MSingleSelectionHandling as the Gallery
fits in the selection logic provided. Sadly I found that the items 'have' to
be qx.ui.core.Widget(s)

the galleryItem(s) provided don't conform to be a widget, rather have an
interface like this:

qx.Interface.define( "myapp.ui.gallery.IGalleryItem",{
    members : {
        getShortcut : function() {},
        getMainView : function() {},
        getDescription : function() {},
        onParentResize : function(bounds){},
        onBeforeEnter : function() {},
        onBeforeExit : function() {}
    }
});

Looking into the MSingleSelectionHandling and his friend
SingleSelectionManager source code, I found that the only dependency on
qx.ui.core.Widget is actually the getEnabled() method used to check whether
the item is selectable or not.

A quick workaround for me was to implement a getEnabled() method in my
IGalleryItem; although I'm for a cleaner solution in the framework itself:

a) define an interface eg. ISelectable
b) implement this interface in qx.core.Widget, testing the enabled property.
c) with this slight refactoring, even the MSingleSelectionHandling and
SingleSelectionManager are candidates to be moved out of the qx.ui.*
package.

Thanks to the entire qooxdoo team! have a happy hacking 2016!



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/MSingleSelectionHandling-for-non-widgets-tp7587898.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to