Package javax.swing.text

Examples of javax.swing.text.AbstractDocument.readLock()


     */
    public static final Element getParagraphElement(final Document doc,
                                                    final int p) {
        if (doc instanceof AbstractDocument) {
            AbstractDocument abstrDoc = (AbstractDocument) doc;
            abstrDoc.readLock();
            Element elem = null;
            int length = 0;
            boolean incorrectPosition = false;
            try {
                length = doc.getLength();
View Full Code Here


    }

    public void testGetLineStartEndOffset() {
        AbstractDocument doc = (AbstractDocument) jta.getDocument();
        int count = jta.getLineCount();
        doc.readLock();
        Element root = doc.getDefaultRootElement();
        for (int j = 0; j < count; j++) {
            Element currentElement = root.getElement(j);
            try {
                assertEquals(currentElement.getStartOffset(), jta.getLineStartOffset(j));
View Full Code Here

    }

    public void testGetLineOfOffset() {
        AbstractDocument doc = (AbstractDocument) jta.getDocument();
        int length = doc.getLength();
        doc.readLock();
        Element root = doc.getDefaultRootElement();
        for (int j = 0; j < length; j++) {
            try {
                assertEquals(root.getElementIndex(j), jta.getLineOfOffset(j));
            } catch (BadLocationException e) {
View Full Code Here

        assertEquals("rows less than zero.", message);
    }

    public void testGetLineCount() {
        AbstractDocument doc_jta = (AbstractDocument) jta.getDocument();
        doc_jta.readLock();
        assertEquals(jta.getLineCount(), doc_jta.getDefaultRootElement().getElementCount());
        doc_jta.readUnlock();
        doc_jta = (AbstractDocument) bidiJta.getDocument();
        doc_jta.readLock();
        assertEquals(bidiJta.getLineCount(), doc_jta.getDefaultRootElement().getElementCount());
View Full Code Here

        AbstractDocument doc_jta = (AbstractDocument) jta.getDocument();
        doc_jta.readLock();
        assertEquals(jta.getLineCount(), doc_jta.getDefaultRootElement().getElementCount());
        doc_jta.readUnlock();
        doc_jta = (AbstractDocument) bidiJta.getDocument();
        doc_jta.readLock();
        assertEquals(bidiJta.getLineCount(), doc_jta.getDefaultRootElement().getElementCount());
        doc_jta.readUnlock();
    }

    public void testSetGetColumns() throws Exception {
View Full Code Here

    public int[] findOrigin() throws InterruptedException, BadLocationException {
        int[] ret = null;

        AbstractDocument doc = (AbstractDocument) context.getDocument();
        doc.readLock();
        try {
            TokenHierarchy th = TokenHierarchy.get(doc);
            TokenSequence ts = th.tokenSequence();
            Token token = findTokenAtContext(ts, context.getSearchOffset());
            if (token == null) {
View Full Code Here

    public int[] findMatches() throws InterruptedException, BadLocationException {
        int[] ret = null;

        AbstractDocument doc = (AbstractDocument) context.getDocument();
        doc.readLock();
        try {
            TokenHierarchy th = TokenHierarchy.get(doc);
            TokenSequence ts = th.tokenSequence();
            //System.out.println("--------------------");
            ret = findPaar(ts, context.getSearchOffset(), originToken, matchToken, searchForward);
View Full Code Here

     */
    public static final Element getParagraphElement(final Document doc,
                                                    final int p) {
        if (doc instanceof AbstractDocument) {
            AbstractDocument abstrDoc = (AbstractDocument) doc;
            abstrDoc.readLock();
            Element elem = null;
            int length = 0;
            boolean incorrectPosition = false;
            try {
                length = doc.getLength();
View Full Code Here

     */
    public static final Element getParagraphElement(final Document doc,
                                                    final int p) {
        if (doc instanceof AbstractDocument) {
            AbstractDocument abstrDoc = (AbstractDocument) doc;
            abstrDoc.readLock();
            Element elem = null;
            int length = 0;
            boolean incorrectPosition = false;
            try {
                length = doc.getLength();
View Full Code Here

    }

    public void testGetLineStartEndOffset() {
        AbstractDocument doc = (AbstractDocument) jta.getDocument();
        int count = jta.getLineCount();
        doc.readLock();
        Element root = doc.getDefaultRootElement();
        for (int j = 0; j < count; j++) {
            Element currentElement = root.getElement(j);
            try {
                assertEquals(currentElement.getStartOffset(), jta.getLineStartOffset(j));
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.