Question about dynamic spec
Hi, I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons. My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :) To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout. Now I'll end here this rather long email :) Cheers, Andrei
It's a bit late today, so I will have a look tomorrow :) (If I forget, feel free to insult me ^^) Ben On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Hi,
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
It's a bit late today, so I will have a look tomorrow :)
(If I forget, feel free to insult me ^^)
There's no rush :) Andrei
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
Ben I'm still fuzzy after a flood in the flat we rent at 2 in the morning :) but I was thinking that may be we can use this example to explain the dynamic part of spec. So can you take this view also when you look at the code? If this sounds good to you, I will put on the stack that I should look and see how to put it in the Spec chapter. Stef On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Hi,
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
If you decide to use this example for the Spec chapter I could do another pass on the code and make it nicer. Andrei On Tue, Jul 9, 2013 at 9:11 AM, Stéphane Ducasse <stephane.ducasse@inria.fr>wrote:
Ben
I'm still fuzzy after a flood in the flat we rent at 2 in the morning :) but I was thinking that may be we can use this example to explain the dynamic part of spec. So can you take this view also when you look at the code? If this sounds good to you, I will put on the stack that I should look and see how to put it in the Spec chapter.
Stef
On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis < chisvasileandrei@gmail.com> wrote:
Hi,
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
Did not forget, but I had a crazy day, I will have a look tomorrow, and see if we can use this as a nice example :) Ben On Jul 9, 2013, at 9:18 AM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
If you decide to use this example for the Spec chapter I could do another pass on the code and make it nicer.
Andrei
On Tue, Jul 9, 2013 at 9:11 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Ben
I'm still fuzzy after a flood in the flat we rent at 2 in the morning :) but I was thinking that may be we can use this example to explain the dynamic part of spec. So can you take this view also when you look at the code? If this sounds good to you, I will put on the stack that I should look and see how to put it in the Spec chapter.
Stef
On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Hi,
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :) I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too. I can not commit in your repo since I do not have proper rights :) Ben On Jul 9, 2013, at 9:18 AM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
If you decide to use this example for the Spec chapter I could do another pass on the code and make it nicer.
Andrei
On Tue, Jul 9, 2013 at 9:11 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Ben
I'm still fuzzy after a flood in the flat we rent at 2 in the morning :) but I was thinking that may be we can use this example to explain the dynamic part of spec. So can you take this view also when you look at the code? If this sounds good to you, I will put on the stack that I should look and see how to put it in the Spec chapter.
Stef
On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Hi,
I've implemented a small UI using the dynamic features of spec and I'd like to know if there isn't a better way to do it. My use case is simple: I have a normal ComposableModel that has two models - a list and a DynamicComposableModel. The DynamicComposableModel should contain a list of buttons that should change every time the user selects an element in the list. I've implemented a demo that can be seen if you download the package DynamicSpec-Examples from http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the code from the class comment of DSChangingButtons.
My problem is that the widget containing the buttons has to define a spec layout on the class side. I haven't found a way to tell the spec layout to add a widget and use a method on the object for constructing the layout. I've manage to get away by dynamically reconstructing the layout when the selection changes, however it's not that nice because I had to duplicate the layout of the main widget both on the class side and the object side. It would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not on the class. This may or may not make sense :)
To be concrete, the method DSToolbarModel>>updateButtons will call the method dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: on the toolbar. I'd like to avoid this, and when specifying the layout of the parent widget to call a method on the instance side of it subwidgets to get their layout.
Now I'll end here this rather long email :)
Cheers, Andrei
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout,
and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification? Andrei
Smalltalk hub is not trig erring notifications (yet) :) Ben On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :) Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis < chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout,
and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
Committed :) Ben On Jul 12, 2013, at 8:26 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :)
Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
Thanks. Now I see I did't got how to rebuild the widget properly :) Andrei On Sat, Jul 13, 2013 at 1:10 AM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
Committed :)
Ben
On Jul 12, 2013, at 8:26 PM, Andrei Vasile Chis < chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :)
Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis < chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin < benjamin.vanryseghem.pharo@gmail.com> wrote:
I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own
layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
That was the impression I had :) Now I know I need to explain it and document it better :) Ben On Jul 13, 2013, at 6:15 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Thanks. Now I see I did't got how to rebuild the widget properly :)
Andrei
On Sat, Jul 13, 2013 at 1:10 AM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Committed :)
Ben
On Jul 12, 2013, at 8:26 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :)
Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
On Jul 13, 2013, at 7:01 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:
That was the impression I had :)
Now I know I need to explain it and document it better :)
ben if you want you can write something fast and dirty and I can put it in shape.
Ben
On Jul 13, 2013, at 6:15 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Thanks. Now I see I did't got how to rebuild the widget properly :)
Andrei
On Sat, Jul 13, 2013 at 1:10 AM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Committed :)
Ben
On Jul 12, 2013, at 8:26 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :)
Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
It's on my todo list :) And we will see that after your holidays :) Ben On Jul 14, 2013, at 1:17 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Jul 13, 2013, at 7:01 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:
That was the impression I had :)
Now I know I need to explain it and document it better :)
ben if you want you can write something fast and dirty and I can put it in shape.
Ben
On Jul 13, 2013, at 6:15 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
Thanks. Now I see I did't got how to rebuild the widget properly :)
Andrei
On Sat, Jul 13, 2013 at 1:10 AM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Committed :)
Ben
On Jul 12, 2013, at 8:26 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 2:14 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: Smalltalk hub is not trig erring notifications (yet) :)
Now you should be added as a contributor, so you can commit :)
Andrei
Ben
On Jul 12, 2013, at 2:09 PM, Andrei Vasile Chis <chisvasileandrei@gmail.com> wrote:
On Fri, Jul 12, 2013 at 1:59 PM, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote: I reviewed your code. There was some misunderstanding I think about how to rebuild widgets :)
I patch your version so the toolbar is only responsible of its own layout, and the ChangingButton too.
Super. Thanks a lot :)
I can not commit in your repo since I do not have proper rights :)
I tried to add you as a contributor but nothing happened. Did you receive perhaps some notification?
Andrei
participants (3)
-
Andrei Vasile Chis -
Benjamin -
Stéphane Ducasse