Examples of BrowserContentBaseImpl


Examples of net.rim.device.api.browser.field.BrowserContentBaseImpl

            throws RenderingException {
        if (context == null) {
            throw new RenderingException("No Context is passed into Provider");
        }

        final BrowserContentBaseImpl browserContentBaseImpl =
                new BrowserContentBaseImpl(
                        context.getHttpConnection().getURL(), null, context
                                .getRenderingApplication(), context
                                .getRenderingSession().getRenderingOptions(),
                        context.getFlags());

        final VerticalFieldManager vfm =
                new VerticalFieldManager(Manager.VERTICAL_SCROLL);

        vfm.add(new LabelField("Mime type: "));
        vfm.add(new LabelField(ACCEPT[0]));
        vfm.add(new SeparatorField());
        vfm.add(new LabelField("Content of the resource file: \n"));
        vfm.add(new SeparatorField());

        InputStream in = null;
        try {
            in = context.getInputStream();
            if (in == null) {
                in = context.getInputConnection().openInputStream();
            }

            final StringBuffer sb = new StringBuffer();
            int ch;
            while (-1 != (ch = in.read())) {
                sb.append((char) ch);
            }

            vfm.add(new LabelField(sb.toString()));
        } catch (final IOException ioe) {
            errorDialog(ioe.toString());
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (final IOException ioe) {

                }
            }
        }

        browserContentBaseImpl.setContent(vfm);
        browserContentBaseImpl.setTitle(ACCEPT[0]);

        // Set browser page context, this will tell the browser how to display
        // this field.
        browserContentBaseImpl.setBrowserPageContext(this);

        return browserContentBaseImpl;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.