Hello,
I am developping an application using SmartGWT where i have a page with some list and on clicking one of the row i have to open another application (developped using Struts) in popup mode.
The user is allowed to take some decisions in the popup window application and close the popup window.
now i have to refresh the parent window.
I successfully opened the struts application in popup and using some javascript i tried to close the popup , i am able to close the application but not the gwt popup window.
I tried to add a button on the gwt popup window to close and refresh the parent window .
What i want is to close the popup window from struts application and refresh the gwt application.
Please help me.
Here is the code what i have done so far.
***** gwt popup window. *****
**** and my struts application window has a button to close the window***
this way
function closeWindow(){
self.opener = this;
self.close();
}
******
If there is another way of doing please let me know ..
I am developping an application using SmartGWT where i have a page with some list and on clicking one of the row i have to open another application (developped using Struts) in popup mode.
The user is allowed to take some decisions in the popup window application and close the popup window.
now i have to refresh the parent window.
I successfully opened the struts application in popup and using some javascript i tried to close the popup , i am able to close the application but not the gwt popup window.
I tried to add a button on the gwt popup window to close and refresh the parent window .
What i want is to close the popup window from struts application and refresh the gwt application.
Please help me.
Here is the code what i have done so far.
***** gwt popup window. *****
Code:
import java.util.ArrayList; import java.util.List; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; public class PopupWindow extends Window { public static interface CloseHandler { void onClosed(String message); } private List<CloseHandler> closeHandlers = new ArrayList<CloseHandler>(); public void addCloseHandler(CloseHandler handler) { closeHandlers.add(handler); } public void removeHandler(CloseHandler handler) { closeHandlers.remove(handler); } public void fireCloseEvent(String message) { for (CloseHandler handler : closeHandlers) handler.onClosed(message); } public PopupWindow() { } }
Code:
private void showPopupWindow(String url) { final PopupWindow wndPopup=new PopupWindow(); wndPopup.addCloseHandler(new CloseHandler() { public void onClosed(String message) { Window.Location.reload(); } }); //wndPopup.setTitle("Popup Window"); wndPopup.setSize("80%", "80%"); wndPopup.centerInPage(); wndPopup.setSrc(url); IButton btnClosePopupWindow = new IButton("Close"); btnClosePopupWindow.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.Location.reload(); wndPopup.destroy(); //wndPopup.fireCloseEvent("Popup window has been destroyed"); } }); wndPopup.addMember(btnClosePopupWindow); wndPopup.showMember(btnClosePopupWindow); wndPopup.show(); }
this way
function closeWindow(){
self.opener = this;
self.close();
}
******
If there is another way of doing please let me know ..