Quickly reference widgets in browser and code

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

Quickly reference widgets in browser and code

halcwb
With ExtJs you can quickly retrieve a reference to any widget by using css selector style queries. Something like: query('window[title="My title"]') and you will retrieve an array of window objects in the dom with that have the corresponding title. If you query just ('window') you receive all current windows, etc..

Is there an equivalent in qooxdoo? And, if no, what is best practice to get/maintain references to widgets?
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

John Spackman-3
AFAIK the answer is no.  With single page apps a single list of all widgets could quickly get difficult to handle with css style queries, the best practice would therefore be to use OO design techniques.  You can access the root application by qx.core.Init.getApplication(), so if it had a property for the main window you might end up with something like qx.core.Init.getApplication().getMainWindow().getTitle()

John

> On 29 Dec 2014, at 10:01, halcwb <[hidden email]> wrote:
>
> With ExtJs you can quickly retrieve a reference to any widget by using css
> selector style queries. Something like: query('window[title="My title"]')
> and you will retrieve an array of window objects in the dom with that have
> the corresponding title. If you query just ('window') you receive all
> current windows, etc..
>
> Is there an equivalent in qooxdoo? And, if no, what is best practice to
> get/maintain references to widgets?
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

Derrell Lipman

There is a widget registry. I'm on my phone and can't look it up, but try a search for qooxdoo widget registry and I bet you'll find it.

Derrell


On Mon, Dec 29, 2014, 09:19 John Spackman <[hidden email]> wrote:
AFAIK the answer is no.  With single page apps a single list of all widgets could quickly get difficult to handle with css style queries, the best practice would therefore be to use OO design techniques.  You can access the root application by qx.core.Init.getApplication(), so if it had a property for the main window you might end up with something like qx.core.Init.getApplication().getMainWindow().getTitle()

John

> On 29 Dec 2014, at 10:01, halcwb <[hidden email]> wrote:
>
> With ExtJs you can quickly retrieve a reference to any widget by using css
> selector style queries. Something like: query('window[title="My title"]')
> and you will retrieve an array of window objects in the dom with that have
> the corresponding title. If you query just ('window') you receive all
> current windows, etc..
>
> Is there an equivalent in qooxdoo? And, if no, what is best practice to
> get/maintain references to widgets?
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

John Spackman-3
It’s qx.core.ObjectRegistry, but it only supports lookup by hashcode

On 29 Dec 2014, at 15:05, Derrell Lipman <[hidden email]> wrote:

There is a widget registry. I'm on my phone and can't look it up, but try a search for qooxdoo widget registry and I bet you'll find it.

Derrell


On Mon, Dec 29, 2014, 09:19 John Spackman <[hidden email]> wrote:
AFAIK the answer is no.  With single page apps a single list of all widgets could quickly get difficult to handle with css style queries, the best practice would therefore be to use OO design techniques.  You can access the root application by qx.core.Init.getApplication(), so if it had a property for the main window you might end up with something like qx.core.Init.getApplication().getMainWindow().getTitle()

John

> On 29 Dec 2014, at 10:01, halcwb <[hidden email]> wrote:
>
> With ExtJs you can quickly retrieve a reference to any widget by using css
> selector style queries. Something like: query('window[title="My title"]')
> and you will retrieve an array of window objects in the dom with that have
> the corresponding title. If you query just ('window') you receive all
> current windows, etc..
>
> Is there an equivalent in qooxdoo? And, if no, what is best practice to
> get/maintain references to widgets?
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

Derrell Lipman
Thanks, John. Yes, you're right. There is, however, a getRegistry() method that retrieves the __registry map. It should be fairly easy to write a function to search that map and create an array of the objects that match some condition. Coming up with the appropriate search condition may be a little less trivial, since qooxdoo objects don't have titles. 

halcwb, you may need to add a property to each object -- a name or title or whatever you want to call it -- on which you can search the registry, since qooxdoo doesn't typically use such a name. You can use the setUserData() method to assign a name to each object (that's the clean way, but could be a bit slower if you're doing many searches through the register), or just add a _searchTitle member to each object. 

Cheers,

Derrell


On Mon Dec 29 2014 at 12:24:52 PM John Spackman <[hidden email]> wrote:
It’s qx.core.ObjectRegistry, but it only supports lookup by hashcode

On 29 Dec 2014, at 15:05, Derrell Lipman <[hidden email]> wrote:

There is a widget registry. I'm on my phone and can't look it up, but try a search for qooxdoo widget registry and I bet you'll find it.

Derrell


On Mon, Dec 29, 2014, 09:19 John Spackman <[hidden email]> wrote:
AFAIK the answer is no.  With single page apps a single list of all widgets could quickly get difficult to handle with css style queries, the best practice would therefore be to use OO design techniques.  You can access the root application by qx.core.Init.getApplication(), so if it had a property for the main window you might end up with something like qx.core.Init.getApplication().getMainWindow().getTitle()

John

> On 29 Dec 2014, at 10:01, halcwb <[hidden email]> wrote:
>
> With ExtJs you can quickly retrieve a reference to any widget by using css
> selector style queries. Something like: query('window[title="My title"]')
> and you will retrieve an array of window objects in the dom with that have
> the corresponding title. If you query just ('window') you receive all
> current windows, etc..
>
> Is there an equivalent in qooxdoo? And, if no, what is best practice to
> get/maintain references to widgets?
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

thron7
In reply to this post by halcwb
I'd recommend to think you are working in an object system, rather than in the DOM. What do you need those references for?

If you want to change properties of a widget, make the containing widget maintain that through a stored reference.

If you need to trigger changes between unrelated objects (ie. objects which are not part of the same hierarchy), set up custom events that one object can fire and the other listens to, use data binding, or Command objects.

Generally, think of good OO practices like MVC, Law of Demeter, etc. Sifting through search results isn't idiomatic qooxdoo, IMO (presuming you are using qx.Desktop - qx.Website is a different story).

T.

On Mon, Dec 29, 2014 at 11:01 AM, halcwb <[hidden email]> wrote:
With ExtJs you can quickly retrieve a reference to any widget by using css
selector style queries. Something like: query('window[title="My title"]')
and you will retrieve an array of window objects in the dom with that have
the corresponding title. If you query just ('window') you receive all
current windows, etc..

Is there an equivalent in qooxdoo? And, if no, what is best practice to
get/maintain references to widgets?



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

halcwb
thron7 wrote
I'd recommend to think you are working in an object system, rather than in
the DOM. What do you need those references for?

If you want to change properties of a widget, make the containing widget
maintain that through a stored reference.

If you need to trigger changes between unrelated objects (ie. objects which
are not part of the same hierarchy), set up custom events that one object
can fire and the other listens to, use data binding, or Command objects.

Generally, think of good OO practices like MVC, Law of Demeter, etc.
Sifting through search results isn't idiomatic qooxdoo, IMO (presuming you
are using qx.Desktop - qx.Website is a different story).

T.
The widget query setup enables two things:
1. You can then easily retrieve a widget that lives in the browser in the command line, like I do all the time with firebug. Then you get a kind of a REPL work flow.

2. It enables an abstraction of the observer pattern. At the moment there is still a direct relation between the event publisher and the event handler. I can say many bad things of ExtjJs, but there event handling is very powerful. They have a so called event bus. The event bus handles all event publishers and handlers. So, in a controller, I can say, listen to any combox dropdown event and act upon it, without having any direct reference to all the comboxes. See this reference.

Building on that last bit, I could even take this further and I have a central event declaration file in which I can declare exactly which classes/widgets listen to what classes/widgets. And thats quite powerful.


Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

halcwb
In reply to this post by Derrell Lipman
Derrell Lipman wrote
Thanks, John. Yes, you're right. There is, however, a getRegistry() method
that retrieves the __registry map. It should be fairly easy to write a
function to search that map and create an array of the objects that match
some condition. Coming up with the appropriate search condition may be a
little less trivial, since qooxdoo objects don't have titles.

