Aida "Flow Control"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Aida "Flow Control"

Rob Rothwell
Ok...I think maybe this is a "good" question...

How do you usually handle..."flow control" in Aida?  As an example, I have a "design page" for data entry components (menus, checkboxes, text boxes, etc...).  I am allowing the user to create "pages" (WebTabs) to group their components together as they wish.  As a convenience, it was quite natural for me to want to allow the creation of a new page right from the "main" view of the "design page" AND from a "page definitions editor," which can be accessed from the main design page.

But then I run into the problem...when I press my "save" button to close my page editor (for a single page) I don't know where to return control to--the main editor, or the page definitions editor.

I can solve this, of course, by not allowing the re-use of such an object/view, and forcing all pages to originate from only one place, but I was wondering if there is a way to do this?

Could you use the various *parameter:value redirection methods (like redirectTo: anObjectOrUrlString view: aSymbol parameter: aParmString value: aValueString) for this to pass information to the object/view that would allow you to make such decisions?  If so, how do you use it?  How do you retrieve the parameter and value string once you have redirected?

Thanks,

Rob




_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Janko Mivšek
Hi Rob,

You make a flow control by jumping between the pages with help of
decision in action methods, then using various #redirectTo methods to
make a jump. You can jump in other view on the same App or to some view
of other domain object.

Note that in the moment of calling the action method all form elements
like input fields are already posted to the domain model, so that you
can use their values for decisions where to go next in your workflow.

I hope this is the right answer in your case.

Janko


Rob Rothwell wrote:

> Ok...I think maybe this is a "good" question...
>
> How do you usually handle..."flow control" in Aida?  As an example, I
> have a "design page" for data entry components (menus, checkboxes, text
> boxes, etc...).  I am allowing the user to create "pages" (WebTabs) to
> group their components together as they wish.  As a convenience, it was
> quite natural for me to want to allow the creation of a new page right
> from the "main" view of the "design page" AND from a "page definitions
> editor," which can be accessed from the main design page.
>
> But then I run into the problem...when I press my "save" button to close
> my page editor (for a single page) I don't know where to return control
> to--the main editor, or the page definitions editor.
>
> I can solve this, of course, by not allowing the re-use of such an
> object/view, and forcing all pages to originate from only one place, but
> I was wondering if there is a way to do this?
>
> Could you use the various *parameter:value redirection methods (like
> redirectTo: anObjectOrUrlString view: aSymbol parameter: aParmString
> value: aValueString) for this to pass information to the object/view
> that would allow you to make such decisions?  If so, how do you use it?  
> How do you retrieve the parameter and value string once you have redirected?
>
> Thanks,
>
> Rob
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Rob Rothwell
On Wed, May 28, 2008 at 7:03 AM, Janko Mivšek <[hidden email]> wrote:
Hi Rob,

You make a flow control by jumping between the pages with help of decision in action methods, then using various #redirectTo methods to make a jump. You can jump in other view on the same App or to some view of other domain object.

This is what I have been doing...I was just wondering if their was a "built in" way to "return from where you came!"

Note that in the moment of calling the action method all form elements like input fields are already posted to the domain model, so that you can use their values for decisions where to go next in your workflow.

True...and I guess you could even store the where to "return to" within the model as well...
 
I hope this is the right answer in your case.

The only other question I have is how do you use the *parameter:value redirection methods like

redirectTo: anObjectOrUrlString view: aSymbol parameter: aParmString value: aValueString.

It looks interesting, but once you are redirected, how do you retrieve the paramater/value string?

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Stefan Schmiedl
On Wed, 28 May 2008 07:54:18 -0400
"Rob Rothwell" <[hidden email]> wrote:

> True...and I guess you could even store the where to "return to" within the
> model as well...

Rob,

IMHO you're doing something wrong, as soon as GUI-related
information like the one you mentioned creep into your model objects.

Models know *nothing* about the environment they're being used in. You
should be able to rip your model classes from your AIDA application and
plug them into a fat client as they are.

The "correct" (again IMO) way to handle this would be to decorate your
application model with adapters, which in turn provide capabilities for
keeping track of workflow and stuff.

s.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Rob Rothwell
On Wed, May 28, 2008 at 8:01 AM, Stefan Schmiedl <[hidden email]> wrote:
IMHO you're doing something wrong, as soon as GUI-related
information like the one you mentioned creep into your model objects.

