Example usage for com.lowagie.text ElementTags STYLE

List of usage examples for com.lowagie.text ElementTags STYLE

Introduction

In this page you can find the example usage for com.lowagie.text ElementTags STYLE.

Prototype

String STYLE

To view the source code for com.lowagie.text ElementTags STYLE.

Click Source Link

Document

the possible value of an alignment attribute

Usage

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void table() {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.TABLE);
    writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER);
    writeAddAttribute(ElementTags.WIDTH, "100.0%");
    writeAddAttribute(ElementTags.TABLEFITSPAGE, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.CELLSFITPAGE, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.CELLPADDING, "10");
    //writeAddAttribute( ElementTags.COLUMNS, "2" );

    actionContext.setAction(SinkActionContext.TABLE);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void verbatim(boolean boxed) {
    // Always boxed
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.TABLE);
    writeAddAttribute(ElementTags.COLUMNS, "1");
    writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER);
    writeAddAttribute(ElementTags.TABLEFITSPAGE, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.CELLSFITPAGE, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.CELLPADDING, "10");
    writeAddAttribute(ElementTags.WIDTH, "100.0%");

    writeStartElement(ElementTags.ROW);/*from   ww w. j a  va  2s .  c o  m*/

    writeStartElement(ElementTags.CELL);
    writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString());

    actionContext.setAction(SinkActionContext.VERBATIM);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void figure() {
    figureDefined = true;/*from w w w .ja  v a2s  . com*/

    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.IMAGE);

    actionContext.setAction(SinkActionContext.FIGURE);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void link(String name) {
    if (name == null) {
        throw new NullPointerException("Link name cannot be null!");
    }/*from  w  w w.j  a  v  a 2  s.c om*/

    font.setColor(Color.BLUE);
    font.addUnderlined();

    writeStartElement(ElementTags.ANCHOR);
    if (StringUtils.isNotEmpty(name) && name.startsWith("#") && StringUtils.isNotEmpty(header.getTitle())) {
        name = "#" + DoxiaUtils.encodeId(header.getTitle(), true) + "_" + name.substring(1);
    }
    writeAddAttribute(ElementTags.REFERENCE, HtmlTools.escapeHTML(name));
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    actionContext.setAction(SinkActionContext.LINK);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void anchor(String name) {
    if (name == null) {
        throw new NullPointerException("Anchor name cannot be null!");
    }/*from  w  w w  .j  a v a2  s. co m*/

    if (StringUtils.isNotEmpty(header.getTitle())) {
        name = header.getTitle() + "_" + name;
    }
    String id = name;

    if (!DoxiaUtils.isValidId(id)) {
        id = DoxiaUtils.encodeId(name, true);

        String msg = "Modified invalid link: '" + name + "' to '" + id + "'";
        logMessage("modifiedLink", msg);
    }

    writeStartElement(ElementTags.ANCHOR);
    writeAddAttribute(ElementTags.NAME, id);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());

    actionContext.setAction(SinkActionContext.ANCHOR);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void rawText(String text) {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    write(text, false);/*from ww  w. j  a v  a 2s . co m*/

    writeEndElement(); // ElementTags.CHUNK
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void text(String text) {
    if (StringUtils.isEmpty(text)) {
        return;// w  w w  .ja  v a 2 s.c  om
    }

    switch (actionContext.getCurrentAction()) {
    case SinkActionContext.AUTHOR:
        header.addAuthor(text);
        break;

    case SinkActionContext.DATE:
        header.setDate(text);
        break;

    case SinkActionContext.TITLE:
        header.setTitle(text);
        break;

    case SinkActionContext.TABLE_CAPTION:
        this.tableCaptionXMLWriter.writeText(text);
        break;

    case SinkActionContext.VERBATIM:
        // Used to preserve indentation and formating
        LineNumberReader lnr = new LineNumberReader(new StringReader(text));
        String line;
        try {
            while ((line = lnr.readLine()) != null) {
                writeStartElement(ElementTags.CHUNK);
                writeAddAttribute(ElementTags.FONT, font.getFontName());
                writeAddAttribute(ElementTags.SIZE, font.getFontSize());
                writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
                writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
                writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
                writeAddAttribute(ElementTags.RED, font.getFontColorRed());

                write("<![CDATA[", true);
                // Special case
                line = StringUtils.replace(line, "<![CDATA[", "< ![CDATA[");
                line = StringUtils.replace(line, "]]>", "]] >");
                write(line, true, false);
                write("]]>", true);

                writeEndElement();
                lineBreak();
            }
        } catch (IOException e) {
            throw new RuntimeException("IOException: ", e);
        }
        break;

    case SinkActionContext.FIGURE_CAPTION:
        writeAddAttribute(ElementTags.ALT, text);
        break;

    case SinkActionContext.SECTION_TITLE:
    case SinkActionContext.SECTION_1:
    case SinkActionContext.SECTION_2:
    case SinkActionContext.SECTION_3:
    case SinkActionContext.SECTION_4:
    case SinkActionContext.SECTION_5:
    case SinkActionContext.FIGURE:
    case SinkActionContext.FIGURE_GRAPHICS:
    case SinkActionContext.TABLE_ROW:
    case SinkActionContext.TABLE:
    case SinkActionContext.HEAD:
    case SinkActionContext.UNDEFINED:
        break;

    case SinkActionContext.ANCHOR:
        anchorDefined = true;
    case SinkActionContext.PARAGRAPH:
    case SinkActionContext.LINK:
    case SinkActionContext.TABLE_CELL:
    case SinkActionContext.TABLE_HEADER_CELL:
    case SinkActionContext.DEFINITION:
    case SinkActionContext.DEFINED_TERM:
    case SinkActionContext.NUMBERED_LIST_ITEM:
    case SinkActionContext.LIST_ITEM:
    case SinkActionContext.SECTION_TITLE_5:
    case SinkActionContext.SECTION_TITLE_4:
    case SinkActionContext.SECTION_TITLE_3:
    case SinkActionContext.SECTION_TITLE_2:
    case SinkActionContext.SECTION_TITLE_1:
    default:
        writeStartElement(ElementTags.CHUNK);
        writeAddAttribute(ElementTags.FONT, font.getFontName());
        writeAddAttribute(ElementTags.SIZE, font.getFontSize());
        writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
        writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
        writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
        writeAddAttribute(ElementTags.RED, font.getFontColorRed());

        write(text);

        writeEndElement(); // ElementTags.CHUNK
    }
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

private void startChunk(String fontName, int fontSize, String fontStyle, int fontColorBlue, int fontColorGreen,
        int fontColorRed, String localDestination) {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, fontName);
    writeAddAttribute(ElementTags.SIZE, fontSize);
    writeAddAttribute(ElementTags.STYLE, fontStyle);
    writeAddAttribute(ElementTags.BLUE, fontColorBlue);
    writeAddAttribute(ElementTags.GREEN, fontColorGreen);
    writeAddAttribute(ElementTags.RED, fontColorRed);
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, localDestination );
}