Java Code Examples for javax.swing.text.html.ParagraphView

The following examples show how to use javax.swing.text.html.ParagraphView. These examples are extracted from open source projects. 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 Project: SmartIM4IntelliJ   Source File: WrapHTMLFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override public View create(Element elem) {
    View v = super.create(elem);
    if (v instanceof LabelView) {
        // the javax.swing.text.html.BRView (representing <br> tag) is a
        // LabelView but must not be handled
        // by a WrapLabelView. As BRView is private, check the html tag from
        // elem attribute
        Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
        if ((o instanceof HTML.Tag) && o == HTML.Tag.BR) {
            return new BRView(elem);
        }
    }
    if (v instanceof InlineView) {
        return new WrapInlineView(elem);
    } else if (v instanceof ParagraphView) {
        return new WrapParagraphView(elem);
    }
    return v;
}
 
Example 2
Source Project: SmartIM   Source File: WrapHTMLFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View create(Element elem) {
    View v = super.create(elem);
    if (v instanceof LabelView) {
        // the javax.swing.text.html.BRView (representing <br> tag) is a
        // LabelView but must not be handled
        // by a WrapLabelView. As BRView is private, check the html tag from
        // elem attribute
        Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
        if ((o instanceof HTML.Tag) && o == HTML.Tag.BR) {
            return new BRView(elem);
        }
    }
    if (v instanceof InlineView) {
        return new WrapInlineView(elem);
    } else if (v instanceof ParagraphView) {
        return new WrapParagraphView(elem);
    }
    return v;
}
 
Example 3
Source Project: jitsi   Source File: SIPCommHTMLEditorKit.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View create(Element elem)
{
    View view = super.create(elem);

    viewCreated(this, view);

    if (view instanceof ParagraphView)
    {
        return new ParagraphViewX(elem);
    }
    else if (view instanceof ComponentView)
    {
        return new MyComponentView(elem);
    }

    return view;
}