Re: How to redirect from a ModalWindow

2009-09-12 Thread Vladimir K

Try adding this one to the page markup

script language=javascript type=text/javascript
jQuery(document).ready(function(){
if (typeof Wicket != 'undefined'  
Wicket.Window)
Wicket.Window.unloadConfirmation = 
false;
});
/script


Matthias Keller wrote:
 
 Hi Peter
 
 You would be right as long as it wasn't for a ModalWindow.
 When having an open ModalWindow, wicket seems to register an unload 
 javascript event which - when trying to navigate away from the page (be 
 it by following a link, closing the window etc), displays a confirmation 
 message which you have to accept. I need to avoid that message, but the 
 only way to do that probably is by closing that window first so that the 
 javascript event gets unloaded.
 
 Matt
 
 Peter Ertl wrote:


 throw new RestartResponseException(OtherPage.class)

 window.close() is not needed!


 Am 10.09.2009 um 12:50 schrieb Matthias Keller:

 OtherPage.class


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

 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/How-to-redirect-from-a-ModalWindow-tp25381117p25411990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: How to redirect from a ModalWindow

2009-09-12 Thread Mikko Pukki
Hi,

I wouldn't mess around with such scripts unless really necessary. Mainly, 
because
Wicket can handle domreadyEvents on its own. I solved the problem by extending
ModalWindow and by adding a behavior that disables the unloadConfirmation. Like 
this:


public MyModalWindow(String id, IModel title, int initialHeight, int 
initialWidth)
{
super(id);

setTitle(title);

add(new DisableDefaultConfirmBehavior());


private class DisableDefaultConfirmBehavior extends AbstractBehavior 
implements IHeaderContributor {

private static final long   serialVersionUID= 1L;

@Override
public void renderHead(IHeaderResponse response)
{

response.renderOnDomReadyJavascript(Wicket.Window.unloadConfirmation = false);
}

}

Of course, when having multiple Modal windows on the same page, that script 
would fire multiple
times, but then again, would it be a good idea to have multiple modal windows 
in the first place?

- Mikko


-Original Message-
From: Vladimir K [mailto:koval...@gmail.com] 
Sent: 12. syyskuuta 2009 9:37
To: users@wicket.apache.org
Subject: Re: How to redirect from a ModalWindow


Try adding this one to the page markup

script language=javascript type=text/javascript
jQuery(document).ready(function(){
if (typeof Wicket != 'undefined'  
Wicket.Window)
Wicket.Window.unloadConfirmation = 
false;
});
/script


Matthias Keller wrote:
 
 Hi Peter
 
 You would be right as long as it wasn't for a ModalWindow.
 When having an open ModalWindow, wicket seems to register an unload 
 javascript event which - when trying to navigate away from the page (be 
 it by following a link, closing the window etc), displays a confirmation 
 message which you have to accept. I need to avoid that message, but the 
 only way to do that probably is by closing that window first so that the 
 javascript event gets unloaded.
 
 Matt
 
 Peter Ertl wrote:


 throw new RestartResponseException(OtherPage.class)

 window.close() is not needed!


 Am 10.09.2009 um 12:50 schrieb Matthias Keller:

 OtherPage.class


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

 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/How-to-redirect-from-a-ModalWindow-tp25381117p25411990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


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



Re: How to redirect from a ModalWindow

2009-09-12 Thread Peter Ertl
Wouldn't it make sense to disable this confirmation dialog in  
deployment mode?


What is it good for anyway?

Am 12.09.2009 um 14:50 schrieb Mikko Pukki:


Hi,

I wouldn't mess around with such scripts unless really necessary.  
Mainly, because
Wicket can handle domreadyEvents on its own. I solved the problem by  
extending
ModalWindow and by adding a behavior that disables the  
unloadConfirmation. Like this:



	public MyModalWindow(String id, IModel title, int initialHeight,  
int initialWidth)

{
super(id);

setTitle(title);

add(new DisableDefaultConfirmBehavior());


	private class DisableDefaultConfirmBehavior extends  
AbstractBehavior implements IHeaderContributor {


private static final long   serialVersionUID= 1L;

@Override
public void renderHead(IHeaderResponse response)
{
			response.renderOnDomReadyJavascript 
(Wicket.Window.unloadConfirmation = false);

}

}

Of course, when having multiple Modal windows on the same page, that  
script would fire multiple
times, but then again, would it be a good idea to have multiple  
modal windows in the first place?


- Mikko


-Original Message-
From: Vladimir K [mailto:koval...@gmail.com]
Sent: 12. syyskuuta 2009 9:37
To: users@wicket.apache.org
Subject: Re: How to redirect from a ModalWindow


Try adding this one to the page markup

script language=javascript type=text/javascript
jQuery(document).ready(function(){
if (typeof Wicket != 'undefined'  
Wicket.Window)
Wicket.Window.unloadConfirmation = 
false;
});
/script


Matthias Keller wrote:


Hi Peter

You would be right as long as it wasn't for a ModalWindow.
When having an open ModalWindow, wicket seems to register an unload
javascript event which - when trying to navigate away from the page  
(be
it by following a link, closing the window etc), displays a  
confirmation
message which you have to accept. I need to avoid that message, but  
the
only way to do that probably is by closing that window first so  
that the

javascript event gets unloaded.

Matt

Peter Ertl wrote:



   throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:


OtherPage.class



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








--
View this message in context: 
http://www.nabble.com/How-to-redirect-from-a-ModalWindow-tp25381117p25411990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


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



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



Re: How to redirect from a ModalWindow

2009-09-12 Thread Ryan McKinley

even better is to add this call to the request that opens the window:

onClick( AjaxRequestTarget target )
{
  target.appendJavascript( Wicket.Window.unloadConfirmation =  
false; );

  ...
  modal.show( target);
}

This way the logic is still contained in java and it works for a panel  
or a page popup.




On Sep 12, 2009, at 2:36 AM, Vladimir K wrote:



Try adding this one to the page markup

script language=javascript type=text/javascript
jQuery(document).ready(function(){
if (typeof Wicket != 'undefined'  
Wicket.Window)
Wicket.Window.unloadConfirmation = 
false;
});
/script


Matthias Keller wrote:


Hi Peter

You would be right as long as it wasn't for a ModalWindow.
When having an open ModalWindow, wicket seems to register an unload
javascript event which - when trying to navigate away from the page  
(be
it by following a link, closing the window etc), displays a  
confirmation
message which you have to accept. I need to avoid that message, but  
the
only way to do that probably is by closing that window first so  
that the

javascript event gets unloaded.

Matt

Peter Ertl wrote:



   throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:


OtherPage.class



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








--
View this message in context: 
http://www.nabble.com/How-to-redirect-from-a-ModalWindow-tp25381117p25411990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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




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



Re: How to redirect from a ModalWindow

2009-09-11 Thread Michal Kurtak
Hi Matthias,

Try to navigate to another page from WindowClosedCallback

window.close(target);
window.setWindowClosedCallback(new WindowClosedCallback()
{
 public void onClose(AjaxRequestTarget target)
 {
   setResponsePage(OtherPage.class);
 }
}


But remember to remove WindowClosedCallback before you open your
window next time

Michal

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



Re: How to redirect from a ModalWindow

2009-09-11 Thread Peter Ertl

That is sick! :-(

Isn't there a better solution?


Am 11.09.2009 um 08:42 schrieb Michal Kurtak:


Hi Matthias,

Try to navigate to another page from WindowClosedCallback

window.close(target);
window.setWindowClosedCallback(new WindowClosedCallback()
{
public void onClose(AjaxRequestTarget target)
{
  setResponsePage(OtherPage.class);
}
}


But remember to remove WindowClosedCallback before you open your
window next time

Michal

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



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



Re: How to redirect from a ModalWindow

2009-09-10 Thread Peter Ertl



throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:


OtherPage.class



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



Re: How to redirect from a ModalWindow

2009-09-10 Thread Matthias Keller

Hi Peter

You would be right as long as it wasn't for a ModalWindow.
When having an open ModalWindow, wicket seems to register an unload 
javascript event which - when trying to navigate away from the page (be 
it by following a link, closing the window etc), displays a confirmation 
message which you have to accept. I need to avoid that message, but the 
only way to do that probably is by closing that window first so that the 
javascript event gets unloaded.


Matt

Peter Ertl wrote:



throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:


OtherPage.class



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





smime.p7s
Description: S/MIME Cryptographic Signature