本文整理匯總了Java中com.lowagie.text.Element.ALIGN_MIDDLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Element.ALIGN_MIDDLE屬性的具體用法?Java Element.ALIGN_MIDDLE怎麽用?Java Element.ALIGN_MIDDLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.lowagie.text.Element
的用法示例。
在下文中一共展示了Element.ALIGN_MIDDLE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 "";
}
}
示例2: writeDefinition
/**
* Write the cell definition part of this RtfCell
*/
public void writeDefinition(final OutputStream result) throws IOException
{
if(this.mergeType == MERGE_VERT_PARENT) {
result.write(DocWriter.getISOBytes("\\clvmgf"));
} else if(this.mergeType == MERGE_VERT_CHILD) {
result.write(DocWriter.getISOBytes("\\clvmrg"));
}
switch (verticalAlignment) {
case Element.ALIGN_BOTTOM:
result.write(DocWriter.getISOBytes("\\clvertalb"));
break;
case Element.ALIGN_CENTER:
case Element.ALIGN_MIDDLE:
result.write(DocWriter.getISOBytes("\\clvertalc"));
break;
case Element.ALIGN_TOP:
result.write(DocWriter.getISOBytes("\\clvertalt"));
break;
}
this.borders.writeContent(result);
if(this.backgroundColor != null) {
result.write(DocWriter.getISOBytes("\\clcbpat"));
result.write(intToByteArray(this.backgroundColor.getColorNumber()));
}
this.document.outputDebugLinebreak(result);
result.write(DocWriter.getISOBytes("\\clftsWidth3"));
this.document.outputDebugLinebreak(result);
result.write(DocWriter.getISOBytes("\\clwWidth"));
result.write(intToByteArray(this.cellWidth));
this.document.outputDebugLinebreak(result);
if(this.cellPadding > 0) {
result.write(DocWriter.getISOBytes("\\clpadl"));
result.write(intToByteArray(this.cellPadding / 2));
result.write(DocWriter.getISOBytes("\\clpadt"));
result.write(intToByteArray(this.cellPadding / 2));
result.write(DocWriter.getISOBytes("\\clpadr"));
result.write(intToByteArray(this.cellPadding / 2));
result.write(DocWriter.getISOBytes("\\clpadb"));
result.write(intToByteArray(this.cellPadding / 2));
result.write(DocWriter.getISOBytes("\\clpadfl3"));
result.write(DocWriter.getISOBytes("\\clpadft3"));
result.write(DocWriter.getISOBytes("\\clpadfr3"));
result.write(DocWriter.getISOBytes("\\clpadfb3"));
}
result.write(DocWriter.getISOBytes("\\cellx"));
result.write(intToByteArray(this.cellRight));
}
示例3: setBottom
/**
* Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
* to appropriately align the contents vertically.
* @param value
*/
public void setBottom(float value) {
super.setBottom(value);
float firstLineRealHeight = firstLineRealHeight();
float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
float interiorHeight = totalHeight - nonContentHeight;
float extraHeight = 0.0f;
switch (verticalAlignment) {
case Element.ALIGN_BOTTOM:
extraHeight = interiorHeight - contentHeight;
break;
case Element.ALIGN_MIDDLE:
extraHeight = (interiorHeight - contentHeight) / 2.0f;
break;
default: // ALIGN_TOP
extraHeight = 0f;
}
extraHeight += cellpadding() + cellspacing();
extraHeight += getBorderWidthInside(TOP);
if (firstLine != null) {
firstLine.height = firstLineRealHeight + extraHeight;
}
}