gwt中的attachEvent无法正常工作

时间:2013-12-16 07:35:01

标签: gwt jsni attachevent

我正在尝试在GWT中集成拖放activeXPlugin。我成功地做到了。 这是我的代码片段

HTMLFlow streamingApplet = new HTMLFlow();
StringBuffer html = new StringBuffer();
html.append("<object id='Draggable' classid='CLSID:4794D615-BE51-4a1e-B1BA-453F6E9337C4' "
    + "codebase='OutLookDragAndDropControlSetup.msi' width='200'"
    + "height='325'/>");
streamingApplet.setContents(html.toString());
streamingApplet.setVisible(true);
appletLayout.addMember(streamingApplet);
RootPanel.get().add(appletLayout);
onLoadPlugin();

我正在尝试将一个事件附加到此activeX组件,该文件一旦被放入该组件就会被触发。

public void uploadDoc(String args1, String args2, String args3) {
    //Code to handle once the file is dropped in activeX Component
}

public native void onLoadPlugin() /*-{
    var that = this;
    var yourActiveXObject = $wnd.document.getElementById('Draggable');
    var handler = function onDropCompleteEvent(args1, args2, args3) {
        that.@com.xl.client.view.ActiveXPlugin::uploadDoc(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(args1, args2, args3);
    }
    if (yourActiveXObject.addEventListener) {
        var status = yourActiveXObject.addEventListener('DropCompleteEvent',
            $entry(handler), false);
            alert("Listener status  :" + status);
    } else if (yourActiveXObject.attachEvent) {
        var status = yourActiveXObject.attachEvent('DropCompleteEvent',
            $entry(handler));
            alert("Attach status  :" + status);
    }
}-*/;
The activeX component got integrated successfully and the files are getting dropped into the component. However as per the attachEvent the event is not getting fired.

有人可以帮忙解决这个问题吗?非常感谢任何帮助。

我在Windows 7和GWT版本2.5.1上运行IE9。

此致 伊利亚斯

0 个答案:

没有答案