Currently we have a problem closing an Applet component in IE browser. We are using com.smartgwt.client.widgets.plugins.Applet class. And we put the applet inside a VLayout class, together they are held by a Window. The structure of source code can be summarized as below:
The above code works fine until we close the popup Window, which will invoke the onCloseClickHandler event, and the highlighted part of the source code will throw javascript exeption:
//*************************************Javascript Error********************************************************//
17:14:16,371 INFO [stdout] (http-/127.0.0.1:8080-11) === 2015-07-06 17:14:16,371 [0-11] INFO Compression - /eco/eco/sc/IDACall: 405 -> 283 bytes
17:14:53,245 INFO [stdout] (http-/127.0.0.1:8080-11) === 2015-07-06 17:14:53,215 [0-11] ERROR CrimsonRemoteLogger - Exception caught: (TypeError)
17:14:53,246 INFO [stdout] (http-/127.0.0.1:8080-11) description: Object doesn't support property or method 'hideDragMask'
17:14:53,246 INFO [stdout] (http-/127.0.0.1:8080-11) number: -2146827850
17:14:53,247 INFO [stdout] (http-/127.0.0.1:8080-11) stack: TypeError: Object doesn't support property or method 'hideDragMask'
17:14:53,247 INFO [stdout] (http-/127.0.0.1:8080-11) at $mc
Code:
//***************************************Source Code******************************************//
Applet app = new Applet();
VLayout appletContainer = new VLayout();
Window popupWindowModalApplet = new Window();
//Set popup window property
popupWindowModalApplet.setTitle("Title");
popupWindowModalApplet.setHeight(400);
popupWindowModalApplet.setWidth(600);
popupWindowModalApplet.setShowMinimizeButton(false);
popupWindowModalApplet.setIsModal(true);
popupWindowModalApplet.setShowModalMask(true);
popupWindowModalApplet.centerInPage();
//do something when closing the popup window
popupWindowModalApplet.addCloseClickHandler(new CloseClickHandler() {
@Override
public void onCloseClick(CloseClickEvent event) {
app.markForDestroy();
appletContainer.markForDestroy();
popupWindowModalApplet.close();
popupWindowModalApplet.markForDestroy(); //This is the part that will throw javascript error in IE Browser
//do some other things, e.g. refresh page
}
});
//Set applet properties
app.setCodeBase("./");
app.setCode("code.path.classname");
app.setArchive("executableJarFile.jar");
app.setName("Applet Name");
app.setClassID("ClassId");
app.setWidth("500");
app.setHeight("300");
app.setParams(getParameters());
app.setScriptable(true);
app.setMayScript(true);
//Put Applet inside a Vlayout
appletContainer.addMember(pca);
//Put the Vlayout inside the popup Window
popupWindowModalApplet.addItem(appletContainer);
popupWindowModalApplet.show();//*************************************Javascript Error********************************************************//
17:14:16,371 INFO [stdout] (http-/127.0.0.1:8080-11) === 2015-07-06 17:14:16,371 [0-11] INFO Compression - /eco/eco/sc/IDACall: 405 -> 283 bytes
17:14:53,245 INFO [stdout] (http-/127.0.0.1:8080-11) === 2015-07-06 17:14:53,215 [0-11] ERROR CrimsonRemoteLogger - Exception caught: (TypeError)
17:14:53,246 INFO [stdout] (http-/127.0.0.1:8080-11) description: Object doesn't support property or method 'hideDragMask'
17:14:53,246 INFO [stdout] (http-/127.0.0.1:8080-11) number: -2146827850
17:14:53,247 INFO [stdout] (http-/127.0.0.1:8080-11) stack: TypeError: Object doesn't support property or method 'hideDragMask'
17:14:53,247 INFO [stdout] (http-/127.0.0.1:8080-11) at $mc