Example usage for com.lowagie.text ElementTags RED

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

Introduction

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

Prototype

String RED

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

Click Source Link

Document

attribute of the chunk/table/cell tag

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 v a 2 s. 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;/*  w  ww  . j ava  2s .co m*/

    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!");
    }//w w  w  .j  av  a 2  s  .  c o  m

    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_() {
    if (!anchorDefined) {
        // itext needs a defined local destination, we put an invisible text
        writeAddAttribute(ElementTags.BLUE, "255");
        writeAddAttribute(ElementTags.GREEN, "255");
        writeAddAttribute(ElementTags.RED, "255");

        write("_");
    }/* w ww  .  ja va 2s.  co  m*/

    anchorDefined = false;

    writeEndElement(); // ElementTags.ANCHOR

    actionContext.release();
}

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

License:Apache License

/** {@inheritDoc} */
public void horizontalRule() {
    writeStartElement(ElementTags.PARAGRAPH);
    writeAddAttribute(ElementTags.BLUE, "255");
    writeAddAttribute(ElementTags.GREEN, "255");
    writeAddAttribute(ElementTags.RED, "255");
    write("_");//from  w  w w .j  ava2s. com
    writeEndElement();

    writeStartElement(ElementTags.PARAGRAPH);
    writeStartElement(ElementTags.HORIZONTALRULE);
    writeEndElement();
    writeEndElement();
}

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   w w  w.j  av  a  2  s .  c o 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 .  j  av  a 2 s  .  co m
    }

    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 );
}