You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Branislav Kalas <bk...@gmail.com> on 2010/07/04 21:19:43 UTC

Page maps problem

Hi,
sorry for my terrible english.I am trying to achieve this:
I have webapp where i want to allow users open some links in new window. 
I want to create new page maps for those windows (cause i think , it's 
correct (page expired problem)).
In some pages i use pickers that opens modal windows (and this modal 
windows runs also in new page maps).
I have default setting of maximum page maps (which is 6)
Wicket version  is 1.4.1 (maybe i can upgrade if it solves the problem)
My problem is that when i open link in new window and open modal window 
in old page for 5 times, new window returns to login page (which is IMHO 
caused by its removed page map from session).
I tried to delete page map of modal window when it is closed but without 
success.

I got this in init method of application class:
         getPageSettings().setAutomaticMultiWindowSupport(true);

I got this in modal window close events :
       modal.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {
             public void onClose(AjaxRequestTarget target) {
                 target.addComponent(ProductPicker.this);
                 Session.get().removePageMap(modal.getPage().getPageMap());

             }
         });
         modal.setCloseButtonCallback(new 
ModalWindow.CloseButtonCallback() {
             public boolean onCloseButtonClicked(AjaxRequestTarget target) {
                 target.addComponent(ProductPicker.this);
                 Session.get().removePageMap(modal.getPage().getPageMap());
                 return true;
             }
         });
This is how i am creating modal window:
     modal.setCookieName("modal");
         modal.setHeightUnit("px");
         modal.setWidthUnit("px");
         modal.setInitialWidth(900);
         modal.setInitialHeight(800);
         modal.setTitle(new 
StringResourceModel("productPickerModal.label", this, null));
         modal.setVersioned(false);

