public void executeJavascript(String strJavascript) { // synchronized (Application.getEventLock()) { BrowserField field = (BrowserField) m_oMainScreen.getField(0); field.executeScript("javascript:" + strJavascript); } }
private void createBrowserField() { LOG.INFO("Use BrowserField5"); m_oBrowserField = new BrowserField(m_oConfig); m_oBrowserField .getRenderingOptions() .setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.ALLOW_POPUPS, true); m_oController = new RhoProtocolController(m_oBrowserField); m_oConfig.setProperty(BrowserFieldConfig.CONTROLLER, m_oController); BrowserFieldListener _listener = new BrowserFieldListener() { public void documentLoaded(BrowserField browserField, org.w3c.dom.Document document) throws Exception { synchronized (Application.getEventLock()) { m_oMainScreen.deleteAll(); m_oMainScreen.add(m_oBrowserField); } } /* public void downloadProgress(BrowserField browserField, net.rim.device.api.browser.field.ContentReadEvent event)throws Exception { //Add your code here. }*/ }; m_oBrowserField.addListener(_listener); }
public void processConnection(HttpConnection connection, Object e) { try { if (connection.getResponseCode() == HttpConnection.HTTP_NOT_MODIFIED) return; } catch (java.io.IOException exc) { LOG.ERROR("processConnection - getResponseCode failed.", exc); } synchronized (Application.getEventLock()) { createBrowserField(); m_oBrowserField.displayContent(connection, (e != null ? (String) e : "")); } }