Search in sources :

Example 1 with BrowserFieldListener

use of net.rim.device.api.browser.field2.BrowserFieldListener in project CodenameOne by codenameone.

the class BlackBerryOS5Implementation method createBrowserComponent.

public PeerComponent createBrowserComponent(Object browserComponent) {
    synchronized (UiApplication.getEventLock()) {
        BrowserField bff = new BrowserField();
        final BrowserComponent cmp = (BrowserComponent) browserComponent;
        bff.addListener(new BrowserFieldListener() {

            public void documentError(BrowserField browserField, Document document) throws Exception {
                cmp.fireWebEvent("onError", new ActionEvent(document.getDocumentURI()));
                super.documentError(browserField, document);
            }

            public void documentCreated(BrowserField browserField, ScriptEngine scriptEngine, Document document) throws Exception {
                cmp.fireWebEvent("onStart", new ActionEvent(document.getDocumentURI()));
                super.documentCreated(browserField, scriptEngine, document);
            }

            public void documentLoaded(BrowserField browserField, Document document) throws Exception {
                cmp.fireWebEvent("onLoad", new ActionEvent(document.getDocumentURI()));
                super.documentLoaded(browserField, document);
            }
        });
        return PeerComponent.create(bff);
    }
}
Also used : BrowserFieldListener(net.rim.device.api.browser.field2.BrowserFieldListener) BrowserComponent(com.codename1.ui.BrowserComponent) ActionEvent(com.codename1.ui.events.ActionEvent) Document(org.w3c.dom.Document) BrowserField(net.rim.device.api.browser.field2.BrowserField) DatabaseIOException(net.rim.device.api.database.DatabaseIOException) DatabasePathException(net.rim.device.api.database.DatabasePathException) IOException(java.io.IOException) ScriptEngine(net.rim.device.api.script.ScriptEngine)

Aggregations

BrowserComponent (com.codename1.ui.BrowserComponent)1 ActionEvent (com.codename1.ui.events.ActionEvent)1 IOException (java.io.IOException)1 BrowserField (net.rim.device.api.browser.field2.BrowserField)1 BrowserFieldListener (net.rim.device.api.browser.field2.BrowserFieldListener)1 DatabaseIOException (net.rim.device.api.database.DatabaseIOException)1 DatabasePathException (net.rim.device.api.database.DatabasePathException)1 ScriptEngine (net.rim.device.api.script.ScriptEngine)1 Document (org.w3c.dom.Document)1