List of usage examples for com.lowagie.text Element ALIGN_LEFT
int ALIGN_LEFT
To view the source code for com.lowagie.text Element ALIGN_LEFT.
Click Source Link
From source file:net.bull.javamelody.swing.print.MPdfWriter.java
License:Apache License
/** * Effectue le rendu de la liste./* ww w.ja v a 2 s .co m*/ * * @param table * MBasicTable * @param datatable * Table * @throws BadElementException * e */ protected void renderList(final MBasicTable table, final Table datatable) throws BadElementException { final int columnCount = table.getColumnCount(); final int rowCount = table.getRowCount(); // data rows final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL); datatable.getDefaultCell().setBorderWidth(1); datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // datatable.setDefaultCellGrayFill(0); Object value; String text; int horizontalAlignment; for (int k = 0; k < rowCount; k++) { for (int i = 0; i < columnCount; i++) { value = getValueAt(table, k, i); if (value instanceof Number || value instanceof Date) { horizontalAlignment = Element.ALIGN_RIGHT; } else if (value instanceof Boolean) { horizontalAlignment = Element.ALIGN_CENTER; } else { horizontalAlignment = Element.ALIGN_LEFT; } datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment); text = getTextAt(table, k, i); datatable.addCell(new Phrase(8, text != null ? text : "", font)); } } }
From source file:net.bull.javamelody.swing.print.MRtfWriter.java
License:Apache License
/** * We create a writer that listens to the document and directs a RTF-stream to out * * @param table/* ww w. j ava2 s .com*/ * MBasicTable * @param document * Document * @param out * OutputStream * @return DocWriter */ @Override protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) { final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // title final String title = buildTitle(table); if (title != null) { final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title)); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } // advanced page numbers : x/y final Paragraph footerParagraph = new Paragraph(); final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); return writer; }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createDetailSection(List details, Document doc) throws CoreException, DocumentException { Table table = new Table(4); table.setSpaceInsideCell(10);//from w ww . ja v a2s . c o m table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 30, 30, 10, 30 }); Cell resourceHeader = new Cell(new Chunk(Messages.MarkerStatsView_fileColumn, tableHeaderAndFooterFont)); resourceHeader.setHorizontalAlignment(Element.ALIGN_CENTER); resourceHeader.setHeader(true); table.addCell(resourceHeader); Cell folderHeader = new Cell(new Chunk(Messages.MarkerStatsView_folderColumn, tableHeaderAndFooterFont)); folderHeader.setHorizontalAlignment(Element.ALIGN_CENTER); folderHeader.setHeader(true); table.addCell(folderHeader); Cell lineHeader = new Cell(new Chunk(Messages.MarkerStatsView_lineColumn, tableHeaderAndFooterFont)); lineHeader.setHorizontalAlignment(Element.ALIGN_CENTER); lineHeader.setHeader(true); table.addCell(lineHeader); Cell messageHeader = new Cell(new Chunk(Messages.MarkerStatsView_messageColumn, tableHeaderAndFooterFont)); messageHeader.setHorizontalAlignment(Element.ALIGN_CENTER); messageHeader.setHeader(true); table.addCell(messageHeader); Cell resourceCell; Cell fileCell; Cell lineCell; Cell messageCell; for (Iterator iter = details.iterator(); iter.hasNext();) { IMarker marker = (IMarker) iter.next(); resourceCell = new Cell(new Chunk(marker.getResource().getName(), mainFont)); table.addCell(resourceCell); fileCell = new Cell(new Chunk(marker.getResource().getParent().getFullPath().toString(), mainFont)); table.addCell(fileCell); lineCell = new Cell(new Chunk(marker.getAttribute(IMarker.LINE_NUMBER).toString(), mainFont)); lineCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(lineCell); messageCell = new Cell(new Chunk(marker.getAttribute(IMarker.MESSAGE).toString(), mainFont)); table.addCell(messageCell); } doc.add(table); }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createSummaryTable(Stats stats, Document doc) throws DocumentException { Table table = new Table(2); table.setSpaceInsideCell(10);/*ww w . ja v a 2s. c o m*/ table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 80, 20 }); Cell typeHeader = new Cell(new Chunk(Messages.MarkerStatsView_kindOfErrorColumn, tableHeaderAndFooterFont)); typeHeader.setHorizontalAlignment(Element.ALIGN_CENTER); typeHeader.setHeader(true); table.addCell(typeHeader); Cell countHeader = new Cell( new Chunk(Messages.MarkerStatsView_numberOfErrorsColumn, tableHeaderAndFooterFont)); countHeader.setHorizontalAlignment(Element.ALIGN_CENTER); countHeader.setHeader(true); table.addCell(countHeader); ArrayList markerStatsSortedList = new ArrayList(stats.getMarkerStats()); Collections.sort(markerStatsSortedList, new Comparator() { public int compare(Object arg0, Object arg1) { MarkerStat markerStat0 = (MarkerStat) arg0; MarkerStat markerStat1 = (MarkerStat) arg1; return markerStat1.getCount() - markerStat0.getCount(); } }); Cell typeCell; Cell countCell; for (Iterator iter = markerStatsSortedList.iterator(); iter.hasNext();) { MarkerStat markerStat = (MarkerStat) iter.next(); typeCell = new Cell(new Chunk(markerStat.getIdentifiant(), mainFont)); table.addCell(typeCell); countCell = new Cell(new Chunk(markerStat.getCount() + "", mainFont)); countCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(countCell); } doc.add(table); }
From source file:net.sf.jasperreports.engine.export.AbstractPdfTextRenderer.java
License:Open Source License
/** * /*from w w w.ja v a2s . c o m*/ */ public void initialize(JRPdfExporter pdfExporter, PdfContentByte pdfContentByte, JRPrintText text, 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.getHorizontalAlignmentValue()) { 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, offsetX, offsetY); }
From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java
License:LGPL
protected void writePageAnchor(int pageIndex) throws DocumentException { Map pdfFontAttrs = getDefaultPdfFontAttributes(); Chunk chunk;/*from ww w . j a v a2s. c o m*/ if (pdfFontAttrs == null) { chunk = new Chunk(" "); } else { Font pdfFont = getFont(pdfFontAttrs); chunk = new Chunk(" ", pdfFont); } chunk.setLocalDestination(JR_PAGE_ANCHOR_PREFIX + reportIndex + "_" + (pageIndex + 1)); ColumnText colText = new ColumnText(pdfContentByte); colText.setSimpleColumn(new Phrase(chunk), 0, jasperPrint.getPageHeight(), 1, 1, 0, Element.ALIGN_LEFT); colText.go(); }
From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java
License:LGPL
/** * *///from w ww. jav a 2s. co m protected void exportImage(JRPrintImage printImage) throws DocumentException, IOException, JRException { if (printImage.getMode() == JRElement.MODE_OPAQUE) { pdfContentByte.setRGBColorFill(printImage.getBackcolor().getRed(), printImage.getBackcolor().getGreen(), printImage.getBackcolor().getBlue()); pdfContentByte.rectangle(printImage.getX() + getOffsetX(), jasperPrint.getPageHeight() - printImage.getY() - getOffsetY(), printImage.getWidth(), -printImage.getHeight()); pdfContentByte.fill(); } int topPadding = printImage.getLineBox().getTopPadding().intValue(); int leftPadding = printImage.getLineBox().getLeftPadding().intValue(); int bottomPadding = printImage.getLineBox().getBottomPadding().intValue(); int rightPadding = printImage.getLineBox().getRightPadding().intValue(); int availableImageWidth = printImage.getWidth() - leftPadding - rightPadding; availableImageWidth = (availableImageWidth < 0) ? 0 : availableImageWidth; int availableImageHeight = printImage.getHeight() - topPadding - bottomPadding; availableImageHeight = (availableImageHeight < 0) ? 0 : availableImageHeight; JRRenderable renderer = printImage.getRenderer(); if (renderer != null && availableImageWidth > 0 && availableImageHeight > 0) { if (renderer.getType() == JRRenderable.TYPE_IMAGE) { // Image renderers are all asked for their image data at some point. // Better to test and replace the renderer now, in case of lazy load error. renderer = JRImageRenderer.getOnErrorRendererForImageData(renderer, printImage.getOnErrorType()); } } else { renderer = null; } if (renderer != null) { int xoffset = 0; int yoffset = 0; Chunk chunk = null; float scaledWidth = availableImageWidth; float scaledHeight = availableImageHeight; if (renderer.getType() == JRRenderable.TYPE_IMAGE) { com.lowagie.text.Image image = null; float xalignFactor = getXAlignFactor(printImage); float yalignFactor = getYAlignFactor(printImage); switch (printImage.getScaleImage()) { case JRImage.SCALE_IMAGE_CLIP: { // Image load might fail, from given image data. // Better to test and replace the renderer now, in case of lazy load error. renderer = JRImageRenderer.getOnErrorRendererForDimension(renderer, printImage.getOnErrorType()); if (renderer == null) { break; } int normalWidth = availableImageWidth; int normalHeight = availableImageHeight; Dimension2D dimension = renderer.getDimension(); if (dimension != null) { normalWidth = (int) dimension.getWidth(); normalHeight = (int) dimension.getHeight(); } xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth)); yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight)); int minWidth = Math.min(normalWidth, availableImageWidth); int minHeight = Math.min(normalHeight, availableImageHeight); BufferedImage bi = new BufferedImage(minWidth, minHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); if (printImage.getMode() == JRElement.MODE_OPAQUE) { g.setColor(printImage.getBackcolor()); g.fillRect(0, 0, minWidth, minHeight); } renderer.render(g, new java.awt.Rectangle((xoffset > 0 ? 0 : xoffset), (yoffset > 0 ? 0 : yoffset), normalWidth, normalHeight)); g.dispose(); xoffset = (xoffset < 0 ? 0 : xoffset); yoffset = (yoffset < 0 ? 0 : yoffset); //awtImage = bi.getSubimage(0, 0, minWidth, minHeight); //image = com.lowagie.text.Image.getInstance(awtImage, printImage.getBackcolor()); image = com.lowagie.text.Image.getInstance(bi, null); break; } case JRImage.SCALE_IMAGE_FILL_FRAME: { if (printImage.isUsingCache() && loadedImagesMap.containsKey(renderer)) { image = (com.lowagie.text.Image) loadedImagesMap.get(renderer); } else { try { image = com.lowagie.text.Image.getInstance(renderer.getImageData()); imageTesterPdfContentByte.addImage(image, 10, 0, 0, 10, 0, 0); } catch (Exception e) { JRImageRenderer tmpRenderer = JRImageRenderer.getOnErrorRendererForImage( JRImageRenderer.getInstance(renderer.getImageData()), printImage.getOnErrorType()); if (tmpRenderer == null) { break; } java.awt.Image awtImage = tmpRenderer.getImage(); image = com.lowagie.text.Image.getInstance(awtImage, null); } if (printImage.isUsingCache()) { loadedImagesMap.put(renderer, image); } } image.scaleAbsolute(availableImageWidth, availableImageHeight); break; } case JRImage.SCALE_IMAGE_RETAIN_SHAPE: default: { if (printImage.isUsingCache() && loadedImagesMap.containsKey(renderer)) { image = (com.lowagie.text.Image) loadedImagesMap.get(renderer); } else { try { image = com.lowagie.text.Image.getInstance(renderer.getImageData()); imageTesterPdfContentByte.addImage(image, 10, 0, 0, 10, 0, 0); } catch (Exception e) { JRImageRenderer tmpRenderer = JRImageRenderer.getOnErrorRendererForImage( JRImageRenderer.getInstance(renderer.getImageData()), printImage.getOnErrorType()); if (tmpRenderer == null) { break; } java.awt.Image awtImage = tmpRenderer.getImage(); image = com.lowagie.text.Image.getInstance(awtImage, null); } if (printImage.isUsingCache()) { loadedImagesMap.put(renderer, image); } } image.scaleToFit(availableImageWidth, availableImageHeight); xoffset = (int) (xalignFactor * (availableImageWidth - image.plainWidth())); yoffset = (int) (yalignFactor * (availableImageHeight - image.plainHeight())); xoffset = (xoffset < 0 ? 0 : xoffset); yoffset = (yoffset < 0 ? 0 : yoffset); break; } } if (image != null) { chunk = new Chunk(image, 0, 0); scaledWidth = image.scaledWidth(); scaledHeight = image.scaledHeight(); } } else { double normalWidth = availableImageWidth; double normalHeight = availableImageHeight; double displayWidth = availableImageWidth; double displayHeight = availableImageHeight; double ratioX = 1f; double ratioY = 1f; Rectangle2D clip = null; Dimension2D dimension = renderer.getDimension(); if (dimension != null) { normalWidth = dimension.getWidth(); normalHeight = dimension.getHeight(); displayWidth = normalWidth; displayHeight = normalHeight; float xalignFactor = getXAlignFactor(printImage); float yalignFactor = getYAlignFactor(printImage); switch (printImage.getScaleImage()) { case JRImage.SCALE_IMAGE_CLIP: { xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth)); yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight)); clip = new Rectangle2D.Double(-xoffset, -yoffset, availableImageWidth, availableImageHeight); break; } case JRImage.SCALE_IMAGE_FILL_FRAME: { ratioX = availableImageWidth / normalWidth; ratioY = availableImageHeight / normalHeight; normalWidth *= ratioX; normalHeight *= ratioY; xoffset = 0; yoffset = 0; break; } case JRImage.SCALE_IMAGE_RETAIN_SHAPE: default: { ratioX = availableImageWidth / normalWidth; ratioY = availableImageHeight / normalHeight; ratioX = ratioX < ratioY ? ratioX : ratioY; ratioY = ratioX; normalWidth *= ratioX; normalHeight *= ratioY; xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth)); yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight)); break; } } } PdfTemplate template = pdfContentByte.createTemplate((float) displayWidth, (float) displayHeight); Graphics2D g = forceSvgShapes ? template.createGraphicsShapes((float) displayWidth, (float) displayHeight) : template.createGraphics(availableImageWidth, availableImageHeight, new LocalFontMapper()); if (clip != null) { g.setClip(clip); } if (printImage.getMode() == JRElement.MODE_OPAQUE) { g.setColor(printImage.getBackcolor()); g.fillRect(0, 0, (int) displayWidth, (int) displayHeight); } Rectangle2D rectangle = new Rectangle2D.Double(0, 0, displayWidth, displayHeight); renderer.render(g, rectangle); g.dispose(); pdfContentByte.saveState(); pdfContentByte.addTemplate(template, (float) ratioX, 0f, 0f, (float) ratioY, printImage.getX() + getOffsetX() + xoffset, jasperPrint.getPageHeight() - printImage.getY() - getOffsetY() - (int) normalHeight - yoffset); pdfContentByte.restoreState(); Image image = getPxImage(); image.scaleAbsolute(availableImageWidth, availableImageHeight); chunk = new Chunk(image, 0, 0); } /* image.setAbsolutePosition( printImage.getX() + offsetX + borderOffset, jasperPrint.getPageHeight() - printImage.getY() - offsetY - image.scaledHeight() - borderOffset ); pdfContentByte.addImage(image); */ if (chunk != null) { setAnchor(chunk, printImage, printImage); setHyperlinkInfo(chunk, printImage); ColumnText colText = new ColumnText(pdfContentByte); int upperY = jasperPrint.getPageHeight() - printImage.getY() - topPadding - getOffsetY() - yoffset; int lowerX = printImage.getX() + leftPadding + getOffsetX() + xoffset; colText.setSimpleColumn(new Phrase(chunk), lowerX, upperY - scaledHeight, lowerX + scaledWidth, upperY, scaledHeight, Element.ALIGN_LEFT); colText.go(); } } if (printImage.getLineBox().getTopPen().getLineWidth().floatValue() <= 0f && printImage.getLineBox().getLeftPen().getLineWidth().floatValue() <= 0f && printImage.getLineBox().getBottomPen().getLineWidth().floatValue() <= 0f && printImage.getLineBox().getRightPen().getLineWidth().floatValue() <= 0f) { if (printImage.getLinePen().getLineWidth().floatValue() > 0f) { exportPen(printImage.getLinePen(), printImage); } } else { /* */ exportBox(printImage.getLineBox(), printImage); } }
From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java
License:LGPL
/** * *//*from w w w . j a v a 2s. c o m*/ protected void exportText(JRPrintText text) throws DocumentException { JRStyledText styledText = getStyledText(text, false); if (styledText == null) { return; } int textLength = styledText.length(); int x = text.getX() + getOffsetX(); int y = text.getY() + getOffsetY(); int width = text.getWidth(); int height = text.getHeight(); int topPadding = text.getLineBox().getTopPadding().intValue(); int leftPadding = text.getLineBox().getLeftPadding().intValue(); int bottomPadding = text.getLineBox().getBottomPadding().intValue(); int rightPadding = text.getLineBox().getRightPadding().intValue(); int xFillCorrection = 0; int yFillCorrection = 0; double angle = 0; switch (text.getRotation()) { case JRTextElement.ROTATION_LEFT: { y = text.getY() + getOffsetY() + text.getHeight(); xFillCorrection = 1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = leftPadding; leftPadding = bottomPadding; bottomPadding = rightPadding; rightPadding = tmpPadding; angle = Math.PI / 2; break; } case JRTextElement.ROTATION_RIGHT: { x = text.getX() + getOffsetX() + text.getWidth(); yFillCorrection = -1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = rightPadding; rightPadding = bottomPadding; bottomPadding = leftPadding; leftPadding = tmpPadding; angle = -Math.PI / 2; break; } case JRTextElement.ROTATION_UPSIDE_DOWN: { x = text.getX() + getOffsetX() + text.getWidth(); y = text.getY() + getOffsetY() + text.getHeight(); int tmpPadding = topPadding; topPadding = bottomPadding; bottomPadding = tmpPadding; tmpPadding = leftPadding; leftPadding = rightPadding; rightPadding = tmpPadding; angle = Math.PI; break; } case JRTextElement.ROTATION_NONE: default: { } } AffineTransform atrans = new AffineTransform(); atrans.rotate(angle, x, jasperPrint.getPageHeight() - y); pdfContentByte.transform(atrans); if (text.getMode() == JRElement.MODE_OPAQUE) { Color backcolor = text.getBackcolor(); pdfContentByte.setRGBColorFill(backcolor.getRed(), backcolor.getGreen(), backcolor.getBlue()); pdfContentByte.rectangle(x + xFillCorrection, jasperPrint.getPageHeight() - y + yFillCorrection, width, -height); pdfContentByte.fill(); } if (textLength > 0) { int horizontalAlignment = Element.ALIGN_LEFT; switch (text.getHorizontalAlignment()) { case JRAlignment.HORIZONTAL_ALIGN_LEFT: { if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR) { horizontalAlignment = Element.ALIGN_LEFT; } else { horizontalAlignment = Element.ALIGN_RIGHT; } break; } case JRAlignment.HORIZONTAL_ALIGN_CENTER: { horizontalAlignment = Element.ALIGN_CENTER; break; } case JRAlignment.HORIZONTAL_ALIGN_RIGHT: { if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR) { horizontalAlignment = Element.ALIGN_RIGHT; } else { horizontalAlignment = Element.ALIGN_LEFT; } break; } case JRAlignment.HORIZONTAL_ALIGN_JUSTIFIED: { horizontalAlignment = Element.ALIGN_JUSTIFIED; break; } default: { horizontalAlignment = Element.ALIGN_LEFT; } } float verticalOffset = 0f; switch (text.getVerticalAlignment()) { case JRAlignment.VERTICAL_ALIGN_TOP: { verticalOffset = 0f; break; } case JRAlignment.VERTICAL_ALIGN_MIDDLE: { verticalOffset = (height - topPadding - bottomPadding - text.getTextHeight()) / 2f; break; } case JRAlignment.VERTICAL_ALIGN_BOTTOM: { verticalOffset = height - topPadding - bottomPadding - text.getTextHeight(); break; } default: { verticalOffset = 0f; } } ColumnText colText = new ColumnText(pdfContentByte); colText.setSimpleColumn(getPhrase(styledText, text), x + leftPadding, jasperPrint.getPageHeight() - y - topPadding - verticalOffset - text.getLeadingOffset(), //+ text.getLineSpacingFactor() * text.getFont().getSize(), x + width - rightPadding, jasperPrint.getPageHeight() - y - height + bottomPadding, 0, //text.getLineSpacingFactor(),// * text.getFont().getSize(), horizontalAlignment); colText.setLeading(0, text.getLineSpacingFactor());// * text.getFont().getSize()); colText.setRunDirection( text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_RTL); colText.go(); } atrans = new AffineTransform(); atrans.rotate(-angle, x, jasperPrint.getPageHeight() - y); pdfContentByte.transform(atrans); /* */ exportBox(text.getLineBox(), text); }
From source file:nl.dykema.jxmlnote.report.pdf.PdfParagraph.java
License:Open Source License
protected int getAlign(XMLNoteParStyle st) { String align = st.align();// w w w. j a v a2s . co m if (align.equals(XMLNoteParStyle.ALIGN_LEFT)) { return Element.ALIGN_LEFT; } else if (align.equals(XMLNoteParStyle.ALIGN_RIGHT)) { return Element.ALIGN_RIGHT; } else if (align.equals(XMLNoteParStyle.ALIGN_CENTER)) { return Element.ALIGN_CENTER; } else if (align.equals(XMLNoteParStyle.ALIGN_CENTER)) { return Element.ALIGN_JUSTIFIED; } else { return Element.ALIGN_LEFT; } }
From source file:nl.dykema.jxmlnote.report.pdf.PdfParagraph.java
License:Open Source License
public Paragraph setAlignment(Report.Align a) { int align = Element.ALIGN_LEFT; if (a.equals(Report.Align.RIGHT)) { align = Element.ALIGN_RIGHT; } else if (a.equals(Report.Align.CENTER)) { align = Element.ALIGN_CENTER; } else if (a.equals(Report.Align.JUSTIFY)) { align = Element.ALIGN_JUSTIFIED; }/*w w w .j a va 2s .c om*/ super.setAlignment(align); return this; }