halcwb, you may need to add a property to each object -- a name or title or
whatever you want to call it -- on which you can search the registry, since
qooxdoo doesn't typically use such a name. You can use the setUserData()
method to assign a name to each object (that's the clean way, but could be
a bit slower if you're doing many searches through the register), or just
add a _searchTitle member to each object.

Cheers,

Derrell
Thanks great. The rest is indeed quite trivial. See this code
var objs = qx.core.ObjectRegistry.getRegistry();
_.chain(objs)
 .pairs()
 .filter(function (arr) { return _.last(arr).basename === 'Application' })
 .value();

I use underscore the convert the map to an array, then I have a filter function that can apply a filter (could abstract that as well of course. In this example I pickup any object that has basename 'Application'.
P.s. I don't think it performance will be an issue.
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

Petr Kobalíček
I think that this CSS selector pattern is generally wrong, borrowed from HTML and jQuery style of doing things. You don't want to listen to all comboboxes I guess, what you want is model-driven architecture where you create a model and based on some declarative way the library can create UI for you. This is how I used to use qooxdoo some years back and it has worked out really well.

Best,
Petr

On Mon, Dec 29, 2014 at 9:07 PM, halcwb <[hidden email]> wrote:
Derrell Lipman wrote
> Thanks, John. Yes, you're right. There is, however, a getRegistry() method
> that retrieves the __registry map. It should be fairly easy to write a
> function to search that map and create an array of the objects that match
> some condition. Coming up with the appropriate search condition may be a
> little less trivial, since qooxdoo objects don't have titles.
>
> halcwb, you may need to add a property to each object -- a name or title
> or
> whatever you want to call it -- on which you can search the registry,
> since
> qooxdoo doesn't typically use such a name. You can use the setUserData()
> method to assign a name to each object (that's the clean way, but could be
> a bit slower if you're doing many searches through the register), or just
> add a _searchTitle member to each object.
>
> Cheers,
>
> Derrell

Thanks great. The rest is indeed quite trivial. See this code
var objs = qx.core.ObjectRegistry.getRegistry();
_.chain(objs)
 .pairs()
 .filter(function (arr) { return _.last(arr).basename === 'Application' })
 .value();

I use underscore the convert the map to an array, then I have a filter
function that can apply a filter (could abstract that as well of course. In
this example I pickup any object that has basename 'Application'.
P.s. I don't think it performance will be an issue.




--
View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543p7586558.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

halcwb
Petr Kobalíček wrote
I think that this CSS selector pattern is generally wrong, borrowed from
HTML and jQuery style of doing things. You don't want to listen to all
comboboxes I guess, what you want is model-driven architecture where you
create a model and based on some declarative way the library can create UI
for you. This is how I used to use qooxdoo some years back and it has
worked out really well.

Best,
Petr
Always good to question things;-). But here are my thoughts:

1. Whether a pattern 'is wrong' depends on how you use it. The combobox was just an example and not my intended use.
2. I dont think that you can call Qooxdoo declarative, HTML and Xaml are declarative.
3. And I don't see how this relates or interferes with model driven architecture, this is a different concept.

Best regards -- Casper
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

halcwb
In reply to this post by halcwb
This is my current implementation (in coffeescript, sorry):
###
# @ignore(_)
###
qx.Class.define 'util.Query',
  type: 'static'

  statics:

    query: (filt) ->
      objs = qx.core.ObjectRegistry.getRegistry()
      _.chain(objs)
       .pairs()
       .filter((arr) -> filt(_.last(arr)))
       .value()

You can use it like:
util.Query.query obj -> obj.name is 'Window' and obj.getTitle() is 'Hello world'

or in regular javascript:
util.Query.query(function (obj) {
  return obj.name === 'Window' && obj.getTitle() === 'Hello world';
});
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

Petr Kobalíček
Hi,

you are right of course, nothing is "generally" wrong, but I hope you received the message. When you start using component oriented architecture you won't need these selectors anymore as everything is handled by components' themselves.

Qooxdoo is not declarative, that's also true, and this was my biggest problem to be honest. I ended up of having a framework on top of qooxdoo which "WAS" declarative and allowed me to write forms in a way I needed (basically the problem is that when you have a lot of forms you don't want to code them by hand as you normally do in qooxdoo). Actually, I like more ideas that try to build UI for you than building everything by hand, for example dat.gui is impressive for small things ;)

Cheers,
Petr

On Mon, Dec 29, 2014 at 10:05 PM, halcwb <[hidden email]> wrote:
This is my current implementation (in coffeescript, sorry):
###
# @ignore(_)
###
qx.Class.define 'util.Query',
  type: 'static'

  statics:

    query: (filt) ->
      objs = qx.core.ObjectRegistry.getRegistry()
      _.chain(objs)
       .pairs()
       .filter((arr) -> filt(_.last(arr)))
       .value()

You can use it like:
util.Query.query obj -> obj.name is 'Window' and obj.getTitle() is 'Hello
world'

or in regular javascript:
util.Query.query(function (obj) {
  return obj.name === 'Window' && obj.getTitle() === 'Hello world';
});



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543p7586561.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

paragasu

I wrote a simple abstraction to automatically generate form based on the given postgresql table definition.

I work well so far :)

