Close Pop up window when cancel on dialog box is pressed

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 10
Reputation: adityam4444 is an unknown quantity at this point 
Solved Threads: 0
adityam4444's Avatar
adityam4444 adityam4444 is offline Offline
Newbie Poster

Close Pop up window when cancel on dialog box is pressed

 
0
  #1
Jul 3rd, 2008
Hello

I have a jsp on which there is a table and a hyperlink to Export the same table into excel sheet. According to the functionality, it is required that on clicking Export, a blank pop up without address bar and other toolbars will be opened and on that empty pop up, the dialog box for Open, Save or Cancel Excel file will come.

Now, if the user clicks on open, the excel file opens in the pop up. But if user clicks on either save or cancel, in the both cases, the blank pop up remains opened. Please suggest the ways to close it automatically when save or cancel is clicked.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 9
Reputation: diasmvds is an unknown quantity at this point 
Solved Threads: 0
diasmvds diasmvds is offline Offline
Newbie Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #2
Jul 11th, 2008
Can't u just use dispose() or hide() methods of Popup ??
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 29
Reputation: loken is an unknown quantity at this point 
Solved Threads: 0
loken's Avatar
loken loken is offline Offline
Light Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #3
Jul 17th, 2008
Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.

What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?
Last edited by loken; Jul 17th, 2008 at 5:02 am. Reason: additional information
Crash dump, something worse than dying...
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 10
Reputation: adityam4444 is an unknown quantity at this point 
Solved Threads: 0
adityam4444's Avatar
adityam4444 adityam4444 is offline Offline
Newbie Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #4
Jul 25th, 2008
Originally Posted by loken View Post
Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.

What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?
I do not have any BODY in the pop up because the page that is going to be loaded on that pop up is in excel format. Therefore I don't know where to place the code to close unused pop up.

If the user clicks on Open, then only the jsp will be loaded in the excel format on that pop up, else in case of Save and Cancel, the pop up will remain without Body. That is why I could not provide any code for that.

I want to know, can something be done in the opener of that pop up?

Same problem was present in Google Analytics, but here on clicking on Export, a new Browser window is opened, not any pop up.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 29
Reputation: loken is an unknown quantity at this point 
Solved Threads: 0
loken's Avatar
loken loken is offline Offline
Light Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #5
Jul 31st, 2008
you usually place disposer() and flush() codes on events such as windowclose,windowopen and etc....

if you wish to open a popup when you click on export, you can simply call yourpopupid.open() method...
or is that what you intend to do?
Crash dump, something worse than dying...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 29
Reputation: loken is an unknown quantity at this point 
Solved Threads: 0
loken's Avatar
loken loken is offline Offline
Light Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #6
Jul 31st, 2008
similarly you can call the dispose() or flush() or even setVisible(false) method on the click event for the cancel button. that way the popup should close.
Crash dump, something worse than dying...
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 10
Reputation: adityam4444 is an unknown quantity at this point 
Solved Threads: 0
adityam4444's Avatar
adityam4444 adityam4444 is offline Offline
Newbie Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #7
Aug 6th, 2008
Originally Posted by loken View Post
similarly you can call the dispose() or flush() or even setVisible(false) method on the click event for the cancel button. that way the popup should close.
My Dear Loken, those Cancel, Save and Open buttons are of windows dialog box, not of any which I am creating.

Let me explain. Assume X.jsp is a page on which a link Export is present. On clickicking it, a new Pop up is opened which DOES NOT have any body. A new page called Y.jsp will be loaded on this pop up in Excel Format. In Y.jsp I am using contentType="application/vnd.ms-excel; charset=UTF-8" in Y.jsp, that is why I cannot place any javascript code on Y.jsp.

I have attached the view of Dialog Box. If Open is pressed, Y.jsp will be loaded on EMPTY pop up, else, the pop up will be there without any body.
Attached Images
File Type: bmp DialogBox.bmp (342.1 KB, 6 views)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 29
Reputation: loken is an unknown quantity at this point 
Solved Threads: 0
loken's Avatar
loken loken is offline Offline
Light Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #8
Aug 6th, 2008
ok, seems I must have misunderstood you...sorry about that...

this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}

I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...
Crash dump, something worse than dying...
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 10
Reputation: adityam4444 is an unknown quantity at this point 
Solved Threads: 0
adityam4444's Avatar
adityam4444 adityam4444 is offline Offline
Newbie Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #9
Aug 9th, 2008
Originally Posted by loken View Post
ok, seems I must have misunderstood you...sorry about that...

this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}

I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...
Thanks Loken, I will try this code. But I have confusions.
- Do have to place this code snippet in the JSP which will be loaded as excel file?
- Does this onCancel function needs any input parameters? Because how onCancel() will know that Cancel or Save is pressed?
- Javascript function in an excel file... Believe me.... I am surprised.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 10
Reputation: adityam4444 is an unknown quantity at this point 
Solved Threads: 0
adityam4444's Avatar
adityam4444 adityam4444 is offline Offline
Newbie Poster

Re: Close Pop up window when cancel on dialog box is pressed

 
0
  #10
Aug 11th, 2008
Hi Loken

Sorry to say, that method onCancel didnt work. We have to think more on that.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC