thanks johan ,

i make a summary here.... 


 1. report link an ajax link.
   ==> add a reportAjaxLink  to the parentPage

         ajaxLink = new AjaxLink("cancelReportLink"){
                        public void onClick(AjaxRequestTarget target) {
                                if (stopThread == null) {
                                        stopThread = new Thread (ReportPage);
                                        stopThread.setName("ReportPageThread");
                                        stopThread.setDaemon( true ); 
                                        stopThread.start();
                                        isLoad = true;
                                }
                                setResponsePage(ReportPage.class);
                        }                       
                };

2. ajax link gets a thread from a thread pool and let that thread generate
the report 
      ==> once the link is click, it will start the report page thread and
setResponsePage to the report page

    ==> So, my reportPage will be implements Runnable ( in order put in
thread ) , eg :

          public ReportPage() extends ParentPage implements Runnble{
               add(feedback);

                 // add the modal window here ?? how it auto call and pop it
?
                // as i know it need the ajaxLink to fire it 
               ModalWindow cancelModal = new ModalWindow("cancelModal");
               CancelPanel  cancelPanel = new
CancelPanel("content",cancelModal);
               add(cancelModal);
              cancelModal.setContent(cancelPanel);
              cancelModal.setPageMapName("cancelModal"); 

               add(new ChildPageForm("ChildPageForm"));
           }

           private class ChildPageForm extends Form {
                 // execute query
                 // generate the result as Chart ( JFreeChart tool )
           } 



3. modal dialog you have a cancel button and a ajax timer that checks if the
report is done every x second.
    ==> the ajaxTimer u mean is... i tried as below

          cancelReportModal.add(new
AbstractAjaxTimerBehavior(Duration.seconds(1)) { 
                @Override
                protected void onTimer(AjaxRequestTarget target) {
                    // if the report page is still loading               
                   if(isLoad){
                         cancelReportModal.show(target);        
                         target.addComponent(cancelReportModal);
                   }else{
                   cancelReportModal.close(target);     
                   stopThread = null;
                }
           }
        }); 


   ==> But this part is only  run the else part. Is that i did something
wrong there? 


Btw, i am the newbia to wicket and i was using the wisket 1.2.4. So, hope
can share and do any discusion here ....


thanks in advance 
-kenix


