I created a widget to embed a Java applet in my web page. Since IE
requires an <object> tag while other browsers need a <embed> tag, I
used deferred binding to get the correct implementation and used
UiBinder to setup the HTML. However, in IE, when the Widget is
inserted into the page, the HTML is way off from what I wrote and
sadly the extra applet params that need to be passed to my applet are
not passed.

Here's my widget's ui.xml:

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'>
    <div>
            <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                name="Uploader" width="100%" height="350"
                codebase="http://java.sun.com/update/1.6.0/jinstall-6u16-
windows-i586.cab#Version=6,0,0,1">
                <param name="code"
value="org.jets3t.apps.uploader.Uploader.class" />
                <param name="codebase" value="." />
                <param name="archive"
                    value="uploader-0.7.1-signed.jar,jets3t-0.7.1-
signed.jar,jets3t-gui-0.7.1-signed.jar,commons-codec-1.3-
signed.jar,commons-httpclient-3.1-signed.jar,commons-logging-1.1.1-
signed.jar" />
                <param name="type" value="application/x-java-
applet;version=1.6" />
                <param name="scriptable" value="false" />
                <param name="mayscript" value="false" />
                <param ui:field="uriParam" name="uri" value="" />
                <param ui:field="tokenParam" name="token" value="" />
                No Java Support.
            </object>
    </div>
</ui:UiBinder>

I need to be able to set the value of the 'uri' and 'token' params, so
I grab a reference to those with UiBinder. Here's my widget code:

public class UploaderWidgetImplIE extends UploaderWidgetImpl {

    interface Binder extends UiBinder<DivElement,
UploaderWidgetImplIE> {
    };

    private static final Binder binder = GWT.create(Binder.class);

    @UiField
    ParamElement tokenParam;

    @UiField
    ParamElement uriParam;

    UploaderWidgetImplIE() {
        setElement(binder.createAndBindUi(this));
    }

    @Override
    public void setToken(String token) {
        this.tokenParam.setValue(token);
    }

    @Override
    public void setUri(String uri) {
        this.uriParam.setValue(uri);
    }

}

And finally, my entry point to tie this all together:

    public void onModuleLoad() {
        String eventUri = Window.Location.getParameter("uri");
        String token = Window.Location.getParameter("token");

        UploaderWidgetImpl impl = GWT.create
(UploaderWidgetImpl.class);
        impl.setUri(uri);
        impl.setToken(token);

        GWT.log(uploader.getElement().getInnerHTML(), null);
        RootPanel.get("uploader").add(uploader);
    }


Now the bizarre part: The GWT.log() statement there prints the
following to the console:

<OBJECT name=Uploader codeBase="http://java.sun.com/update/1.6.0/
jinstall-6u16-windows-i586.cab#Version=6,0,0,1" classid=clsid:
8AD9C840-044E-11D1-B3E9-00805F499D93 width="100%" height=350><PARAM
NAME="_cx" VALUE="5080"><PARAM NAME="_cy" VALUE="5080"> No Java
Support. </OBJECT>

Where in the heck did the rest of my HTML go? It's the same thing if I
print this out again after the widget is placed into the DOM. Even
though the HTML printed here does NOT contain information about the
Applet's main class or classpath entries, the applet does start,
albeit without my 'uri' and 'token' parameters. If I use IE8's
developer tools to inspect the DOM, it shows me the correct HTML has
been added to the DOM.

So what's going on here? Any ideas?

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to