Examples of RichTextField


Examples of net.rim.device.api.ui.component.RichTextField

        final Vector bodyVector = (Vector) _fieldTable.get(BODY);
        if (bodyVector == null || bodyVector.size() == 0) {
            if (_editable) {
                addTextFieldToTableAndScreen(new EditField("", ""), BODY);
            } else {
                addTextFieldToTableAndScreen(new RichTextField(""), BODY);
            }
        }
    }
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

                if (plainText.length() != 0) {
                    if (_editable) {
                        addTextFieldToTableAndScreen(new EditField("",
                                plainText), BODY);
                    } else {
                        addTextFieldToTableAndScreen(new RichTextField(
                                plainText), BODY);
                    }
                }
            } else if (bodyPart instanceof MimeBodyPart) {
                final MimeBodyPart mimeBodyPart = (MimeBodyPart) bodyPart;

                // If the content is text then display it
                final String contentType = mimeBodyPart.getContentType();
                if (contentType
                        .startsWith(BodyPart.ContentType.TYPE_TEXT_HTML_STRING)) {
                    final Object obj = mimeBodyPart.getContent();
                    if (obj != null) {
                        final String htmlText = new String((byte[]) obj);
                        addTextFieldToTableAndScreen(
                                new RichTextField(htmlText), BODY);
                    }
                } else if (contentType
                        .equals(BodyPart.ContentType.TYPE_MULTIPART_ALTERNATIVE_STRING)) {
                    // If the body part is a multi-part and it has the the
                    // content type of TYPE_MULTIPART_ALTERNATIVE_STRING, then
                    // recursively display the multi-part.
                    final Object obj = mimeBodyPart.getContent();
                    if (obj instanceof Multipart) {
                        final Multipart childMultipart = (Multipart) obj;
                        final String childMultipartType =
                                childMultipart.getContentType();
                        if (childMultipartType
                                .equals(BodyPart.ContentType.TYPE_MULTIPART_ALTERNATIVE_STRING)) {
                            displayMultipart(childMultipart);
                        }
                    }
                }
            } else if (bodyPart instanceof SupportedAttachmentPart
                    || bodyPart instanceof UnsupportedAttachmentPart) {
                // Extract the content type and name from the attachments
                final String contentType = bodyPart.getContentType();
                String name;
                if (bodyPart instanceof UnsupportedAttachmentPart) {
                    final UnsupportedAttachmentPart uap =
                            (UnsupportedAttachmentPart) bodyPart;
                    name = uap.getName();
                } else // The bodyPart is a SupportedAttachmentPart
                {
                    final SupportedAttachmentPart sap =
                            (SupportedAttachmentPart) bodyPart;
                    name = sap.getName();
                }

                // Format the content type and name to display and store
                // the field.
                final StringBuffer sb =
                        new StringBuffer(contentType.length() + name.length()
                                + 2);
                sb.append(contentType);
                sb.append('[');
                sb.append(name);
                sb.append(']');

                delayedFields.addElement(new RichTextField(sb.toString()));
            } else if (bodyPart instanceof PDAPContactAttachmentPart) {
                final Contact contact = (Contact) bodyPart.getContent();

                // Build the contact name
                final StringBuffer sb = new StringBuffer("Contact: ");
                if (contact.countValues(Contact.NAME) > 0) {
                    final String[] name =
                            contact.getStringArray(Contact.NAME, 0);

                    if (name[Contact.NAME_PREFIX] != null) {
                        sb.append(name[Contact.NAME_PREFIX]);
                        sb.append(' ');
                    }

                    if (name[Contact.NAME_GIVEN] != null) {
                        sb.append(name[Contact.NAME_GIVEN]);
                        sb.append(' ');
                    }

                    if (name[Contact.NAME_FAMILY] != null) {
                        sb.append(name[Contact.NAME_FAMILY]);
                    }

                    // Trim the last space of the name if it exists
                    final int lastChar = sb.length() - 1;
                    if (sb.charAt(lastChar) == ' ') {
                        sb.deleteCharAt(lastChar);
                    }
                } else {
                    sb.append(UNKNOWN_NAME);
                }

                // Create the contact attachment field and store it
                final RichTextField contactAttachment =
                        new RichTextField(sb.toString());
                contactAttachment.setCookie(contact);
                delayedFields.addElement(contactAttachment);
            }
        }

        // Now that the body parts have been displayed, display the queued
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

         * Creates a new NotificationsDemoScreen object
         */
        private NotificationsDemoScreen() {
            // Initialize UI components
            setTitle("Notifications Demo");
            add(new RichTextField("Trigger notification from menu."));

            // A menu item to generate immediate and deferred events
            final MenuItem notifyItem =
                    new MenuItem(new StringProvider("Notify (ID1)"), 0x230010,
                            0);
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

        } else {
            _mainScreen = new HTTPPushDemoScreen();
            _mainScreen.setTitle(new LabelField("HTTP Push Demo",
                    Field.USE_ALL_WIDTH));

            _infoField = new RichTextField();
            _mainScreen.add(_infoField);

            _mainScreen.add(new SeparatorField());

            _imageField = new RichTextField();
            _mainScreen.add(_imageField);

            // Start the listening thread
            _listeningThread = new ListeningThread();
            _listeningThread.start();
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

            // then it's of
            // the form <Element>Text</Element>, so print 'Element = "Text"'.
            if (numChildren == 1 && firstChild.getNodeType() == Node.TEXT_NODE) {
                buffer.append(node.getNodeName()).append(" = \"").append(
                        firstChild.getNodeValue()).append('"');
                add(new RichTextField(buffer.toString()));
            } else {
                // The node either has > 1 children, or it has at least one
                // Element node child.
                // Either way, its children have to be visited. Print the name
                // of the element
                // and recurse.
                buffer.append(node.getNodeName());
                add(new RichTextField(buffer.toString()));

                // Recursively visit all this node's children.
                for (int i = 0; i < numChildren; ++i) {
                    displayNode(childNodes.item(i), depth + 1);
                }
            }
        } else {
            // Node is not an Element node, so we know it is a Text node. Make
            // sure it is
            // not an "empty" Text node (normalize() doesn't consider a Text
            // node consisting
            // of only newlines and spaces to be "empty"). If it is not empty,
            // print it.
            final String nodeValue = node.getNodeValue();
            if (nodeValue.trim().length() != 0) {
                final StringBuffer buffer = new StringBuffer();
                indentStringBuffer(buffer, depth);
                buffer.append('"').append(nodeValue).append('"');
                add(new RichTextField(buffer.toString()));
            }
        }
    }
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

    public BlackBerryMapsDemoScreen() {
        setTitle("BlackBerry Maps Demo");

        _app = (BlackBerryMapsDemo) UiApplication.getUiApplication();

        final RichTextField rtf =
                new RichTextField("Select an option from the menu.",
                        Field.NON_FOCUSABLE);
        add(rtf);

        // Displays an InvokeContactScreen
        final MenuItem invokeContactItem =
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

        private HandlerScreen() {
            // Set the screen title
            setTitle("Active Text Fields Handler");

            // These are the fields that will display the tracking information
            _trackingNumber = new RichTextField();
            add(_trackingNumber);
            _statusLocation = new RichTextField();
            add(_statusLocation);
        }
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

    ActiveTextFieldsScreen() {
        // Set the screen title
        setTitle("Active Text Fields Demo");

        // Add instructions
        add(new RichTextField(
                "Type a nine digit number in the Transaction No. field. Pattern will be hyperlinked and status and location menu items will be available.\n",
                Field.NON_FOCUSABLE));

        // Add an ActiveAutoTextEditField
        final ActiveAutoTextEditField activeField =
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

    public LocalizationDemoScreen() {
        final LabelField title =
                new LabelField(_resources.getString(APPLICATION_TITLE));
        setTitle(title);

        add(new RichTextField(_resources.getString(FIELD_TITLE),
                Field.NON_FOCUSABLE));
        add(new SeparatorField());
        add(new LabelField());

        final String choices[] = _resources.getStringArray(FIELD_COUNTRIES);
View Full Code Here

Examples of net.rim.device.api.ui.component.RichTextField

     * Creates a new InvokeLocationDocumentScreen object
     */
    InvokeLocationDocumentScreen() {
        setTitle("Invoke Location Document");

        final RichTextField instructions =
                new RichTextField(
                        "From the menu:\n\nSelect 'View Single Location' to invoke BlackBerry Maps using a single location tag.\n\nSelect 'View Multiple Locations' to invoke BlackBerry Maps using multiple location tags.",
                        Field.READONLY | Field.FOCUSABLE);
        add(instructions);

        // Displays a single location on a map
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.