Package org.apache.pivot.wtk.text

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


        if (selectionLength > 0) {
            Document selection = (Document)document.getRange(selectionStart, selectionLength);

            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringWriter writer = new StringWriter();
                serializer.writeObject(selection, writer);
                selectedText = writer.toString();
            } catch(IOException exception) {
                throw new RuntimeException(exception);
            }
        }
View Full Code Here


        String text = null;
        Document document = getDocument();

        if (document != null) {
            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringWriter writer = new StringWriter();
                serializer.writeObject(document, writer);
                text = writer.toString();
            } catch(SerializationException exception) {
                throw new RuntimeException(exception);
            } catch(IOException exception) {
                throw new RuntimeException(exception);
View Full Code Here

        Document document = null;

        if (text != null
            && text.length() > 0) {
            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringReader reader = new StringReader(text);
                document = serializer.readObject(reader);
            } catch(IOException exception) {
                throw new RuntimeException(exception);
            }
        } else {
            document = new Document();
View Full Code Here

        setDocument(document);
    }

    public void setText(URL text) {
        PlainTextSerializer plainTextSerializer = new PlainTextSerializer("UTF-8");

        Document document = null;
        InputStream inputStream = null;

        try {
            try {
                inputStream = text.openStream();
                document = plainTextSerializer.readObject(inputStream);
            } finally {
                if (inputStream != null) {
                    inputStream.close();
                }
            }
View Full Code Here

            // Copy selection to clipboard
            Document selection = (Document)document.removeRange(selectionStart, selectionLength);

            String selectedText = null;
            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringWriter writer = new StringWriter();
                serializer.writeObject(selection, writer);
                selectedText = writer.toString();
            } catch(SerializationException exception) {
                throw new RuntimeException(exception);
            } catch(IOException exception) {
                throw new RuntimeException(exception);
View Full Code Here

                // Insert the clipboard contents
                Document document;
                int n;
                try {
                    PlainTextSerializer serializer = new PlainTextSerializer();
                    StringReader reader = new StringReader(text);
                    document = serializer.readObject(reader);
                    n = document.getCharacterCount();

                    this.document.insertRange(document, selectionStart);
                } catch(IOException exception) {
                    throw new RuntimeException(exception);
View Full Code Here

        if (selectionLength > 0) {
            Document selection = (Document)document.getRange(selectionStart, selectionLength);

            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringWriter writer = new StringWriter();
                serializer.writeObject(selection, writer);
                selectedText = writer.toString();
            } catch(SerializationException exception) {
                throw new RuntimeException(exception);
            } catch(IOException exception) {
                throw new RuntimeException(exception);
View Full Code Here

                    URL url = componentNode.getSrc();

                    Document document = null;

                    try {
                        PlainTextSerializer plainTextSerializer = new PlainTextSerializer("UTF-8");
                        InputStream inputStream = new BufferedInputStream(url.openStream());

                        try {
                            document = plainTextSerializer.readObject(inputStream);
                        } finally {
                            inputStream.close();
                        }
                    } catch (IOException exception) {
                        throw new RuntimeException(exception);
View Full Code Here

                }

                textArea = (TextArea)wtkxSerializer.get("textArea");
                rollup.setContent(component);

                PlainTextSerializer plainTextSerializer = new PlainTextSerializer("UTF-8");
                InputStream inputStream = getClass().getResourceAsStream("text_area.txt");

                Document document = null;
                try {
                    document = plainTextSerializer.readObject(inputStream);
                } catch(Exception exception) {
                    System.err.println(exception);
                }

                textArea.setDocument(document);
View Full Code Here

        String text = null;
        Document document = getDocument();

        if (document != null) {
            try {
                PlainTextSerializer serializer = new PlainTextSerializer();
                StringWriter writer = new StringWriter();
                serializer.writeObject(document, writer);
                text = writer.toString();
            } catch(SerializationException exception) {
                throw new RuntimeException(exception);
            } catch(IOException exception) {
                throw new RuntimeException(exception);
View Full Code Here

TOP

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

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.