Package org.apache.pivot.wtk.text

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


        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

    @Override
    protected void attach() {
        super.attach();

        // Attach child node views
        Element element = (Element)getNode();
        for (Node node : element) {
            add(textPaneSkin.createNodeView(node));
        }
    }
View Full Code Here

    @Override
    protected void attach() {
        super.attach();

        Element element = (Element)getNode();
        element.getElementListeners().add(this);

        // NOTE We don't attach child views here because this may not
        // be efficient for all subclasses (e.g. paragraph views need to
        // recreate child views when breaking across multiple lines)
    }
View Full Code Here

        // recreate child views when breaking across multiple lines)
    }

    @Override
    protected void detach() {
        Element element = (Element)getNode();
        element.getElementListeners().remove(this);

        // Detach child node views
        for (TextPaneSkinNodeView nodeView : this) {
            nodeView.detach();
        }
View Full Code Here

                paragraph.add(new TextNode(text));
            }
        } else {
            // The caret is positioned on a non-text character node; insert
            // the text into the descendant's parent
            Element parent = descendant.getParent();
            int index = parent.indexOf(descendant);
            parent.insert(new TextNode(text), index);
        }

        // Set the selection start to the character following the insertion
        setSelection(selectionStart + text.length(), 0);
    }
View Full Code Here

        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 (selectionLength == 0
                && 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);
                }
            } else {
                document.removeRange(offset, characterCount);
View Full Code Here

        @Override
        protected void attach() {
            super.attach();

            Element element = (Element)getNode();
            element.getElementListeners().add(this);

            // NOTE We don't attach child views here because this may not
            // be efficient for all subclasses (e.g. paragraph views need to
            // recreate child views when breaking across multiple lines)
        }
View Full Code Here

            // recreate child views when breaking across multiple lines)
        }

        @Override
        protected void detach() {
            Element element = (Element)getNode();
            element.getElementListeners().remove(this);

            // Detach child node views
            for (NodeView nodeView : this) {
                nodeView.detach();
            }
View Full Code Here

TOP

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

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.