Java Code Examples for com.lowagie.text.Element#ALIGN_JUSTIFIED_ALL

The following examples show how to use com.lowagie.text.Element#ALIGN_JUSTIFIED_ALL . 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: HtmlEncoder.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 2
Source File: HtmlEncoder.java    From itext2 with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 3
Source File: HtmlEncoder.java    From MesquiteCore with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 4
Source File: RtfListLevel.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Writes the initialization part of the RtfList
 * 
 * @param result The <code>OutputStream</code> to write to
 * @throws IOException On i/o errors.
 */
public void writeListBeginning(final OutputStream result) throws IOException {
    result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
    if(this.inTable) {
        result.write(RtfParagraph.IN_TABLE);
    }
    switch (this.alignment) {
        case Element.ALIGN_LEFT:
            result.write(RtfParagraphStyle.ALIGN_LEFT);
            break;
        case Element.ALIGN_RIGHT:
            result.write(RtfParagraphStyle.ALIGN_RIGHT);
            break;
        case Element.ALIGN_CENTER:
            result.write(RtfParagraphStyle.ALIGN_CENTER);
            break;
        case Element.ALIGN_JUSTIFIED:
        case Element.ALIGN_JUSTIFIED_ALL:
            result.write(RtfParagraphStyle.ALIGN_JUSTIFY);
            break;
    }
    writeIndentation(result);
    result.write(RtfFont.FONT_SIZE);
    result.write(intToByteArray(fontNumber.getFontSize() * 2));
    if(this.symbolIndent > 0) {
        result.write(LIST_LEVEL_SYMBOL_INDENT);
        result.write(intToByteArray(this.leftIndent));
    }
}
 
Example 5
Source File: RtfParagraphStyle.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Writes the settings of this RtfParagraphStyle.
 * 
 * @param result The <code>OutputStream</code> to write to.
 * @throws IOException On i/o errors.
 */
private void writeParagraphSettings(final OutputStream result) throws IOException {
    if(this.keepTogether) {
        result.write(RtfParagraphStyle.KEEP_TOGETHER);
    }
    if(this.keepTogetherWithNext) {
        result.write(RtfParagraphStyle.KEEP_TOGETHER_WITH_NEXT);
    }
    switch (alignment) {
        case Element.ALIGN_LEFT:
            result.write(RtfParagraphStyle.ALIGN_LEFT);
            break;
        case Element.ALIGN_RIGHT:
            result.write(RtfParagraphStyle.ALIGN_RIGHT);
            break;
        case Element.ALIGN_CENTER:
            result.write(RtfParagraphStyle.ALIGN_CENTER);
            break;
        case Element.ALIGN_JUSTIFIED:
        case Element.ALIGN_JUSTIFIED_ALL:
            result.write(RtfParagraphStyle.ALIGN_JUSTIFY);
            break;
    }
    result.write(FIRST_LINE_INDENT);
    result.write(intToByteArray(this.firstLineIndent));
    result.write(RtfParagraphStyle.INDENT_LEFT);
    result.write(intToByteArray(indentLeft));
    result.write(RtfParagraphStyle.INDENT_RIGHT);
    result.write(intToByteArray(indentRight));
    if(this.spacingBefore > 0) {
        result.write(RtfParagraphStyle.SPACING_BEFORE);
        result.write(intToByteArray(this.spacingBefore));
    }
    if(this.spacingAfter > 0) {
        result.write(RtfParagraphStyle.SPACING_AFTER);
        result.write(intToByteArray(this.spacingAfter));
    }
    if(this.lineLeading > 0) {
        result.write(RtfParagraph.LINE_SPACING);
        result.write(intToByteArray(this.lineLeading));
    }            
}
 
Example 6
Source File: RtfRow.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Writes the row definition/settings.
 *
 * @param result The <code>OutputStream</code> to write the definitions to.
 */
