Package org.apache.pivot.wtk.text

Examples of org.apache.pivot.wtk.text.Element$NodeOffsetComparator


        int offset = selectionStart - leadingSegment.getDocumentOffset();
        int characterCount = leadingSegment.getCharacterCount() - offset;

        Paragraph trailingSegment = (Paragraph)leadingSegment.removeRange(offset, characterCount);

        Element parent = leadingSegment.getParent();
        int index = parent.indexOf(leadingSegment);
        parent.insert(trailingSegment, index + 1);

        // Set the selection start to the character following the insertion
        setSelection(selectionStart + 1, selectionLength);
    }
View Full Code Here


                if (descendant instanceof Paragraph) {
                    // We are deleting a paragraph terminator
                    Paragraph paragraph = (Paragraph)descendant;

                    Element parent = paragraph.getParent();
                    int index = parent.indexOf(paragraph);

                    // Attempt to merge any successive content into the paragraph
                    if (index < parent.getLength() - 1) {
                        // TODO This won't always be a paragraph - we'll need to
                        // find the next paragraph by walking the tree, then
                        // remove any empty nodes
                        Sequence<Node> removed = parent.remove(index + 1, 1);
                        Paragraph nextParagraph = (Paragraph)removed.get(0);
                        paragraph.insertRange(nextParagraph, paragraph.getCharacterCount() - 1);

                        // Move the caret to the merge point
                        setSelection(offset, 0);
View Full Code Here

    }

    private Font getEffectiveFont() {
        Font font = null;
        // run up the tree until we find an element's style to apply
        Element element = getNode().getParent();
        while (element != null) {
            font = element.getFont();
            if (font != null) {
                break;
            }

            element = element.getParent();
        }
        // if we find nothing, use the default font
        if (element == null) {
            font = getTextPaneSkin().getFont();
        }
View Full Code Here

    }

    private Color getEffectiveForegroundColor() {
        Color foregroundColor = null;
        // run up the tree until we find an element's style to apply
        Element element = getNode().getParent();
        while (element != null) {
            foregroundColor = element.getForegroundColor();
            if (foregroundColor != null) {
                break;
            }

            element = element.getParent();
        }
        // if we find nothing, use the default color
        if (element == null) {
            foregroundColor = getTextPaneSkin().getColor();
        }
View Full Code Here

        return foregroundColor;
    }

    private boolean getEffectiveUnderline() {
        // run up the tree until we find an element's style to apply
        Element element = getNode().getParent();
        while (element != null) {
            if (element.isUnderline()) {
                return true;
            }

            element = element.getParent();
        }
        return false;
    }
View Full Code Here

        return false;
    }

    private boolean getEffectiveStrikethrough() {
        // run up the tree until we find an element's style to apply
        Element element = getNode().getParent();
        while (element != null) {
            if (element.isStrikethrough()) {
                return true;
            }

            element = element.getParent();
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.text.Element$NodeOffsetComparator

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.