And this are links that opens in new pages (tabs) :
   //java part
   Link newWindowMenuItemLink = new Link("newWindowMenuItemLink") {
                         @Override
                         public void onClick() {
                                     
setResponsePage(lItem.getPageClass().newInstance());
             }
   //html part
<a class="swap" wicket:id="newWindowMenuItemLink" href="#" 
target="_blank"><span class="alt">Click;</span></a>

Can you pls give me any hint what could be possibly wrong,or how can i 
delete modal window page map when it is closed?

Ideally i would like also remove page maps when user closes browser window.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page maps problem

Posted by Branislav Kalas <bk...@gmail.com>.
Thanks, when i turned off automaticMultiWindow support and set page map 
name manually for modal window,
page map for modal window was removed after modal window close.

Now i am trying to figure out some way to removing page map after close 
page opened in new tab or in new browser window. After some experiments 
(ajax behavior with respond method, ajax link, link...) i think this is 
not possible using just wicket api (cause if i removed page map inajax 
request that page map will be recreated after request)
It would be possible if i can add behavior to main page which user 
cannot close (because he/she willnow about this fact) and then on page 
in new window i will just use getCallBackScript() in onbefoureunload 
event or in some onclick event (it is not problem to have separate 
button for closing new window). Problem is that those main page could 
not be in stack anymore at the moment ( i think it's not problem to 
call  some ajax on page that is not actual in page map).
Maybe it is possible with use of some servlet that would be ignored by 
wicket filter.
Anyway this is absolutely not critical, it would be just nice to know 
how many windows has user currently opened and to forbid open new window 
after some count. It would also prevent removing page map that could be 
possibly still in use.
If you understand what i mean (cause i am still just beginner in wicket) 
i would appreciate any hints for this.





On 07/05/2010 07:09 PM, Igor Vaynberg wrote:
> you should set all the popups to use the same pagemap, i think that should help.
>
> -igor
>
> On Sun, Jul 4, 2010 at 12:19 PM, Branislav Kalas<bk...@gmail.com>  wrote:
>    
>> Hi,
>> sorry for my terrible english.I am trying to achieve this:
>> I have webapp where i want to allow users open some links in new window. I
>> want to create new page maps for those windows (cause i think , it's correct
>> (page expired problem)).
>> In some pages i use pickers that opens modal windows (and this modal windows
>> runs also in new page maps).
>> I have default setting of maximum page maps (which is 6)
>> Wicket version  is 1.4.1 (maybe i can upgrade if it solves the problem)
>> My problem is that when i open link in new window and open modal window in
>> old page for 5 times, new window returns to login page (which is IMHO caused
>> by its removed page map from session).
>> I tried to delete page map of modal window when it is closed but without
>> success.
>>
>> I got this in init method of application class:
>>         getPageSettings().setAutomaticMultiWindowSupport(true);
>>
>> I got this in modal window close events :
>>       modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
>>             public void onClose(AjaxRequestTarget target) {
>>                 target.addComponent(ProductPicker.this);
>>                 Session.get().removePageMap(modal.getPage().getPageMap());
>>
>>             }
>>         });
>>         modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
>>             public boolean onCloseButtonClicked(AjaxRequestTarget target) {
>>                 target.addComponent(ProductPicker.this);
>>                 Session.get().removePageMap(modal.getPage().getPageMap());
>>                 return true;
>>             }
>>         });
>> This is how i am creating modal window:
>>     modal.setCookieName("modal");
>>         modal.setHeightUnit("px");
>>         modal.setWidthUnit("px");
>>         modal.setInitialWidth(900);
>>         modal.setInitialHeight(800);
>>         modal.setTitle(new StringResourceModel("productPickerModal.label",
>> this, null));
>>         modal.setVersioned(false);
>>
>> And this are links that opens in new pages (tabs) :
>>   //java part
>>   Link newWindowMenuItemLink = new Link("newWindowMenuItemLink") {
>>                         @Override
>>                         public void onClick() {
>>
>>   setResponsePage(lItem.getPageClass().newInstance());
>>             }
>>   //html part
>> <a class="swap" wicket:id="newWindowMenuItemLink" href="#"
>> target="_blank"><span class="alt">Click;</span></a>
>>
>> Can you pls give me any hint what could be possibly wrong,or how can i
>> delete modal window page map when it is closed?
>>
>> Ideally i would like also remove page maps when user closes browser window.
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Page maps problem

Posted by Igor Vaynberg <ig...@gmail.com>.
you should set all the popups to use the same pagemap, i think that should help.

-igor

On Sun, Jul 4, 2010 at 12:19 PM, Branislav Kalas <bk...@gmail.com> wrote:
> Hi,
> sorry for my terrible english.I am trying to achieve this:
> I have webapp where i want to allow users open some links in new window. I
> want to create new page maps for those windows (cause i think , it's correct
> (page expired problem)).
> In some pages i use pickers that opens modal windows (and this modal windows
> runs also in new page maps).
> I have default setting of maximum page maps (which is 6)
> Wicket version  is 1.4.1 (maybe i can upgrade if it solves the problem)
> My problem is that when i open link in new window and open modal window in
> old page for 5 times, new window returns to login page (which is IMHO caused
> by its removed page map from session).
> I tried to delete page map of modal window when it is closed but without
> success.
>
> I got this in init method of application class:
>        getPageSettings().setAutomaticMultiWindowSupport(true);
>
> I got this in modal window close events :
>      modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
>            public void onClose(AjaxRequestTarget target) {
>                target.addComponent(ProductPicker.this);
>                Session.get().removePageMap(modal.getPage().getPageMap());
>
>            }
>        });
>        modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
>            public boolean onCloseButtonClicked(AjaxRequestTarget target) {
>                target.addComponent(ProductPicker.this);
>                Session.get().removePageMap(modal.getPage().getPageMap());
>                return true;
>            }
>        });
> This is how i am creating modal window:
>    modal.setCookieName("modal");
>        modal.setHeightUnit("px");
>        modal.setWidthUnit("px");
>        modal.setInitialWidth(900);
>        modal.setInitialHeight(800);
>        modal.setTitle(new StringResourceModel("productPickerModal.label",
> this, null));
>        modal.setVersioned(false);
>
> And this are links that opens in new pages (tabs) :
>  //java part
>  Link newWindowMenuItemLink = new Link("newWindowMenuItemLink") {
>                        @Override
>                        public void onClick() {
>
>  setResponsePage(lItem.getPageClass().newInstance());
>            }
>  //html part
> <a class="swap" wicket:id="newWindowMenuItemLink" href="#"
> target="_blank"><span class="alt">Click;</span></a>
>
> Can you pls give me any hint what could be possibly wrong,or how can i
> delete modal window page map when it is closed?
>
> Ideally i would like also remove page maps when user closes browser window.
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org