private void writeRowDefinition(final OutputStream result) throws IOException {
    result.write(ROW_BEGIN);
    this.document.outputDebugLinebreak(result);
    result.write(ROW_WIDTH_STYLE);
    result.write(ROW_WIDTH);
    result.write(intToByteArray(this.width));
    if(this.parentTable.getCellsFitToPage()) {
        result.write(ROW_KEEP_TOGETHER);
    }
    if(this.rowNumber <= this.parentTable.getHeaderRows()) {
        result.write(ROW_HEADER_ROW);
    }
    switch (this.parentTable.getAlignment()) {
        case Element.ALIGN_LEFT:
        	result.write(ROW_ALIGN_LEFT);
            break;
        case Element.ALIGN_RIGHT:
            result.write(ROW_ALIGN_RIGHT);
            break;
        case Element.ALIGN_CENTER:
            result.write(ROW_ALIGN_CENTER);
            break;
        case Element.ALIGN_JUSTIFIED:
        case Element.ALIGN_JUSTIFIED_ALL:
            result.write(ROW_ALIGN_JUSTIFIED);
            break;
    }
    result.write(ROW_GRAPH);
    RtfBorderGroup borders =this.parentTable.getBorders();
    if(borders != null) {
    	borders.writeContent(result);
    }
    
    if(this.parentTable.getCellSpacing() > 0) {
        result.write(ROW_CELL_SPACING_LEFT);
        result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
        result.write(ROW_CELL_SPACING_LEFT_STYLE);
        result.write(ROW_CELL_SPACING_TOP);
        result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
        result.write(ROW_CELL_SPACING_TOP_STYLE);
        result.write(ROW_CELL_SPACING_RIGHT);
        result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
        result.write(ROW_CELL_SPACING_RIGHT_STYLE);
        result.write(ROW_CELL_SPACING_BOTTOM);
        result.write(intToByteArray((int) (this.parentTable.getCellSpacing() / 2)));
        result.write(ROW_CELL_SPACING_BOTTOM_STYLE);
    }
    
    result.write(ROW_CELL_PADDING_LEFT);
    result.write(intToByteArray((int) (this.parentTable.getCellPadding() / 2)));
    result.write(ROW_CELL_PADDING_RIGHT);
    result.write(intToByteArray((int) (this.parentTable.getCellPadding() / 2)));
    result.write(ROW_CELL_PADDING_LEFT_STYLE);
    result.write(ROW_CELL_PADDING_RIGHT_STYLE);
    
    this.document.outputDebugLinebreak(result);
    
    for(int i = 0; i < this.cells.size(); i++) {
        RtfCell rtfCell = (RtfCell) this.cells.get(i);
        rtfCell.writeDefinition(result);
    }    	
}
 
Example 7
Source File: PdfLine.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Checks if this line has to be justified.
 *
 * @return <CODE>true</CODE> if the alignment equals <VAR>ALIGN_JUSTIFIED</VAR> and there is
 *         some width left.
 */

public boolean hasToBeJustified() {
	return (alignment == Element.ALIGN_JUSTIFIED || alignment == Element.ALIGN_JUSTIFIED_ALL) && width != 0;
}
 
Example 8
Source File: PdfLine.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Checks if a newline caused the line split.
 * 
 * @return <CODE>true</CODE> if a newline caused the line split
 */
public boolean isNewlineSplit() {
	return newlineSplit && alignment != Element.ALIGN_JUSTIFIED_ALL;
}
 
Example 9
Source File: PdfLine.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Checks if this line has to be justified.
 *
 * @return	<CODE>true</CODE> if the alignment equals <VAR>ALIGN_JUSTIFIED</VAR> and there is some width left.
 */

public boolean hasToBeJustified() {
    return ((alignment == Element.ALIGN_JUSTIFIED || alignment == Element.ALIGN_JUSTIFIED_ALL) && width != 0);
}
 
Example 10
Source File: PdfLine.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Checks if a newline caused the line split.
 * @return <CODE>true</CODE> if a newline caused the line split
 */
public boolean isNewlineSplit() {
    return newlineSplit && (alignment != Element.ALIGN_JUSTIFIED_ALL);
}
 
Example 11
Source File: PdfLine.java    From MesquiteCore with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Checks if this line has to be justified.
 *
 * @return	<CODE>true</CODE> if the alignment equals <VAR>ALIGN_JUSTIFIED</VAR> and there is some width left.
 */

public boolean hasToBeJustified() {
    return ((alignment == Element.ALIGN_JUSTIFIED || alignment == Element.ALIGN_JUSTIFIED_ALL) && width != 0);
}
 
Example 12
Source File: PdfLine.java    From MesquiteCore with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Checks if a newline caused the line split.
 * @return <CODE>true</CODE> if a newline caused the line split
 */
public boolean isNewlineSplit() {
    return newlineSplit && (alignment != Element.ALIGN_JUSTIFIED_ALL);
}