当前位置: 首页>>代码示例>>Java>>正文


Java Alignment类代码示例

本文整理汇总了Java中rst.pdfbox.layout.text.Alignment的典型用法代码示例。如果您正苦于以下问题:Java Alignment类的具体用法?Java Alignment怎么用?Java Alignment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Alignment类属于rst.pdfbox.layout.text包,在下文中一共展示了Alignment类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
@Override
public void render(Document target, int indent, CertificateStyle style) throws IOException {
    
    int offset = indent * style.getListIndent();
    for (Element item : items) {
        if (item instanceof ElementList) {
            ((ElementList)item).render(target, indent+1, style);
        } else if (item instanceof ElementText) {
            Paragraph paragraph = new Paragraph();
            paragraph.add(new Indent(getListItemIndicator(indent), offset, SpaceUnit.pt, style.getTextSize(),
                                     getListItemIndicatorFont(style).getPlainFont(), Alignment.Right));
            paragraph.addMarkup(((ElementText)item).getText(), style.getTextSize(), style.getTextFont());
            target.add(paragraph);
        } else {
            throw new IllegalStateException("Unsupported element");
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:19,代码来源:ElementList.java

示例2: writeAttributes

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
private void writeAttributes() throws IOException {

        List<InstanceAttribute> instanceAttributes = data.getInstanceAttributes();

        if (!instanceAttributes.isEmpty()) {

            resetLayout();
            drawHorizontalSeparator();

            Paragraph mapTitle = new Paragraph();
            mapTitle.addText(data.getBundleString("attributes"), TITLE_MAP_SIZE, TEXT_BOLD_FONT);
            breakLine(mapTitle);

            document.add(mapTitle, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, MAP_TITLE_MARGIN_BOTTOM));

            InstanceAttribute headerAttribute = new InstanceTextAttribute(
                    data.getBundleString("attributes.name"),
                    data.getBundleString("attributes.value"),
                    false
            );

            writeAttribute(headerAttribute, true);

            for (InstanceAttribute attr : instanceAttributes) {
                writeAttribute(attr, false);
            }
        }

    }
 
开发者ID:polarsys,项目名称:eplmp,代码行数:30,代码来源:TitleBlockWriter.java

示例3: drawWorkflow

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
private void drawWorkflow(Workflow workflow) throws IOException {
    if (workflow != null) {
        resetLayout();
        drawHorizontalSeparator();
        Paragraph paragraph = new Paragraph();
        paragraph.addText(data.getBundleString("lifecycle"), TITLE_MAP_SIZE, TEXT_BOLD_FONT);
        document.add(paragraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 10));

        for (Activity activity : workflow.getActivities()) {
            drawActivity(activity);
        }
    }
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:14,代码来源:TitleBlockWriter.java

示例4: afterPage

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
@Override
public void afterPage(RenderContext renderContext) throws IOException {
    String content = String.format("Section %s, Page %s",
	    sectionNumber, renderContext.getPageIndex() + 1);
    TextFlow text = TextFlowUtil.createTextFlow(content, 11,
	    PDType1Font.TIMES_ROMAN);
    float offset = renderContext.getPageFormat().getMarginLeft()
	    + TextSequenceUtil.getOffset(text,
		    renderContext.getWidth(), Alignment.Right);
    text.drawText(renderContext.getContentStream(), new Position(
	    offset, 30), Alignment.Right, null);
}
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:13,代码来源:CustomRenderer.java

示例5: writeEntityInfo

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
private void writeEntityInfo() throws IOException {

        Paragraph titleParagraph = new Paragraph();
        titleParagraph.addText(data.getTitle(), DOCUMENT_TITLE_SIZE, TEXT_BOLD_FONT);
        document.add(titleParagraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, TITLE_MARGIN_BOTTOM));

        Paragraph paragraph = new Paragraph();
        paragraph.addText(data.getBundleString("original.author"), TEXT_SIZE, TEXT_BOLD_FONT);
        space(paragraph);
        paragraph.addText(data.getAuthorName(), TEXT_SIZE, TEXT_REGULAR_FONT);
        breakLine(paragraph);
        paragraph.addText(data.getBundleString("iteration.date"), TEXT_SIZE, TEXT_BOLD_FONT);
        space(paragraph);
        paragraph.addText(data.getCreationDate(), TEXT_SIZE, TEXT_REGULAR_FONT);
        breakLine(paragraph);
        paragraph.addText(data.getBundleString("iteration"), TEXT_SIZE, TEXT_BOLD_FONT);
        space(paragraph);
        paragraph.addText(data.getCurrentIteration(), TEXT_SIZE, TEXT_REGULAR_FONT);
        breakLine(paragraph);
        paragraph.addText(data.getBundleString("iteration.date"), TEXT_SIZE, TEXT_BOLD_FONT);
        space(paragraph);
        paragraph.addText(data.getIterationDate(), TEXT_SIZE, TEXT_REGULAR_FONT);
        breakLine(paragraph);

        String revisionNote = data.getRevisionNote();

        if (revisionNote != null) {
            paragraph.addText(data.getBundleString("iteration.note"), TEXT_SIZE, TEXT_BOLD_FONT);
            space(paragraph);
            paragraph.addText(revisionNote, TEXT_SIZE, TEXT_REGULAR_FONT);
        }

        document.add(paragraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 5));

        String description = data.getDescription();

        if (description != null && !description.isEmpty()) {
            drawLightHorizontalSeparator();
            Paragraph descriptionParagraph = new Paragraph();
            descriptionParagraph.addText(description, TEXT_SIZE, TEXT_ITALIC_FONT);
            document.add(descriptionParagraph);
        }

    }
 
