Java Code Examples for sun.swing.SwingUtilities2#isComplexLayout()

The following examples show how to use sun.swing.SwingUtilities2#isComplexLayout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractDocument.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 2
Source File: AbstractDocument.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 3
Source File: AbstractDocument.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 4
Source File: AbstractDocument.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 5
Source File: AbstractDocument.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 6
Source File: AbstractDocument.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 7
Source File: AbstractDocument.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 8
Source File: AbstractDocument.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 9
Source File: AbstractDocument.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performs the actual work of inserting the text; it is assumed the
 * caller has obtained a write lock before invoking this.
 */
private void handleInsertString(int offs, String str, AttributeSet a)
        throws BadLocationException {
    if ((str == null) || (str.length() == 0)) {
        return;
    }
    UndoableEdit u = data.insertString(offs, str);
    DefaultDocumentEvent e =
        new DefaultDocumentEvent(offs, str.length(), DocumentEvent.EventType.INSERT);
    if (u != null) {
        e.addEdit(u);
    }

    // see if complex glyph layout support is needed
    if( getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            putProperty( I18NProperty, Boolean.TRUE);
        } else {
            char[] chars = str.toCharArray();
            if (SwingUtilities2.isComplexLayout(chars, 0, chars.length)) {
                putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    insertUpdate(e, a);
    // Mark the edit as done.
    e.end();
    fireInsertUpdate(e);
    // only fire undo if Content implementation supports it
    // undo for the composed text is not supported for now
    if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
        fireUndoableEditUpdate(new UndoableEditEvent(this, e));
    }
}
 
Example 10
Source File: HTMLDocument.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 11
Source File: HTMLDocument.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 12
Source File: HTMLDocument.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            inParagraph = impliedP = true;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 13
Source File: HTMLDocument.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 14
Source File: HTMLDocument.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            inParagraph = impliedP = true;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 15
Source File: HTMLDocument.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 16
Source File: HTMLDocument.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 17
Source File: HTMLDocument.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 18
Source File: HTMLDocument.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 19
Source File: HTMLDocument.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}
 
Example 20
Source File: HTMLDocument.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Called by the parser to indicate a block of text was
 * encountered.
 */
public void handleText(char[] data, int pos) {
    if (receivedEndHTML || (midInsert && !inBody)) {
        return;
    }

    // see if complex glyph layout support is needed
    if(HTMLDocument.this.getProperty(I18NProperty).equals( Boolean.FALSE ) ) {
        // if a default direction of right-to-left has been specified,
        // we want complex layout even if the text is all left to right.
        Object d = getProperty(TextAttribute.RUN_DIRECTION);
        if ((d != null) && (d.equals(TextAttribute.RUN_DIRECTION_RTL))) {
            HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
        } else {
            if (SwingUtilities2.isComplexLayout(data, 0, data.length)) {
                HTMLDocument.this.putProperty( I18NProperty, Boolean.TRUE);
            }
        }
    }

    if (inTextArea) {
        textAreaContent(data);
    } else if (inPre) {
        preContent(data);
    } else if (inTitle) {
        putProperty(Document.TitleProperty, new String(data));
    } else if (option != null) {
        option.setLabel(new String(data));
    } else if (inStyle) {
        if (styles != null) {
            styles.addElement(new String(data));
        }
    } else if (inBlock > 0) {
        if (!foundInsertTag && insertAfterImplied) {
            // Assume content should be added.
            foundInsertTag(false);
            foundInsertTag = true;
            // If content is added directly to the body, it should
            // be wrapped by p-implied.
            inParagraph = impliedP = !insertInBody;
        }
        if (data.length >= 1) {
            addContent(data, 0, data.length);
        }
    }
}