I know...just saying it felt like a "hack," when just yesterday I was saying that what I was enjoying so much was that "nothing felt like a hack!"

Models know *nothing* about the environment they're being used in. You
should be able to rip your model classes from your AIDA application and
plug them into a fat client as they are.

I think I have been successful at that so far...but couldn't figure out what to do next short of matching system behavior with Aida capability!

The "correct" (again IMO) way to handle this would be to decorate your
application model with adapters, which in turn provide capabilities for
keeping track of workflow and stuff.

This is where I get a little lost theoretically--I'm not exactly sure what "decoration with adapters" is per se...are there any reasonably "simple" classes in a standard Squeak image that I could take a look at to understand this better?

Thanks for encouraging me to listen to my own cringes,

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Stefan Schmiedl
On Wed, 28 May 2008 11:51:10 -0400
"Rob Rothwell" <[hidden email]> wrote:

> The "correct" (again IMO) way to handle this would be to decorate your
> > application model with adapters, which in turn provide capabilities for
> > keeping track of workflow and stuff.
> >
>
> This is where I get a little lost theoretically--I'm not exactly sure what
> "decoration with adapters" is per se...are there any reasonably "simple"
> classes in a standard Squeak image that I could take a look at to understand
> this better?

I don't know my way around Squeak image, it's been too long since I last
played with it. I'm quite impressed with the way decorations work in
Seaside, but again, I'm currently not deep enough in AIDA to know if a
similar approach would work here. I'm sure Janko can help us out with
this.


Warning: Seaside terminology below.

My typical editor component only deals with the form fields
corresponding to the aspects of the model. The "submit" and "cancel"
buttons and the HTML form are added by the component's caller via
a decoration, called "asForm". Another decoration, "asWindow", provides
a window-like titlebar and border. A third decoration "expiringAfter:"
inserts a meta-refresh into the HTML header to automatically redirect
to the main page.

All of these decorations are applied as the wrapping component sees fit.

So if I have a compound model like a "User" managing an Account object
(username, password) and an Address object (contact info), the wrapping
component decides whether to present the two aspects as two distinct
forms (with two submit/cancel button pairs) or maybe use only one of
them at a time to keep the page simple.

But I can also combine the two editors EditorForAccount and
EditorForAddress into a single form and display them in a single large
"editor window" within the rendered page.

It's only up to me, the caller, to decide this, the decorated
component editors don't know or even care about all of this. They only
render the old data and store the current data.

This is (for me) the "why" behind decorators. As to the "how":

A component stores its "chain of decorators" and calls only the
outermost decoration for handling requests and responses. This
decoration is then responsible for calling its owner, which is
repeated until you finally end up rendering the basic component or you
decide to not call "deeper" stuff.

s.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Janko Mivšek
In reply to this post by Rob Rothwell
Rob Rothwell wrote:

>     You make a flow control by jumping between the pages with help of
>     decision in action methods, then using various #redirectTo methods
>     to make a jump. You can jump in other view on the same App or to
>     some view of other domain object.
>
>
> This is what I have been doing...I was just wondering if their was a
> "built in" way to "return from where you came!"

No, and remember, on the web you never return, you always go on :) Even
if you go to a page where you come from. So that's the solution: you
need to remember where you come from and redirect back to that view of
that domain object.

> The only other question I have is how do you use the *parameter:value
> redirection methods like
>
> redirectTo: anObjectOrUrlString view: aSymbol parameter: aParmString
> value: aValueString.
>
> It looks interesting, but once you are redirected, how do you retrieve
> the paramater/value string?

In your App:

        self session lastRequest queryAt: '<parameter name>'

This is the same as when you add a link:

        e addLinkTo: myObject text: 'link' parameter: value:


Best regards
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Janko Mivšek
In reply to this post by Stefan Schmiedl
Hi Stefan,

Stefan Schmiedl wrote:

>> True...and I guess you could even store the where to "return to" within the
>> model as well...

> Models know *nothing* about the environment they're being used in. You
> should be able to rip your model classes from your AIDA application and
> plug them into a fat client as they are.
>
> The "correct" (again IMO) way to handle this would be to decorate your
> application model with adapters, which in turn provide capabilities for
> keeping track of workflow and stuff.