On 30 Dec 2014 17:45, "Petr Kobalíček" <[hidden email]> wrote:
Hi,

you are right of course, nothing is "generally" wrong, but I hope you received the message. When you start using component oriented architecture you won't need these selectors anymore as everything is handled by components' themselves.

Qooxdoo is not declarative, that's also true, and this was my biggest problem to be honest. I ended up of having a framework on top of qooxdoo which "WAS" declarative and allowed me to write forms in a way I needed (basically the problem is that when you have a lot of forms you don't want to code them by hand as you normally do in qooxdoo). Actually, I like more ideas that try to build UI for you than building everything by hand, for example dat.gui is impressive for small things ;)

Cheers,
Petr

On Mon, Dec 29, 2014 at 10:05 PM, halcwb <[hidden email]> wrote:
This is my current implementation (in coffeescript, sorry):
###
# @ignore(_)
###
qx.Class.define 'util.Query',
  type: 'static'

  statics:

    query: (filt) ->
      objs = qx.core.ObjectRegistry.getRegistry()
      _.chain(objs)
       .pairs()
       .filter((arr) -> filt(_.last(arr)))
       .value()

You can use it like:
util.Query.query obj -> obj.name is 'Window' and obj.getTitle() is 'Hello
world'

or in regular javascript:
util.Query.query(function (obj) {
  return obj.name === 'Window' && obj.getTitle() === 'Hello world';
});



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543p7586561.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Quickly reference widgets in browser and code

Petr Kobalíček
Yeah, problems arise when there are relations and nested models. In the app I'm working on at the moment there are at least 10 nested models that are updated by a single "update" call, including insertion and deletion, pretty complex. I ended up having something like model that also specifies how it's updated and this information is used for data validation and by UI framework.

On Tue, Dec 30, 2014 at 12:15 PM, paragasu <[hidden email]> wrote:

I wrote a simple abstraction to automatically generate form based on the given postgresql table definition.

I work well so far :)

On 30 Dec 2014 17:45, "Petr Kobalíček" <[hidden email]> wrote:
Hi,

you are right of course, nothing is "generally" wrong, but I hope you received the message. When you start using component oriented architecture you won't need these selectors anymore as everything is handled by components' themselves.

Qooxdoo is not declarative, that's also true, and this was my biggest problem to be honest. I ended up of having a framework on top of qooxdoo which "WAS" declarative and allowed me to write forms in a way I needed (basically the problem is that when you have a lot of forms you don't want to code them by hand as you normally do in qooxdoo). Actually, I like more ideas that try to build UI for you than building everything by hand, for example dat.gui is impressive for small things ;)

Cheers,
Petr

On Mon, Dec 29, 2014 at 10:05 PM, halcwb <[hidden email]> wrote:
This is my current implementation (in coffeescript, sorry):
###
# @ignore(_)
###
qx.Class.define 'util.Query',
  type: 'static'

  statics:

    query: (filt) ->
      objs = qx.core.ObjectRegistry.getRegistry()
      _.chain(objs)
       .pairs()
       .filter((arr) -> filt(_.last(arr)))
       .value()

You can use it like:
util.Query.query obj -> obj.name is 'Window' and obj.getTitle() is 'Hello
world'

or in regular javascript:
util.Query.query(function (obj) {
  return obj.name === 'Window' && obj.getTitle() === 'Hello world';
});



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543p7586561.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Fwd: Quickly reference widgets in browser and code

thron7
In reply to this post by halcwb
On Mon, Dec 29, 2014 at 9:03 PM, halcwb <[hidden email]> wrote:

The widget query setup enables two things:
1. You can then easily retrieve a widget that lives in the browser in the
command line, like I do all the time with firebug. Then you get a kind of a
REPL work flow.

Sure, for inspection and debugging this is fair use. The Inspector app aims at the same direction.

 

2. It enables an abstraction of the observer pattern. At the moment there is
still a direct relation between the event publisher and the event handler. I
can say many bad things of ExtjJs, but there event handling is very
powerful. They have a so called event bus. The event bus handles all event
publishers and handlers. So, in a controller, I can say, listen to any
combox dropdown event and act upon it, without having any direct reference
to all the comboxes. See this  reference
<http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.app.EventDomain>

Without looking into the ExtJs docs, I'd say you have something similar in qooxdoo. This tutorial section was the first thing that I could get a hold on:

 
.

