Example usage for javax.swing.text AbstractDocument SectionElementName

List of usage examples for javax.swing.text AbstractDocument SectionElementName

Introduction

In this page you can find the example usage for javax.swing.text AbstractDocument SectionElementName.

Prototype

String SectionElementName

To view the source code for javax.swing.text AbstractDocument SectionElementName.

Click Source Link

Document

Name of elements used to hold sections (lines/paragraphs).

Usage

From source file:Main.java

public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            return new WrapLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            return new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            return new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            return new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            return new IconView(elem);
        }/*  w  w w. j a v  a 2 s .  c  o  m*/
    }
    return new LabelView(elem);
}

From source file:Main.java

@Override
public View create(Element elem) {
    View result = null;/* w ww . j  a  va  2s.c  o m*/
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            result = new MyLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            result = new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            result = new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            result = new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            result = new IconView(elem);
        } else {
            result = new LabelView(elem);
        }
    } else {
        result = super.create(elem);
    }
    return result;
}

From source file:Main.java

public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            return new MyLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            return new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            return new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            return new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            return new IconView(elem);
        }//from w ww.ja  va 2s.c o m
    }
    return new LabelView(elem);
}