开发者ID:polarsys,项目名称:eplmp,代码行数:45,代码来源:TitleBlockWriter.java

示例6: drawTask

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
private void drawTask(Task task) throws IOException {

        String iconMessage;
        String taskMessage;

        switch (task.getStatus()) {
            case APPROVED:
                iconMessage = "\uf00c";
                taskMessage = data.getBundleString("lifecycle.approved");
                break;
            case REJECTED:
                iconMessage = "\uf00d";
                taskMessage = data.getBundleString("lifecycle.rejected");
                break;
            default:
                // Dont draw other tasks status
                return;
        }

        Paragraph left = new Paragraph();
        document.add(new ColumnLayout(2, CELLS_SPACING));
        left.addText(iconMessage, TEXT_SIZE, iconFont);
        space(left);
        left.addText(task.getTitle(), TEXT_SIZE, TEXT_BOLD_FONT);

        document.add(left, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 0));

        document.add(ColumnLayout.NEWCOLUMN);

        Date closureDate = task.getClosureDate();
        Paragraph right = new Paragraph();
        if (closureDate != null) {
            right.addText(data.format(closureDate), TEXT_SIZE, TEXT_ITALIC_FONT);
        }
        document.add(right, new VerticalLayoutHint(Alignment.Right, 0, 0, 0, 0));

        resetLayout();

        document.add(new ColumnLayout(4, CELLS_SPACING));

        Paragraph taskDetailsLeft = new Paragraph();
        taskDetailsLeft.addText(taskMessage, TEXT_SIZE, TEXT_ITALIC_FONT);
        space(taskDetailsLeft);
        taskDetailsLeft.addText(task.getWorker().getName(), TEXT_SIZE, TEXT_BOLD_FONT);
        document.add(taskDetailsLeft, new VerticalLayoutHint(Alignment.Left, 0, 0, 10, 10));

        document.add(ColumnLayout.NEWCOLUMN);

        Paragraph taskDetailsRight = new Paragraph();
        taskDetailsRight.addText(task.getClosureComment(), SMALL_TEXT_SIZE, TEXT_ITALIC_FONT);
        document.add(taskDetailsRight, new VerticalLayoutHint(Alignment.Left, 0, 0, 10, 10));
        taskDetailsRight.setMaxWidth(360.0f);

        resetLayout();
    }
 
开发者ID:polarsys,项目名称:eplmp,代码行数:56,代码来源:TitleBlockWriter.java