Building on that last bit, I could even take this further and I have a
central event declaration file in which I can declare exactly which
classes/widgets listen to what classes/widgets. And thats quite powerful.

In qx.Desktop, everything is done programmatically, sorry (sort of "one ring to rule them all" ;).

T.



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Quickly reference widgets in browser and code

halcwb
thron7 wrote
On Mon, Dec 29, 2014 at 9:03 PM, halcwb <[hidden email]> wrote:
>
> 2. It enables an abstraction of the observer pattern. At the moment there
> is
> still a direct relation between the event publisher and the event handler.
> I
> can say many bad things of ExtjJs, but there event handling is very
> powerful. They have a so called event bus. The event bus handles all event
> publishers and handlers. So, in a controller, I can say, listen to any
> combox dropdown event and act upon it, without having any direct reference
> to all the comboxes. See this  reference
> <http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.app.EventDomain
> >
>

Without looking into the ExtJs docs, I'd say you have something similar in
qooxdoo. This tutorial section was the first thing that I could get a hold
on:
http://manual.qooxdoo.org/4.1/pages/desktop/tutorials/tutorial-part-4-1.html#accessing-the-form-values
> .
>
> Building on that last bit, I could even take this further and I have a
> central event declaration file in which I can declare exactly which
> classes/widgets listen to what classes/widgets. And thats quite powerful.
>

In qx.Desktop, everything is done programmatically, sorry (sort of "one
ring to rule them all" ;).

T.
I have read the manual, so I know how qooxdoo is dealing with this. I advice you to read the link I provided. It is NOT the same. And it is one of the things, ExtJs does very well, so learn from it.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Quickly reference widgets in browser and code

oetiker
Hi Halcwb,

I guess you can use

http://demo.qooxdoo.org/current/apiviewer/#qx.event.message.Bus

to build something along these lines

cheers
tobi


Today halcwb wrote:

> thron7 wrote
> > On Mon, Dec 29, 2014 at 9:03 PM, halcwb &lt;
>
> > halcwb@
>
> > &gt; wrote:
> >>
> >> 2. It enables an abstraction of the observer pattern. At the moment there
> >> is
> >> still a direct relation between the event publisher and the event
> >> handler.
> >> I
> >> can say many bad things of ExtjJs, but there event handling is very
> >> powerful. They have a so called event bus. The event bus handles all
> >> event
> >> publishers and handlers. So, in a controller, I can say, listen to any
> >> combox dropdown event and act upon it, without having any direct
> >> reference
> >> to all the comboxes. See this  reference
> >> &lt;http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.app.EventDomain
> > &gt; >
> >>
> >
> > Without looking into the ExtJs docs, I'd say you have something similar in
> > qooxdoo. This tutorial section was the first thing that I could get a hold
> > on:
> > http://manual.qooxdoo.org/4.1/pages/desktop/tutorials/tutorial-part-4-1.html#accessing-the-form-values
> >> .
> >>
> >> Building on that last bit, I could even take this further and I have a
> >> central event declaration file in which I can declare exactly which
> >> classes/widgets listen to what classes/widgets. And thats quite powerful.
> >>
> >
> > In qx.Desktop, everything is done programmatically, sorry (sort of "one
> > ring to rule them all" ;).
> >
> > T.
>
> I have read the manual, so I know how qooxdoo is dealing with this. I advice
> you to read the link I provided. It is NOT the same. And it is one of the
> things, ExtJs does very well, so learn from it.
>
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Quickly-reference-widgets-in-browser-and-code-tp7586543p7586607.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch [hidden email] +41 62 775 9902


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Quickly reference widgets in browser and code

halcwb
oetiker wrote
Hi Halcwb,

I guess you can use

http://demo.qooxdoo.org/current/apiviewer/#qx.event.message.Bus

to build something along these lines

cheers
tobi
Exactly, without reading your post I came to the same solution. And it is very elegant. I have now the following setup:

View.Button -> Click
View.clickHandler ->
    message.sender = view
    message.name = message
    message.data = additional data
    post message to eventbus

Controller
  subscribes to eventbus with
  message = message and
  handler = messageHandler

So, now neither the view or the controller need any references to each other == loose coupling == good!.
In the controller, when I receive the message I also want to check the sender, using an interface, whether it is the right sender. So, then I am guaranteed that I can use that sender.

What's even better, now I can use the same controller for different views, as long as they implement the interface.

I know there is an assertInterface method. But is there also an 'hasInterface' that returns a boolean?