本文整理汇总了Java中com.lowagie.text.Section类的典型用法代码示例。如果您正苦于以下问题:Java Section类的具体用法?Java Section怎么用?Java Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Section类属于com.lowagie.text包,在下文中一共展示了Section类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setSectionParameters
import com.lowagie.text.Section; //导入依赖的package包/类
/**
* Helper method to create a Chapter/Section object.
* @param attributes
*/
private static void setSectionParameters(Section section,
Properties attributes) {
String value;
value = attributes.getProperty(ElementTags.NUMBERDEPTH);
if (value != null) {
section.setNumberDepth(Integer.parseInt(value));
}
value = attributes.getProperty(ElementTags.INDENT);
if (value != null) {
section.setIndentation(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(ElementTags.INDENTATIONLEFT);
if (value != null) {
section.setIndentationLeft(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(ElementTags.INDENTATIONRIGHT);
if (value != null) {
section.setIndentationRight(Float.parseFloat(value + "f"));
}
}
开发者ID:albfernandez,项目名称:itext2,代码行数:25,代码来源:ElementFactory.java
示例2: installApiDocs
import com.lowagie.text.Section; //导入依赖的package包/类
@Override
public void installApiDocs(List<ApiDoc> apiDocs) throws Exception {
for (Chapter chapter : categoryChapters.keySet()) {
ApiCategory apiCategory = categoryChapters.get(chapter);
for (ApiDoc apiDoc : DocContainer.get().getApiDocQuery().queryByCategory(apiCategory.getCid())) {
Section section = chapter.addSection(new Paragraph(secFont.process(apiDoc.getName())));
section.setIndentation(10);
section.setIndentationLeft(10);
section.setBookmarkOpen(false);
section.setNumberStyle(Section.NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT);
//desc
section.add(new Paragraph(textFont.process(apiDoc.getDesc())));
//summary
addSummary(section, apiDoc);
//parameters
addParameters(section, apiDoc);
//Result
addResult(section, apiDoc);
//ResultExample
addResultExample(section, apiDoc);
}
document.add(chapter);
}
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:25,代码来源:SimplePdfDocInstaller.java
示例3: installApiTypeDocs
import com.lowagie.text.Section; //导入依赖的package包/类
@Override
public void installApiTypeDocs(List<ApiTypeDoc> apiTypeDocs) throws Exception {
Paragraph paRefType = new Paragraph(chFont.process("引用类型参考\n"));
Chapter chapter = new Chapter(paRefType, categoryChapters.size()+1);
for (ApiTypeDoc apiTypeDoc : apiTypeDocs) {
Phrase chunk = secFont.process(apiTypeDoc.getName());
ItextUtil.setLocalDestination(chunk, REFTYPE_LINK_PREFIX + apiTypeDoc.getName());
Section section = chapter.addSection(new Paragraph(chunk));
section.setIndentation(10);
section.setIndentationLeft(10);
section.setBookmarkOpen(false);
section.setNumberStyle(Section.NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT);
//desc
section.add(new Paragraph(textFont.process(apiTypeDoc.getDesc())));
//属性
addTypeAttrs(section, apiTypeDoc.getAttrs());
}
document.add(chapter);
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:22,代码来源:SimplePdfDocInstaller.java
示例4: addSummary
import com.lowagie.text.Section; //导入依赖的package包/类
private void addSummary(Section section, ApiDoc apiDoc) throws Exception {
Paragraph summary = new Paragraph(itemFont.process("★简要信息"));
summary.setSpacingBefore(6f);
summary.setSpacingAfter(8f);
List<String[]> rowDatas = new ArrayList<String[]>();
rowDatas.add(new String[]{apiDoc.getMapping()});
rowDatas.add(new String[]{apiDoc.getAuthor()});
rowDatas.add(new String[]{apiDoc.getVersion()});
PdfPTable table = DefaultPdfTable.get().create(TBDirection.Vertical, rowDatas.size(),
new String[]{"映射地址", "作者", "版本"}, new int[]{1, 10});
DefaultPdfTable.get().setDataAlignments(new int[]{Element.ALIGN_LEFT});
DefaultPdfTable.get().setRowDatas(rowDatas);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(table);
section.add(summary);
section.add(wrapperTable);
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:21,代码来源:SimplePdfDocInstaller.java
示例5: addParameters
import com.lowagie.text.Section; //导入依赖的package包/类
private void addParameters(Section section, ApiDoc apiDoc) throws Exception {
Paragraph inputParams = new Paragraph(itemFont.process("★输入参数"));
inputParams.setSpacingBefore(6f);
inputParams.setSpacingAfter(8f);
List<String[]> rowDatas = new ArrayList<String[]>();
for (ParamDoc paramDoc : apiDoc.getParams()) {
String required = paramDoc.getRequired() ? "必须" : "可选";
rowDatas.add(new String[]{paramDoc.getName(), paramDoc.getType(),
required, paramDoc.getExampleValue(), paramDoc.getDefaultValue(), paramDoc.getDesc()});
}
PdfPTable paramTable = DefaultPdfTable.get().create(TBDirection.Horizontal, rowDatas.size()+1,
new String[]{"名称", "类型", "是否必须", "示例值", "默认值", "描述"},
new int[]{15, 10, 10, 15, 10, 40});
DefaultPdfTable.get().setDataAlignments(new int[]{Element.ALIGN_CENTER, Element.ALIGN_CENTER,
Element.ALIGN_CENTER, Element.ALIGN_CENTER, Element.ALIGN_CENTER, Element.ALIGN_LEFT});
DefaultPdfTable.get().setRowDatas(rowDatas);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(paramTable);
section.add(inputParams);
section.add(wrapperTable);
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:26,代码来源:SimplePdfDocInstaller.java
示例6: addResultExample
import com.lowagie.text.Section; //导入依赖的package包/类
private void addResultExample(Section section, ApiDoc apiDoc) throws Exception {
Paragraph result = new Paragraph(itemFont.process("★返回示例"));
// result.setLeading(6f);
result.setSpacingBefore(6f);
result.setSpacingAfter(8f);
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(95f);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
PdfPCell pdfPCell = table.getDefaultCell();
pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT);
pdfPCell.setBackgroundColor(Color.LIGHT_GRAY);
if (apiDoc.getResultDoc() != null && apiDoc.getResultExample() != null) {
pdfPCell.setPhrase(DefaultPdfTable.tableBSelector.process(apiDoc.getResultExample()));
}
table.addCell(pdfPCell);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setSpacingAfter(8f);
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(table);
section.add(result);
section.add(wrapperTable);
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:25,代码来源:SimplePdfDocInstaller.java
示例7: addImage
import com.lowagie.text.Section; //导入依赖的package包/类
protected void addImage(Image img) throws EmptyStackException {
// if there is an element on the stack...
Object current = stack.pop();
// ...and it's a Chapter or a Section, the Image can be
// added directly
if (current instanceof Chapter
|| current instanceof Section
|| current instanceof Cell) {
((TextElementArray) current).add(img);
stack.push(current);
return;
}
// ...if not, we need to to a lot of stuff
else {
Stack newStack = new Stack();
while (!(current instanceof Chapter
|| current instanceof Section || current instanceof Cell)) {
newStack.push(current);
if (current instanceof Anchor) {
img.setAnnotation(new Annotation(0, 0, 0,
0, ((Anchor) current).getReference()));
}
current = stack.pop();
}
((TextElementArray) current).add(img);
stack.push(current);
while (!newStack.empty()) {
stack.push(newStack.pop());
}
return;
}
}
开发者ID:albfernandez,项目名称:itext2,代码行数:33,代码来源:SAXiTextHandler.java
示例8: writeSection
import com.lowagie.text.Section; //导入依赖的package包/类
/**
* Writes the HTML representation of a section.
*
* @param section the section to write
* @param indent the indentation
* @throws IOException
*/
protected void writeSection(Section section, int indent) throws IOException {
if (section.getTitle() != null) {
int depth = section.getDepth() - 1;
if (depth > 5) {
depth = 5;
}
Properties styleAttributes = new Properties();
if (section.getTitle().hasLeading()) styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, section.getTitle().getTotalLeading() + "pt");
// start tag
addTabs(indent);
writeStart(HtmlTags.H[depth]);
write(section.getTitle().getFont(), styleAttributes);
String alignment = HtmlEncoder.getAlignment(section.getTitle().getAlignment());
if (!"".equals(alignment)) {
write(HtmlTags.ALIGN, alignment);
}
writeMarkupAttributes(markup);
os.write(GT);
currentfont.push(section.getTitle().getFont());
// contents
for (Iterator i = section.getTitle().iterator(); i.hasNext(); ) {
write((Element)i.next(), indent + 1);
}
// end tag
addTabs(indent);
writeEnd(HtmlTags.H[depth]);
currentfont.pop();
}
for (Iterator i = section.iterator(); i.hasNext(); ) {
write((Element) i.next(), indent);
}
}
开发者ID:albfernandez,项目名称:itext2,代码行数:41,代码来源:HtmlWriter.java
示例9: writeSection
import com.lowagie.text.Section; //导入依赖的package包/类
/**
* Writes the HTML representation of a section.
*
* @param section
* the section to write
* @param indent
* the indentation
* @throws IOException
*/
protected void writeSection(Section section, int indent) throws IOException {
if (section.getTitle() != null) {
int depth = section.getDepth() - 1;
if (depth > 5) {
depth = 5;
}
Properties styleAttributes = new Properties();
if (section.getTitle().hasLeading())
styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, section.getTitle().getTotalLeading() + "pt");
// start tag
addTabs(indent);
writeStart(HtmlTags.H[depth]);
write(section.getTitle().getFont(), styleAttributes);
String alignment = HtmlEncoder.getAlignment(section.getTitle().getAlignment());
if (!"".equals(alignment)) {
write(HtmlTags.ALIGN, alignment);
}
writeMarkupAttributes(markup);
os.write(GT);
currentfont.push(section.getTitle().getFont());
// contents
for (Iterator i = section.getTitle().iterator(); i.hasNext();) {
write((Element) i.next(), indent + 1);
}
// end tag
addTabs(indent);
writeEnd(HtmlTags.H[depth]);
currentfont.pop();
}
for (Iterator i = section.iterator(); i.hasNext();) {
write((Element) i.next(), indent);
}
}
开发者ID:bullda,项目名称:DroidText,代码行数:44,代码来源:HtmlWriter.java
示例10: getSection
import com.lowagie.text.Section; //导入依赖的package包/类
/**
* Creates a Section object based on a list of properties.
* @param attributes
* @return a Section
*/
public static Section getSection(Section parent, Properties attributes) {
Section section = parent.addSection("");
setSectionParameters(section, attributes);
return section;
}
开发者ID:albfernandez,项目名称:itext2,代码行数:11,代码来源:ElementFactory.java
示例11: addResult
import com.lowagie.text.Section; //导入依赖的package包/类
private void addResult(Section section, ApiDoc apiDoc) throws Exception {
Paragraph result = new Paragraph(itemFont.process("★返回结果"));
result.setSpacingBefore(6f);
result.setSpacingAfter(8f);
List<String[]> rowDatas = new ArrayList<String[]>();
if (apiDoc.getResultDoc() != null) {
rowDatas.add(new String[]{null, null, apiDoc.getResultDoc().getExampleValue(), apiDoc.getResultDoc().getDesc()});
}
PdfPTable resultTable = DefaultPdfTable.get().create(TBDirection.Horizontal, rowDatas.size()+1,
new String[]{"类型", "引用类型", "示例值", "描述"},
new int[]{15, 30, 15, 40});
DefaultPdfTable.get().setDataAlignments(new int[]{Element.ALIGN_CENTER, Element.ALIGN_CENTER,
Element.ALIGN_CENTER, Element.ALIGN_LEFT});
DefaultPdfTable.get().setRowDatas(rowDatas);
if (apiDoc.getResultDoc() != null) {
//type
Phrase phraseType = DefaultPdfTable.tableBSelector.process(apiDoc.getResultDoc().getType());
if (!apiDoc.getResultDoc().getIsSimpleType()) {
ItextUtil.setLocalGoto(phraseType, REFTYPE_LINK_PREFIX + apiDoc.getResultDoc().getType());
}
DefaultPdfTable.get().getCell(resultTable, 1, 0).setPhrase(phraseType);
//refType
Phrase refTypePhrase = new Phrase();
for (RefTypeDoc refTypeDoc : apiDoc.getResultDoc().getRefTypes()) {
Phrase chunk = DefaultPdfTable.tableBSelector.process(refTypeDoc.getName() + " ");
if (!refTypeDoc.getIsSimpleType()) {
ItextUtil.setLocalGoto(chunk, REFTYPE_LINK_PREFIX + refTypeDoc.getName());
}
refTypePhrase.add(chunk);
}
DefaultPdfTable.get().getCell(resultTable, 1, 1).setPhrase(refTypePhrase);
}
Paragraph wrapperTable = new Paragraph();
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(resultTable);
section.add(result);
section.add(wrapperTable);
}
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:44,代码来源:SimplePdfDocInstaller.java
注:本文中的com.lowagie.text.Section类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论