One big problem with this below:

If you want to do that call (send and wait) in a Form.onSubmit or Link.onClick
We already have to be in a seperate thread.
So that would mean that the user has to specify it somehow that when a request comes in for something
that we start that in a seperate thread.

I can think of something for this.
For example i if have a Link

Class MyLink
{
    public void onClick()   { }
}

and i want to do some continuation on that you just have to specify that for that component:

Class MyLink implements IContinuation
{
    public void onClick()   { }
}

then when we see that the component that is being called does implement that marker interface
we will seperate that request in its own thread.

the onClick can that just call those methods (alert/confirm/prompt) or return normally and the normal process does go on.

That all doesn't seem to be very hard to implement..

But what is that method
    WebPage sendAndWait(WebPage p);

??
is that what i say i want to do that on a request? so with that IContinuation interface?
Or is that one of the methods like alert/confirm that i can call to set a complete other web page as a response?
if the latter is the case then it becomes tricky.
Because that page has also links/submits on it.
Would it work like this then:

first request comes in
  it is component that implements IContinuation so wicket goes into continuation mode.
       the component says: setResponsePageAndWait(p); in its dispatch method.
             then a request comes it of that page. And is handled (onclick/onsubmit is called)
       we see that is was a continuation of a previous request so we attach to that thread again and let that one go on.
  it has done its complete flow and the continuation mode is finished.

The tricky part is ofcourse this: "then a request comes it of that page. And is handled (onclick/onsubmit is called)"

What happens if that was ALSO a IContinuation component??
and should any response page be ignored (or better yet it is set but the (first)icontinuation can get what the responsepage did set as a response page again and alter it or just let it be)

for stacked continuations (modal dialog in modal dialog) it will get a bit harder but we could disallow it at first.

johan


> lets think about some examples how we would do this in wicket and what would
> be a elegant way.

Let's say we have the Control Object mentioned above. The most important
public method would be:

    WebPage sendAndWait(WebPage p);

(This method hides all the dirty work from the user, add a Request
handler, etc.)



I think it would be convenient to provide methods for common tasks:

    void alert(String message);

    boolean confirm(String question);

    String prompt(String question);


These methods send a default AlertPage, ConfirmPage or PromptPage,
evaluate the result after sendAndWait() returns and return a proper value.


An extension of the Control Object could provide methods for simple
creation of Dialogues. Example:

    DialogueModel ask(DialogueModel d);

Usage:

    DialogueModel userInfo = new DialogueModel();
    userInfo.addStringInput("name", "What is your name?");
    userInfo.addStringInput("color", "What is your favorite color?");
    while (userInfo.hasEmptyInputs()) {
       ask(userInfo);
    }


You don't have to care about the view at all at this level of
abstraction. You just work with the model.


Any comments are welcome,


Timo


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to