MSingleSelectionHandling for non widgets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MSingleSelectionHandling for non widgets

kreimer
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!
Reply | Threaded
Open this post in threaded view
|

Re: MSingleSelectionHandling for non widgets

John Spackman-3
Hi Bernardo

That sounds reasonable - can you do it as a pull request?  I’d suggest not moving classes from their current location because of backward compatibility, and if you can implement it as a non-breaking change then there’s a good chance you can get it merged (plus off course you get to use it in your own code straight away).  Also remember to file a bug report and link it to the PR and vice versa.

Regards
John





On 02/01/2016, 02:11, "kreimer" <[hidden email]> wrote:

>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
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel