0

onClose window getting message Desktop Destroy Please Help !!!

asked 2010-08-09 16:11:35 +0800

sachinkakkar gravatar image sachinkakkar
15

Hello,
In my application on click of Save button (Parent window-Light Box) we are opening a small window (Child window) stating that Thanks for updating your Info. On click of 'Ok' button we need to close both the window (Parent & Child window).

Child window code for close the window:

<button id="idOk" label="OK" onClick='Executions.getCurrent().sendRedirect("");' />

Now on click of 'OK' button getting exception message - java.lang.InterruptedException: Destroy desktop [Desktop Desktop_2]

I have tried win.visible=false;event.stopPropagation();

but nothing works for me.
Please suggest what is the correct way to close both the window.

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2010-08-10 01:21:07 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-08-10 01:21:42 +0800

try win.onClose() or win.detach();

link publish delete flag offensive edit

answered 2010-08-10 10:16:13 +0800

sachinkakkar gravatar image sachinkakkar
15

I have used win.detach() here:
<button id="idOk" label="OK" onClick='win.detach();' />
then it close only child window.
if i put
<button id="idOk" label="OK" onClick='win.detach();parentWin.detach();' />
it throwing some exception message.


I have to close both the window onClick of button.

link publish delete flag offensive edit

answered 2010-08-10 11:06:10 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-08-10 11:06:42 +0800

No chance to solve this if we can not seen your code i.e. where are the main window and where are the child window.

If you will close the main window from a child window, so the childwindow must have access to it. You can do such things by overhanding the mainWindow controller self in a paramMap by using the Executions.createComponents() methode for creating a child window.

link publish delete flag offensive edit

answered 2010-08-10 14:29:05 +0800

sachinkakkar gravatar image sachinkakkar
15

updated 2010-08-10 14:38:25 +0800

i can give you some code snippet here:

<zk>
  <window id="parentWin" apply="${Controller}" border="normal" mode="modal"
		 width="530px"  closable="true" onClose="cancelWin.doModal();event.stopPropagation();" height="800px">
  <html:div class="es-scrollable" style="width: 522px;"> 
		<html:form class="es-form my-form">
		<grid id="grid_number" mold="table-less">
			<rows mold="table-less">
                            <row id="ROW_number" mold="table-less">
                               <label value="Welcome" />
                               <button id="okButton"
						label="OK"
						forward="onClick=Form.onOk" 
						zclass="es-btn-new"
						sclass="fr" />
                             </row>
                         </rows>
		   </grid>
    </html:div>

    <window id="childWin" width="400px"  visible="false" title="Confirmation"
				closable="true" border="normal" onClose="self.visible = false; event.stopPropagation();">
				
		<grid mold="form-table-less">
			<rows>
				<row mold="table-less">
					<html:p>Thanks.</html:p>
					<html:div class="bottom-buttons">	
					<button sclass="fr" id="regOK" label="OK" onClick='Executions.getCurrent().sendRedirect("");' />
					
				</html:div>
				</row>	
			</rows>
		</grid>			
	</window>

  </window>
</zk>

when user click on "Ok" button in controller I am calling "onOk" method:
that process some business logic and on success, execute following code:

Window saveModalWin = (Window) win.getFellowIfAny("childWin");
	saveModalWin.doModal();

and from controller this child window opens properly. but as user click on "Ok" button it throws java.lang.InterruptedException: Destroy desktop [Desktop Desktop_2] exception message.

may be this code snippet gives you some insight.
Thanks.

link publish delete flag offensive edit

answered 2010-08-10 15:32:45 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-08-10 15:35:25 +0800

No chance for me. Seems there is not a clean line how to call the controllers and what should be in the java code or zul.

Window saveModalWin = (Window) win.getFellowIfAny("childWin");
	saveModalWin.doModal();

The saveWindow controller must have access to the parentWindowController. If you whish to close it from the SaveWindow.
Does your window controllers extends GenericForwardComposer?
.
event.stopPropagation();

I need this only if i have more than one method like onClick&btnHelp equalNamed in a tree of windows.

Think about why you need more than one <window> component (nameSpace) in a zul-file.

best
Stephan

link publish delete flag offensive edit

answered 2010-08-11 14:19:50 +0800

sachinkakkar gravatar image sachinkakkar
15

My requirement is : I have registration page (light box window), user enters his all information and click on the save button. we are opening a model window with message "Is entered information are correct" if he clicks on "Yes" all the entered information get save in DB and both the window save Window and Registration window should get closed. if user click on "No", return back to the registration page.
Yes my window controller extending GenericForwardComposer.

In my Controller java file, I am validating all the entered values and after successful validation opening save Window with following code:

Window saveModalWin = (Window) win.getFellowIfAny("saveWin");
	 saveModalWin.doModal();

once save Window open user clicks on the "Ok" button and following code executes:

<button sclass="fr" id="regOK" label="OK" onClick='Executions.getCurrent().sendRedirect("");' />

once user clicks on this Ok button i am getting exception message on my console stating that desktop destroy.
I have tried with window.detach(), but it close save window correctly but for registration window it throwing some error message.

link publish delete flag offensive edit

answered 2010-08-11 17:06:04 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-08-11 17:51:04 +0800

Window saveModalWin = (Window) win.getFellowIfAny("saveWin");
	 saveModalWin.doModal()
;

I have problem to understand you. Why you do not call a simple Messagebox for asking 'if the data are correct? and evaluating the pressed button ( OK or NO ) ? In both cases THIS Messagebox is closed and you can go further.


If you do creating your modal windows with Executions.createComponents( "myModalWindow.zul", parent, paramMap) you can overhanded the parentController in the paramMap. In the ChildModalWindow you can read them back and have FULL access to the parent window.

Have a look on this Picture. All the modal windows have access to the underlaying parent windows.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-08-09 16:11:35 +0800

Seen: 999 times

Last updated: Aug 11 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More