I think here we are talking more about navigation than a workflow. The
navigation down to some domain hierarchy and back. And here is the
problem, how to climb the hierarchy back to the top.

I actually have parent relationships in my domain model so that every
child knows its parent too. That way you can achieve a complete
navigation from domain mode alone, without some special tricks like
remembering where you come from etc. That's why my web apps are full of
navigation support like hierarchical links, left/right buttons to
navigate horizontally, etc. See this page for example:

        http://geomer.eranova.si:8000/merilo/korektor/900/89008074.html

Best regards
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Stefan Schmiedl
On Wed, 28 May 2008 23:08:20 +0200
Janko Mivšek <[hidden email]> wrote:

> I think here we are talking more about navigation than a workflow.
> ...
> I actually have parent relationships in my domain model so that every
> child knows its parent too.

That's the key in not needing to return, yes. It's just one of the
things you really have to understand to use it naturally. In my case
this usually takes a few weeks, then I have an epiphany and throw
most of the old code away :-)

s.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Janko Mivšek
In reply to this post by Stefan Schmiedl
Stefan Schmiedl wrote:

>> The "correct" (again IMO) way to handle this would be to decorate your
>>> application model with adapters, which in turn provide capabilities for
>>> keeping track of workflow and stuff.
>>>
>> This is where I get a little lost theoretically--I'm not exactly sure what
>> "decoration with adapters" is per se...are there any reasonably "simple"
>> classes in a standard Squeak image that I could take a look at to understand
>> this better?
>
> I don't know my way around Squeak image, it's been too long since I last
> played with it. I'm quite impressed with the way decorations work in
> Seaside, but again, I'm currently not deep enough in AIDA to know if a
> similar approach would work here. I'm sure Janko can help us out with
> this.

I don't know much about use of decorator pattern in Seaside either, but
from below explanation I can see similarities to our web elements (aka
components), adding other elements in it, including form elements.

But one big difference comparing to Seaside is that we have only one
form per page. All form elements are recursively registered into that
sole form just before page got rendered into HTML.

Janko



> Warning: Seaside terminology below.
>
> My typical editor component only deals with the form fields
> corresponding to the aspects of the model. The "submit" and "cancel"
> buttons and the HTML form are added by the component's caller via
> a decoration, called "asForm". Another decoration, "asWindow", provides
> a window-like titlebar and border. A third decoration "expiringAfter:"
> inserts a meta-refresh into the HTML header to automatically redirect
> to the main page.
>
> All of these decorations are applied as the wrapping component sees fit.
>
> So if I have a compound model like a "User" managing an Account object
> (username, password) and an Address object (contact info), the wrapping
> component decides whether to present the two aspects as two distinct
> forms (with two submit/cancel button pairs) or maybe use only one of
> them at a time to keep the page simple.
>
> But I can also combine the two editors EditorForAccount and
> EditorForAddress into a single form and display them in a single large
> "editor window" within the rendered page.
>
> It's only up to me, the caller, to decide this, the decorated
> component editors don't know or even care about all of this. They only
> render the old data and store the current data.
>
> This is (for me) the "why" behind decorators. As to the "how":
>
> A component stores its "chain of decorators" and calls only the
> outermost decoration for handling requests and responses. This
> decoration is then responsible for calling its owner, which is
> repeated until you finally end up rendering the basic component or you
> decide to not call "deeper" stuff.
>
> s.
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Rob Rothwell
In reply to this post by Stefan Schmiedl
Thank you for this detailed explanation...I hadn't quite yet "stumbled upon" this myself yet, but now I have "ideas"--particularly about how "easy" this would be in Aida where you can keep adding WebElements to WebElements to WebElements...so each decorator would just keep adding stuff to the existing component.

The Smalltalk thought transformation I have yet to make is where I instinctively ask the object to do things for itself, vs telling it what to do;  this would be a great way to start thinking that way, I think!

Thank you again; this is very helpful.

Rob

On Wed, May 28, 2008 at 4:13 PM, Stefan Schmiedl <[hidden email]> wrote:
On Wed, 28 May 2008 11:51:10 -0400
"Rob Rothwell" <[hidden email]> wrote:

