当前位置: 首页>>代码示例>>Java>>正文


Java BrowserField类代码示例

本文整理汇总了Java中net.rim.device.api.browser.field2.BrowserField的典型用法代码示例。如果您正苦于以下问题:Java BrowserField类的具体用法?Java BrowserField怎么用?Java BrowserField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BrowserField类属于net.rim.device.api.browser.field2包,在下文中一共展示了BrowserField类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: browserExposeInJavaScript

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserExposeInJavaScript(PeerComponent browserPeer, Object o, String name) {
    synchronized (UiApplication.getEventLock()) {
        try {
            ((BrowserField) browserPeer.getNativePeer()).extendScriptEngine(name, (Scriptable) o);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:10,代码来源:BlackBerryOS5Implementation.java

示例2: getBrowserTitle

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public String getBrowserTitle(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        return ((BrowserField) browserPeer.getNativePeer()).getDocumentTitle();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例3: getBrowserURL

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public String getBrowserURL(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        return ((BrowserField) browserPeer.getNativePeer()).getDocumentUrl();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例4: setBrowserURL

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void setBrowserURL(PeerComponent browserPeer, String url) {
    if (url.startsWith("jar://")) {
        //ApplicationDescriptor ad = ApplicationDescriptor.currentApplicationDescriptor();
        //url = "cod://" + ad.getModuleName() +  url.substring(6);
        //super.setBrowserURL(browserPeer, url);
        //url = "local://" + url.substring(6);

        // load from jar:// URL's
        try {
            InputStream i = Display.getInstance().getResourceAsStream(getClass(), url.substring(6));
            if (i == null) {
                System.out.println("Local resource not found: " + url);
                return;
            }
            byte[] buffer = new byte[4096];
            ByteArrayOutputStream bo = new ByteArrayOutputStream();
            int size = i.read(buffer);
            while (size > -1) {
                bo.write(buffer, 0, size);
                size = i.read(buffer);
            }
            i.close();
            bo.close();
            String htmlText = new String(bo.toByteArray(), "UTF-8");
            int pos = url.lastIndexOf('/');
            if (pos > 6) {
                url = url.substring(6, pos);
            } else {
                url = "/";
            }
            String baseUrl = "local://" + url;
            setBrowserPage(browserPeer, htmlText, baseUrl);
            return;
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return;
    }
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).requestContent(url);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:43,代码来源:BlackBerryOS5Implementation.java

示例5: browserReload

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserReload(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).refresh();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例6: browserHasBack

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public boolean browserHasBack(PeerComponent browserPeer) {
    return ((BrowserField) browserPeer.getNativePeer()).getHistory().canGoBack();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:4,代码来源:BlackBerryOS5Implementation.java

示例7: browserHasForward

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public boolean browserHasForward(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        return ((BrowserField) browserPeer.getNativePeer()).getHistory().canGoForward();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例8: browserBack

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserBack(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).back();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例9: browserForward

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserForward(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).forward();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例10: browserClearHistory

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserClearHistory(PeerComponent browserPeer) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).getHistory().clearHistory();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例11: setBrowserPage

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void setBrowserPage(PeerComponent browserPeer, String html, String baseUrl) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).displayContent(html, baseUrl);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例12: browserExecute

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public void browserExecute(PeerComponent browserPeer, String javaScript) {
    synchronized (UiApplication.getEventLock()) {
        ((BrowserField) browserPeer.getNativePeer()).executeScript(javaScript);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:BlackBerryOS5Implementation.java

示例13: OAuthScreen

import net.rim.device.api.browser.field2.BrowserField; //导入依赖的package包/类
public OAuthScreen() {
    super(STYLE);

    setFont(Fonts.defaultFont);
    setTitle((Field) null);

    BrowserFieldConfig mConfig = new BrowserFieldConfig();
    mConfig.setProperty(BrowserFieldConfig.ALLOW_CS_XHR, Boolean.TRUE);
    mConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
    mConfig.setProperty(BrowserFieldConfig.USER_SCALABLE, Boolean.TRUE);
    mConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER);
    mConfig.setProperty(BrowserFieldConfig.VIEWPORT_WIDTH, new Integer(Display.getWidth()));

    mConfig.setProperty(BrowserFieldConfig.CONNECTION_FACTORY, createConnectionFactory());

    BrowserField browser = new BrowserField(mConfig);
    add(browser);

    String oauthUrl = "https://oauth.vk.com/authorize?" +
            "client_id=" + Configuration.CLIENT_ID + "&" +
            "scope=" + Configuration.SCOPE + "&" +
            "redirect_uri=" + Configuration.REDIRECT_URL + "&" +
            "display=wap&" +
            "v=" + Configuration.API_VERSION + "&" +
            "response_type=token"; // + (DeviceInfo.isSimulator() ? ";deviceside=true" : "");

    final String accessTokenParamName = "access_token";
    final String userIdParamName = "user_id";
    final String secretParamName = "secret";

    browser.addListener(new BrowserFieldListener() {

        public void documentLoaded(BrowserField browserField, Document document) throws Exception {
            String url = document.getDocumentURI();
            if (url.startsWith(Configuration.REDIRECT_URL)) {
                Array params = new Array(StringUtils.split(url.substring(Configuration.REDIRECT_URL.length() + 1), "&"));

                String accessTokenParam = (String) params.firstOrNull(Predicates.startsWith(accessTokenParamName));
                String userIdParam = (String) params.firstOrNull(Predicates.startsWith(userIdParamName));
                String secretParam = (String) params.firstOrNull(Predicates.startsWith(secretParamName));

                if (accessTokenParam != null && userIdParam != null) {
                    String accessToken = accessTokenParam.substring(accessTokenParamName.length() + 1);
                    String userId = userIdParam.substring(userIdParamName.length() + 1);
                    String secret = secretParam.substring(secretParamName.length() + 1);
                    accessTokenReceived(accessToken, userId, secret);
                }
            }
        }

    });

    browser.requestContent(oauthUrl);

/*browser.setDebugger(new BrowserFieldDebugger() {

  public void pageCompletedLoading(String url) {
    

    super.pageCompletedLoading(url);
  }
});*/
}
 
开发者ID:yanex,项目名称:vika,代码行数:64,代码来源:OAuthScreen.java


注:本文中的net.rim.device.api.browser.field2.BrowserField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。