Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Text


                    // The node has been consumed.
                    continue;
                }
            } else if (node instanceof Text) {
                Text text = (Text) node;
                if (text.isWhitespace()) {
                    // The text node is pure whitespace so we don't need to add a
                    // line break after this.
                    continue;
                }
            }
View Full Code Here


        String prefix = emulateTag.getPrefix();
        String suffix = emulateTag.getSuffix();

        if (prefix != null && !prefix.equals("")) {
            Text t = element.getDOMFactory().createText();
            t.append(prefix);
            element.addHead(t);
        }
        if (suffix != null && !suffix.equals("")) {
            Text t = element.getDOMFactory().createText();
            t.append(suffix);
            element.addTail(t);
        }
    }
View Full Code Here

            e.setName(WMLConstants.BLOCH_ELEMENT);
            Styles styles = getStylesForElement(e);
            styles.getPropertyValues().setComputedValue(
                    StylePropertyDetails.TEXT_ALIGN,
                    TextAlignKeywords.CENTER);
            Text t = element.getDOMFactory().createText();
            t.append(value);
            e.addHead(t);
            emulateElement(e, tag, true);
            element.addHead(e);
        }
    }
View Full Code Here

        // This code assumes that the buffers contain plain
        // text
        Menu menu = (Menu)group.getContainer();
        MenuEntry entry;
        DOMOutputBuffer buffer;
        Text text;
        int max = 0;
        int len;

        // Determine the maximum length menu item label
        for (int i = 0; i < menu.getSize(); i++) {
            entry = menu.get(i);

            if (entry instanceof MenuItem) {
                buffer = (DOMOutputBuffer)((MenuItem)entry).
                        getLabel().getText().getText();

                // Assumes that there is just a single text node
                text = (Text)buffer.getRoot().getHead();

                len = text.getLength();

                if (max < len) {
                    max = len;
                }
            } else if (entry instanceof MenuItemGroup) {
                MenuItemGroup mig = (MenuItemGroup)entry;
                MenuItem item;
                for (int j = 0; j < mig.getSize(); j++) {
                    item = mig.get(j);

                    buffer = (DOMOutputBuffer)item.
                            getLabel().getText().getText();

                    // Assumes that there is just a single text node
                    text = (Text)buffer.getRoot().getHead();

                    len = text.getLength();

                    if (max < len) {
                        max = len;
                    }
                }
View Full Code Here

                               
    Element newElement = element.getDOMFactory().createElement();
        newElement.setName("script");
        newElement.setAttribute("type","text/javascript");
        newElement.insertAfter(element);
    Text scriptContent = element.getDOMFactory().createText();

        StylesExtractor extractor = WidgetHelper.createStylesExtractor(protocol, styles);      
        String highlightScript = "Widget.register('"+ widgetID +"',new Widget.HighlightingNavigation('" + widgetID + "', " +
        " {" +
        " time: " + extractor.getEffectDuration() + ", " +
        " startColor: '" + startColor + "', " +
        " endColor: '" + endColor + "'" +
        "}));";
       
        scriptContent.append(highlightScript);
        newElement.addHead(scriptContent);
       
  }   
View Full Code Here

    private void checkTextValue(
            final DOMOutputBuffer linkBuffer, final String value) {

        final Element root = linkBuffer.getRoot();
        final Text text = (Text) root.getHead();
        assertEquals(value, new String(text.getContents(), 0, text.getLength()));
        assertNull(text.getNext());
    }
View Full Code Here

        final DOMOutputBuffer contentBuffer =
            ((DOMOutputBuffer) getBodyContentBuffer());
        for (Node node = contentBuffer.getRoot().getHead(); node != null;
             node = node.getNext()) {

            final Text text = (Text) node;
            buffer.append(text.getContents(), 0, text.getLength());
        }
        return buffer.toString();
    }
View Full Code Here

            if (caption == null) {
                caption = "Submit";
            }
            element.setAttribute("value", caption);
            // Create the text that this 'button' encloses
            Text text = domFactory.createText();
            text.append(caption);
            text.addToTail(element);

            dom.closeElement("button");
        } else {
            element = super.createActionElement(dom,
                                                actionType,
View Full Code Here

        protected Node findImageNode(Node node) {
            Node imageNode = null;

            do {
                if (node instanceof Text) {
                    Text text = (Text) node;

                    if (!text.isWhitespace()) {
                        char chars[] = text.getContents();

                        if (chars.length > 0) {
                            String value = new String(chars).trim();

                            if (value.length() > 1) {
View Full Code Here

                        // iMode rather than on cells.
                        element.setName("div");
                        preserveOnlyAlignAttribute(element);
                    } else {
                        element.setName(null);
                        Text space = factory.createText();
                        space.append(" ");
                        space.insertAfter(element);
                    }
                }
            }

            boolean visitChildren = hasContent;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.Text

Copyright © 2018 www.massapicom. 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.