> The "correct" (again IMO) way to handle this would be to decorate your
> > application model with adapters, which in turn provide capabilities for
> > keeping track of workflow and stuff.
> >
>
> This is where I get a little lost theoretically--I'm not exactly sure what
> "decoration with adapters" is per se...are there any reasonably "simple"
> classes in a standard Squeak image that I could take a look at to understand
> this better?

I don't know my way around Squeak image, it's been too long since I last
played with it. I'm quite impressed with the way decorations work in
Seaside, but again, I'm currently not deep enough in AIDA to know if a
similar approach would work here. I'm sure Janko can help us out with
this.


Warning: Seaside terminology below.

My typical editor component only deals with the form fields
corresponding to the aspects of the model. The "submit" and "cancel"
buttons and the HTML form are added by the component's caller via
a decoration, called "asForm". Another decoration, "asWindow", provides
a window-like titlebar and border. A third decoration "expiringAfter:"
inserts a meta-refresh into the HTML header to automatically redirect
to the main page.

All of these decorations are applied as the wrapping component sees fit.

So if I have a compound model like a "User" managing an Account object
(username, password) and an Address object (contact info), the wrapping
component decides whether to present the two aspects as two distinct
forms (with two submit/cancel button pairs) or maybe use only one of
them at a time to keep the page simple.

But I can also combine the two editors EditorForAccount and
EditorForAddress into a single form and display them in a single large
"editor window" within the rendered page.

It's only up to me, the caller, to decide this, the decorated
component editors don't know or even care about all of this. They only
render the old data and store the current data.

This is (for me) the "why" behind decorators. As to the "how":

A component stores its "chain of decorators" and calls only the
outermost decoration for handling requests and responses. This
decoration is then responsible for calling its owner, which is
repeated until you finally end up rendering the basic component or you
decide to not call "deeper" stuff.

s.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Rob Rothwell
In reply to this post by Janko Mivšek
On Wed, May 28, 2008 at 5:08 PM, Janko Mivšek <[hidden email]> wrote:
I think here we are talking more about navigation than a workflow. The
navigation down to some domain hierarchy and back. And here is the
problem, how to climb the hierarchy back to the top.

Yes...and what I haven't quite come to terms with yet is a good, consistent way of building my views on top of my model so that I am not "pushing" my way through the application, but rather "flowing" through the application...

I actually have parent relationships in my domain model so that every
child knows its parent too. That way you can achieve a complete
navigation from domain mode alone, without some special tricks like
remembering where you come from etc. That's why my web apps are full of
navigation support like hierarchical links, left/right buttons to
navigate horizontally, etc. See this page for example:

I actually started to do this, but hadn't "abstracted" it yet beyond the SPECIFIC need of my current application.  But, now that you've made me think about it, the "pattern" I am using is just this, where my parent objects maintain a list of children, and each child knows who it's parent is...

 Thanks again for these good points!

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Rob Rothwell
In reply to this post by Janko Mivšek
On Wed, May 28, 2008 at 5:36 PM, Janko Mivšek <[hidden email]> wrote:
I don't know much about use of decorator pattern in Seaside either, but
from below explanation I can see similarities to our web elements (aka
components), adding other elements in it, including form elements.

But one big difference comparing to Seaside is that we have only one
form per page. All form elements are recursively registered into that
sole form just before page got rendered into HTML.

I think I don't quite know enough yet to understand the implications of this difference!  Maybe someday...!

Rob


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Aida "Flow Control"

Nicolas Petton

Le jeudi 29 mai 2008 à 08:12 -0400, Rob Rothwell a écrit :

> On Wed, May 28, 2008 at 5:36 PM, Janko Mivšek
> <[hidden email]> wrote:
>         I don't know much about use of decorator pattern in Seaside
>         either, but
>         from below explanation I can see similarities to our web
>         elements (aka
>         components), adding other elements in it, including form
>         elements.
>        
>         But one big difference comparing to Seaside is that we have
>         only one
>         form per page. All form elements are recursively registered
>         into that
>         sole form just before page got rendered into HTML.
>
> I think I don't quite know enough yet to understand the implications
> of this difference!  Maybe someday...!
For the programmer, the difference is that you don't have to deal with
forms when you build your pages, while with Seaside you do. On the other
hand, it's sometimes annoying to have this form on top of everything in
your html page when you write CSS. Nothing very important, but your
final css may be a bit different, because of this form.

Cheers!

Nico

--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (204 bytes) Download Attachment