Johan Compagner wrote:
> 
> this is again a extremly fuzzy examle
> Because the parent page has the link and the modal dialog
> But hte report page extends the parent page so that one also has the link
> and the modal dialog...
> 
> So what do you want to show on what page??
> 
> If the report page takes a long time then ofcourse you can;t show the
> modal
> dialog on that page
> because the report page isn't there yet..
> 
> 
> What you should do if you want a modal dialog to happen is
> 
> Make the report link an ajax link.
> That ajax link gets a thread from a thread pool and let that thread
> generate
> the report
> Then it displays the modal dialog on the page it is coming from (so just
> the
> parent page with the report link)
> 
> On that modal dialog you have a cancel button and a ajax timer that checks
> if the report is done every x seconds.
> 
> the cancel button sets a flag on the server so that the report thread
> checks
> as often as he can and when he sees that he just stops with what he is
> doing.
> 
> If the ajax timer sees the report beind done it closed the dialog and then
> shows the report page.
> 
> johan
> 
> 
> 
> On Feb 4, 2008 3:58 PM, kenixwong <[EMAIL PROTECTED]> wrote:
> 
>>
>> hi, johan...
>>
>> what i mean is.. based on the example below: -
>>
>> a) Parent Page
>> ===========
>>
>> public ParentPage() extends WebPage{
>>
>>
>>    Link reportLink = new Link("link", new Model()){
>>      @Override
>>      public void onClick() {
>>        setResponsePage(ReportPage.class);
>>      }
>>    };
>>
>>    Label label = new Label("linkLabel", text);
>>    reportLink .add(label);
>>    add(reportLink );
>>
>>
>>    ModalWindow cancelModal = new ModalWindow("cancelModal");
>>    CancelPanel  cancelPanel = new CancelPanel("content",cancelModal);
>>    add(cancelModal);
>>    cancelModal.setContent(cancelPanel);
>>    cancelModal.setPageMapName("cancelModal");
>>
>>
>>     // to auto pop up the modal window.
>>     ajaxLink = new AjaxLink("cancelModalLink"){
>>                @Override
>>                public void onClick(AjaxRequestTarget target) {
>>                        cancelModal.show(target);
>>                        }
>>                };
>>     add(ajaxLink);
>>
>>      //  Fire the ajaxLink onclick function
>>     getBodyContainer().addOnLoadModifier(new ClickOnceOnLoadModel(
>> ajaxLink
>> ), null );
>>
>>     add(feedback);
>>
>> }
>>
>>
>>
>> b) Child page ( My report Page )
>> ========================
>> public ReportPage() extends ParentPage{
>>
>>     add(feedback);
>>     add(new ChildPageForm("ChildPageForm"));
>> }
>>
>>
>> private class ChildPageForm extends Form {
>>            // execute query
>>            // generate the result as Chart ( JFreeChart tool )
>>            // NOTES: taken a long time to load because it generates
>> things
>> }
>>
>>
>> Explanation:
>> =========
>> Once i click on the reportLink , it will setResponsePage to the
>> ReportPage.class. So, once it load, for what i expected result is pop up
>> the
>> modal window and then the reportPage is loading at the backgroup.
>>
>> BUT then it was NOT. The actual result that i get is once the report page
>> is
>> finish loaded then only turn to pop up the modal window.
>>
>>
>> yes...you r right, my reportPage will taken a long time to load, because
>> it
>> generates the chart. That why i need to pop up a modal window at the same
>> time in order to let the user cancel the reportPage if the user don't
>> wait
>> for the page finish load.
>>
>>
>> thanks for your reply...
>>
>>
>> -kenix
>>
>>
>> Johan Compagner wrote:
>> >
>> > What is that ReportPage is that the page that also loads the modal
>> dialog?
>> > And that page is taken a long time to load? Because it generates
>> things?
>> >
>> > But for the modal dialog to work, the report page (if that is the modal
>> > dialogs parent)
>> > must first be fully loaded there is no other way.
>> >
>> > I stil dont get exactly what you suspect to happen, you think that the
>> > parent page
>> > that generates the report or something and that one doesn't load
>> > completely
>> > because it has to wait for the report
>> > can display the modal dialog already but itself isn't done yet?
>> >
>> > johan
>> >
>> >
>> >
>> > On Feb 4, 2008 2:18 PM, kenixwong <[EMAIL PROTECTED]> wrote:
>> >
>> >>
>> >> thx for reply, johan
>> >>
>> >> yes..you r right, when i click a link, I want redirect to a load a
>> page
>> >> and
>> >> then at the same time, a modal dialog is show immediately...
>> >>
>> >> my current testing here is... the modal window component is call at
>> the
>> >> parent class and then the report form is call at child class. Common
>> >> sense,
>> >> all the component at the parent class will call first before the child
>> >> class' component , right...
>> >>
>> >> yes... right now my page can load the modal window, but it is shown
>> after
>> >> the report page is finish load. The main reason i use the modalwindow
>> is
>> >> feasible the user to make decision whether want terminate the report
>> page
>> >> loading or not ( if the user don't want to wait until the page is
>> finish
>> >> load)
>> >>
>> >> as what you suggested on Jan 31, 2008.. yes.. i did. Add ajaxlink to
>> call
>> >> the modal window and then onload it. The code that i auto fire the
>> >> ajaxlink
>> >> is
>> >>
>> >> getBodyContainer().addOnLoadModifier(new ClickOnceOnLoadModel(
>> ajaxLink
>> >> ),
>> >> null );
>> >>
>> >> which i get the sample resource from this forum
>> >>
>> >>
>> http://www.nabble.com/modal-window-question---opening-a-modal-window-on-page-load-to12586008.html#a12598786
>> >>
>> >> yes..it worked. but it is loaded after the page is finish load.  :(
>> >>
>> >>
>> >> thanks in advance
>> >> - kenix
>> >>
>> >>
>> >>
>> >>
>> >> Johan Compagner wrote:
>> >> >
>> >> > what do you exactly want?
>> >> > you want a modal dialog to show immedianlty when another page is
>> >> loaded?
>> >> > I think you have to dig into the javascript portion of modal window
>> >> then
>> >> > (or
>> >> > matej can tell you a bit more)
>> >> >
>> >> > first of all the page below it has to load first completely because
>> >> that
>> >> > does contain the div.
>> >> >
>> >> > I do think you should think about your gui a bit more and if there
>> >> isn't
>> >> a
>> >> > better way of doing stuff
>> >> > because showing a modal dialog immediantly on a new page doesn't
>> make
>> >> much
>> >> > sense to me in 99.9% of the cases i can think of
>> >> >
>> >> > johan
>> >> >
>> >> > On Feb 4, 2008 12:24 PM, kenixwong <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> >>
>> >> >> hi,
>> >> >>
>> >> >> can anybody share the solution with me ?
>> >> >>
>> >> >> is that the javaScript is take time to load for the modal window
>> even
>> >> >> this
>> >> >> component is called before the form component is call?
>> >> >>
>> >> >>
>> >> >> anyone can help ? until now i still can't get any solution and
>> >> resource
>> >> >> yet...
>> >> >>
>> >> >>
>> >> >> thanks in advance,...
>> >> >> - kenix
>> >> >>
>> >> >>
>> >> >>
>> >> >> kenixwong wrote:
>> >> >> >
>> >> >> > 2 process cant together in a same time - modal window and form in
>> >> the
>> >> >> same
>> >> >> > page constructor?  Is because the process haven't done, so the
>> >> request
>> >> >> > wont send to wicket there?
>> >> >> >
>> >> >> > The main  reason i want to implement this features, caused modal
>> >> window
>> >> >> > can prevent the user navigate to other page or feasible the user
>> to
>> >> >> cancel
>> >> >> > the form process if the loading time is longer. Another point is,
>> >> >> because
>> >> >> > my report page is loading with JFreeChart to generate the chart
>> >> report.
>> >> >> If
>> >> >> > the user press right click to Open Link in new tab, the chart at
>> the
>> >> >> > previous tab will have the broken link issue means the chart is
>> cant
>> >> >> > display. So, modal window can play an important role here...
>> >> >> >
>> >> >> >
>> >> >> > I was using the wicket 1.2.4. Is it the version cant support it
>> and
>> >> i
>> >> >> need
>> >> >> > to upgrade ? i read from
>> >> >> > http://cwiki.apache.org/WICKET/wicket-130-rc1.html .. Migration
>> from
>> >> >> 1.2
>> >> >> > to 1.3, there is not much different for the modal window in both
>> >> >> version..
>> >> >> > can anyone give some solution to me?
>> >> >> >
>> >> >> >
>> >> >> > Thanks in advance
>> >> >> > - kenix
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > kenixwong wrote:
>> >> >> >>
>> >> >> >> thanks for reply, johan
>> >> >> >>
>> >> >> >> i want to show the modal window once the report page is load.
>> Mean
>> >> >> >> background is continue loading the report and the modal window
>> is
>> >> just
>> >> >> as
>> >> >> >> a control (its features is invisible the background and only
>> close
>> >> >> once
>> >> >> >> action performed is click in the modal window ) to prevent user
>> >> >> navigate
>> >> >> >> to other page. For the modal window it only define one cancel
>> >> button,
>> >> >> >> mean if user click the cancel button, the background ( report
>> page
>> >> )
>> >> >> is
>> >> >> >> stop.
>> >> >> >>
>> >> >> >> Yes... the modal window is only shown by an ajax link. I get the
>> >> >> source
>> >> >> >> from this forum ..where it can fire the ajaxlink whitout click
>> the
>> >> >> link.
>> >> >> >> Here is the code
>> >> >> >>
>> >> >> >>   <   getBodyContainer().addOnLoadModifier(new
>> >> ClickOnceOnLoadModel(
>> >> >> >> ajaxLink ), null );   >
>> >> >> >>
>> >> >> >> Even i tried to create a modal window with ajaxlink ( add auto
>> fire
>> >> >> event
>> >> >> >> as above code ) and put at the parent class and the report page
>> is
>> >> the
>> >> >> >> child class. But the result is same, the report page is finish
>> >> loaded
>> >> >> >> then only pop up the modal window.
>> >> >> >>
>> >> >> >> my report page constructor :
>> >> >> >>
>> >> >> >> public LineChart() {
>> >> >> >>     /// modal window use panel..declare the modal window setting
>> >> here
>> >> >> >> then add
>> >> >> >>      add(modalWindow);
>> >> >> >>
>> >> >> >>      // to auto pop up the modal window.
>> >> >> >>      ajaxLink = new AjaxLink("cancelReportModalLink"){
>> >> >> >>                 @Override
>> >> >> >>                 public void onClick(AjaxRequestTarget target) {
>> >> >> >>                         cancelReportModal.show(target);
>> >> >> >>                         }
>> >> >> >>                 };
>> >> >> >>      add(ajaxLink);
>> >> >> >>
>> >> >> >>       //  Fire the ajaxLink onclick function
>> >> >> >>      getBodyContainer().addOnLoadModifier(new
>> ClickOnceOnLoadModel(
>> >> >> >> ajaxLink ), null );
>> >> >> >>
>> >> >> >>      add(feedback);
>> >> >> >>      add(new LineChartForm("LineChartForm"));
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >> private class LineChartForm extends Form {
>> >> >> >>             // execute query
>> >> >> >>             // result as in JFreeChart
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >> i add the component for modal window then only come to form.
>> >> >> supposedly
>> >> >> >> it will show the modal window then load the form, am i right .
>> Why
>> >> ?
>> >> 2
>> >> >> >> process in a same time cant together?  Is because the process
>> >> haven't
>> >> >> >> done, so the request wont send to wicket there,
>> >> >> >>
>> >> >> >> 2 way i tried. Call the modal window at Parent class and also
>> child
>> >> >> >> class. But it still given me the same result.
>> >> >> >>
>> >> >> >> between, can you explain more or give example for the onload
>> event
>> >> >> that
>> >> >> >> you mentioned ? onLoad event for the modal window ? I was using
>> the
>> >> >> >> wicket 1.2.4. Is it the version cant support it and i need to
>> >> upgrade
>> >> >> ?
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> Thanks in advance
>> >> >> >>
>> >> >> >> - kenix
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> Johan Compagner wrote:
>> >> >> >>>
>> >> >> >>> how do you show the modal dialog??
>> >> >> >>> Normally the modal dialog is only shown by an ajax link.
>> >> >> >>> I guess you show it on onload event. Then yes the page will
>> first
>> >> >> load
>> >> >> >>> itself
>> >> >> >>> then call onload and then the modal window will show itself
>> >> >> >>>
>> >> >> >>> johan
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> On Jan 31, 2008 6:16 AM, kenixwong <[EMAIL PROTECTED]>
>> wrote:
>> >> >> >>>
>> >> >> >>>>
>> >> >> >>>> hi,
>> >> >> >>>>
>> >> >> >>>> for the above case, for example... my page constructor: i add
>> the
>> >> >> >>>> component
>> >> >> >>>> ( modal window, feedBackPanel, form ) . Once i load the page,
>> why
>> >> >> the
>> >> >> >>>> modal
>> >> >> >>>> window will only display when the page is finish loaded. Is
>> that
>> >> the
>> >> >> >>>> wicket
>> >> >> >>>> had default set the main thread for the form component?
>> >> >> >>>>
>> >> >> >>>> Thanks in advance
>> >> >> >>>> --
>> >> >> >>>> View this message in context:
>> >> >> >>>>
>> >> >>
>> >>
>> http://www.nabble.com/is-there-wicket-had-per-defined-the-Thread-for-the-form-component-tp15198385p15198385.html
>> >> >> >>>> Sent from the Wicket - User mailing list archive at
>> >> >> >>>> Nabble.com <http://nabble.com/> <http://nabble.com/> <
>> http://nabble.com/><
>> >> http://nabble.com/>
>> >> >> >>>> .
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> >>>> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >> >>>>
>> >> >> >>>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/is-there-wicket-had-per-defined-the-Thread-for-the-form-component-tp15198385p15266151.html
>> >> >>  Sent from the Wicket - User mailing list archive at
>> >> >> Nabble.com <http://nabble.com/> <http://nabble.com/><
>> http://nabble.com/>
>> >> >> .
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/is-there-wicket-had-per-defined-the-Thread-for-the-form-component-tp15198385p15267910.html
>> >>  Sent from the Wicket - User mailing list archive at
>> >> Nabble.com <http://nabble.com/><http://nabble.com/>
>> >> .
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/is-there-wicket-had-per-defined-the-Thread-for-the-form-component-tp15198385p15268878.html
>>  Sent from the Wicket - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> .
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/is-there-wicket-had-per-defined-the-Thread-for-the-form-component-tp15198385p15283841.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to