javax.swing.text.Segment#isPartialReturn ( )源码实例Demo

下面列出了javax.swing.text.Segment#isPartialReturn ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: OverviewControllerUI.java
@Override
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码2 项目: netbeans   文件: ThreadDumpWindow.java
@Override
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码3 项目: visualvm   文件: HTMLTextComponent.java
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码4 项目: visualvm   文件: OverviewControllerUI.java
@Override
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码5 项目: visualvm   文件: ThreadDumpWindow.java
@Override
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码6 项目: visualvm   文件: ThreadDumpView.java
@Override
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    if (lastOffset == offset && lastLength == length) {
        txt.array = segArray;
        txt.offset = segOffset;
        txt.count = segCount;
        txt.setPartialReturn(segPartialReturn);
        return;
    }
    super.getText(offset, length, txt);
    if (length > CACHE_BOUNDARY || lastLength <= CACHE_BOUNDARY) {
        segArray = txt.array;
        segOffset = txt.offset;
        segCount = txt.count;
        segPartialReturn = txt.isPartialReturn();
        lastOffset = offset;
        lastLength = length;
    }
}
 
源代码7 项目: netbeans   文件: OutputDocument.java
public void getText(int offset, int length, Segment txt) throws BadLocationException {
    checkLocation(offset);
    if (length < 0) {
        throw new BadLocationException("negative length", offset);  //NOI18N
    }
    if (length == 0) {
        txt.array = new char[0];
        txt.offset = 0;
        txt.count = 0;
        return;
    }
    if (offset + length > getLength()) {
        throw new BadLocationException("too long text requested",   //NOI18N
                                       getLength());
    }

    int elemIndex = getElementIndex(offset);
    DocElement docElem = docElements[elemIndex];
    if ((offset == docElem.offset) && (length == docElem.length)) {
        txt.array = docElem.getChars();
        txt.offset = 0;
        txt.count = length;
    } else if (offset + length <= docElem.offset + docElem.length) {
        txt.array = docElem.getChars();
        txt.offset = offset - docElem.offset;
        txt.count = length;
    } else if (txt.isPartialReturn()) {
        txt.array = docElem.getChars();
        txt.offset = offset - docElem.offset;
        txt.count = docElem.offset + docElem.length - offset;
    } else {
        int finalOffset = offset + length;
        int charsStoredCount;
        char[] result = new char[length];

        /* append the first line: */
        System.arraycopy(docElem.getChars(), offset - docElem.offset,
                         result, 0,
                         charsStoredCount = docElem.offset + docElem.length - offset);

        /* append whole lines: */
        while ((docElem = docElements[++elemIndex]).offset < finalOffset) {
            System.arraycopy(docElem.getChars(), 0,
                             result, charsStoredCount,
                             docElem.length);
            charsStoredCount += docElem.length;
        }

        /* append the last line: */
        if (docElem.offset < finalOffset) {
            System.arraycopy(docElem.getChars(), 0,
                             result, charsStoredCount,
                             finalOffset - docElem.offset);
        }

        txt.array = result;
        txt.offset = 0;
        txt.count = length;
    }
}