當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.ALIGN_JUSTIFIED_ALL屬性代碼示例

本文整理匯總了Java中com.lowagie.text.Element.ALIGN_JUSTIFIED_ALL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Element.ALIGN_JUSTIFIED_ALL屬性的具體用法?Java Element.ALIGN_JUSTIFIED_ALL怎麽用?Java Element.ALIGN_JUSTIFIED_ALL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.lowagie.text.Element的用法示例。


在下文中一共展示了Element.ALIGN_JUSTIFIED_ALL屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAlignment

/**
* 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 "";
       }
   }
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:30,代碼來源:HtmlEncoder.java

示例2: writeRowDefinition

/**
 * 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);
    }    	
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:67,代碼來源:RtfRow.java

示例3: writeListBeginning

/**
 * 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));
    }
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:34,代碼來源:RtfListLevel.java

示例4: writeParagraphSettings

/**
 * 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));
    }            
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:47,代碼來源:RtfParagraphStyle.java

示例5: initialize

/**
 * 
 */
public void initialize(
	JRPdfExporter pdfExporter, 
	PdfContentByte pdfContentByte,
	JRPrintText text, JRStyledText styledText, 
	int offsetX,
	int offsetY
	)
{
	this.pdfExporter = pdfExporter;
	this.pdfContentByte = pdfContentByte;
	
	horizontalAlignment = Element.ALIGN_LEFT;
	leftOffsetFactor = 0f;
	rightOffsetFactor = 0f;
	
	//FIXMETAB 0.2f was a fair approximation
	switch (text.getHorizontalTextAlign())
	{
		case JUSTIFIED :
		{
			horizontalAlignment = Element.ALIGN_JUSTIFIED_ALL;
			leftOffsetFactor = 0f;
			rightOffsetFactor = 0f;
			break;
		}
		case RIGHT :
		{
			if (text.getRunDirectionValue() == RunDirectionEnum.LTR)
			{
				horizontalAlignment = Element.ALIGN_RIGHT;
			}
			else
			{
				horizontalAlignment = Element.ALIGN_LEFT;
			}
			leftOffsetFactor = -0.2f;
			rightOffsetFactor = 0f;
			break;
		}
		case CENTER :
		{
			horizontalAlignment = Element.ALIGN_CENTER;
			leftOffsetFactor = -0.1f;
			rightOffsetFactor = 0.1f;
			break;
		}
		case LEFT :
		default :
		{
			if (text.getRunDirectionValue() == RunDirectionEnum.LTR)
			{
				horizontalAlignment = Element.ALIGN_LEFT;
			}
			else
			{
				horizontalAlignment = Element.ALIGN_RIGHT;
			}
			leftOffsetFactor = 0f;
			rightOffsetFactor = 0.2f;
			break;
		}
	}

	super.initialize(text, styledText, offsetX, offsetY);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:68,代碼來源:AbstractPdfTextRenderer.java

示例6: hasToBeJustified

/**
 * 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);
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:9,代碼來源:PdfLine.java

示例7: isNewlineSplit

/**
 * 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);
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:7,代碼來源:PdfLine.java


注:本文中的com.lowagie.text.Element.ALIGN_JUSTIFIED_ALL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。