示例7: drawReletivePartAndMovePosition

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
    * Actually draws the (drawble) part at the
    * {@link RenderContext#getCurrentPosition()} and - depending on flag
    * <code>movePosition</code> - moves to the new Y position. Any left or
    * right margin is taken into account to calculate the position and
    * alignment.
    * 
    * @param renderContext
    *            the context providing all rendering state.
    * @param drawable
    *            the drawable to draw.
    * @param layoutHint
    *            the layout hint used to layout.
    * @param movePosition
    *            indicates if the position should be moved (vertically) after
    *            drawing.
    * @throws IOException
    *             by pdfbox
    */
   protected void drawReletivePartAndMovePosition(
    final RenderContext renderContext, Drawable drawable,
    final LayoutHint layoutHint, final boolean movePosition)
    throws IOException {
PDPageContentStream contentStream = renderContext.getContentStream();
PageFormat pageFormat = renderContext.getPageFormat();
float offsetX = 0;
if (layoutHint instanceof VerticalLayoutHint) {
    VerticalLayoutHint verticalLayoutHint = (VerticalLayoutHint) layoutHint;
    Alignment alignment = verticalLayoutHint.getAlignment();
    float horizontalExtraSpace = getTargetWidth(renderContext)
	    - drawable.getWidth();
    switch (alignment) {
    case Right:
	offsetX = horizontalExtraSpace
		- verticalLayoutHint.getMarginRight();
	break;
    case Center:
	offsetX = horizontalExtraSpace / 2f;
	break;
    default:
	offsetX = verticalLayoutHint.getMarginLeft();
	break;
    }
}

contentStream.saveGraphicsState();
contentStream.addRect(0, pageFormat.getMarginBottom(), renderContext.getPageWidth(),
	renderContext.getHeight());
CompatibilityHelper.clip(contentStream);

drawable.draw(renderContext.getPdDocument(), contentStream,
	renderContext.getCurrentPosition().add(offsetX, 0),renderContext);

contentStream.restoreGraphicsState();

if (movePosition) {
    renderContext.movePositionBy(0, -drawable.getHeight());
}
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:60,代码来源:VerticalLayout.java

示例8: VerticalLayoutHint

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
    * Creates a layout hint with {@link Alignment#Left left alignment}.
    */
   public VerticalLayoutHint() {
this(Alignment.Left);
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:7,代码来源:VerticalLayoutHint.java

示例9: getAlignment

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
public Alignment getAlignment() {
return alignment;
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:4,代码来源:VerticalLayoutHint.java

示例10: getAlignment

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
    * @return the text alignment to apply. Default is left.
    */
   public Alignment getAlignment() {
return alignment;
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:7,代码来源:Paragraph.java

示例11: getTitleAlignment

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
 * @return the titleAlignment
 */
public Alignment getTitleAlignment() {
    return titleAlignment;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:7,代码来源:CertificateStyle.java

示例12: setTitleAlignment

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
 * @param titleAlignment the titleAlignment to set
 */
public CertificateStyle setTitleAlignment(Alignment titleAlignment) {
    this.titleAlignment = titleAlignment;
    return this;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:8,代码来源:CertificateStyle.java

示例13: ColumnLayoutHint

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
    * Creates a layout hint with the given alignment and margins.
    * 
    * @param alignment
    *            the element alignment.
    * @param marginLeft
    *            the left alignment.
    * @param marginRight
    *            the right alignment.
    * @param marginTop
    *            the top alignment.
    * @param marginBottom
    *            the bottom alignment.
    * @param resetY
    *            if <code>true</code>, the y coordinate will be reset to the
    *            point before layouting the element.
    */
   public ColumnLayoutHint(Alignment alignment, float marginLeft,
    float marginRight, float marginTop, float marginBottom,
    boolean resetY) {
super(alignment, marginLeft, marginRight, marginTop, marginBottom,
	resetY);
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:24,代码来源:ColumnLayoutHint.java

示例14: setAlignment

import rst.pdfbox.layout.text.Alignment; //导入依赖的package包/类
/**
    * Sets the alignment to apply.
    * 
    * @param alignment
    *            the text alignment.
    */
   public void setAlignment(Alignment alignment) {
this.alignment = alignment;
   }
 
开发者ID:ralfstuckert,项目名称:pdfbox-layout,代码行数:10,代码来源:Paragraph.java


注:本文中的rst.pdfbox.layout.text.Alignment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。