List of usage examples for com.lowagie.text Rectangle getTop
public float getTop()
From source file:com.teag.reports.CashFlows.java
private void page1() { CashFlowTable cft = new CashFlowTable(); ClientBean cb = new ClientBean(); CFRow row;// w w w . j a va 2 s. c o m CFRow continueRow = null; float tallest = 0; cb.setPrimaryId(clientID); cft.setCb(cb); cft.init(); cft.genTable(); cft.reset(); int colCount = MAX_ROWS; drawHeader(userInfo.getClientHeading(), ""); Rectangle agt = placeHeading(); float baseWidths[] = this.initWidths(colCount - 1); float widths[] = this.calcWidths(baseWidths, 11.f * 72); Rectangle rct = new Rectangle(prctFull); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); Rectangle r = doRow(leList(), widths, agt, 17); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, 17); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, 17); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; while ((row = cft.getRow()) != null) { boolean flag; if (row.getColNumber() == 0 && row.getIndentLevel() == 0) { continueRow = row; } do { flag = false; boolean nPage = false; String pdfRow[] = buildRow(row, colCount); if (row.getHeader().startsWith("III.") && !row.getHeader().endsWith("(cont.)")) { nPage = true; } if (row.getHeader().startsWith("IV.") && !row.getHeader().endsWith("(cont.)")) { nPage = true; } // Rectangle r = doSimpleRow(pdfRow, rct); if (nPage) { // need to span to a new page newPage(); drawHeader(client, ""); agt = placeHeading(); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); r = doRow(leList(), widths, agt, 17); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, 17); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, 17); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; if (continueRow != null) { if (!row.equals(continueRow)) { row = continueRow; row.setHeader(row.getHeader() + " (cont.)"); flag = true; } } nPage = false; } r = this.doRow(pdfRow, widths, rct, colCount - 1); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; rct.setTop(r.getBottom()); if (rct.getTop() < (.5f * 72) + tallest) { // need to span to a new page newPage(); drawHeader(client, ""); agt = placeHeading(); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); r = doRow(leList(), widths, agt, 17); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, 17); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, 17); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; if (continueRow != null) { if (!row.equals(continueRow)) { row = continueRow; row.setHeader(row.getHeader() + " (cont.)"); flag = true; } } } } while (flag == true); } cft.cleanUp(); }
From source file:com.teag.reports.CashFlows.java
private Rectangle placeHeading() { String header = "Estimate Of Net Worth & Estate Distribution - Scenario #1 As Is (in 000's)"; BaseFont font = PageUtils.LoadFont("GARA.TTF"); Rectangle rect = new Rectangle(document.getPageSize()); rect.setBottom(rect.getTop() - (72 * .6f)); HeadingText ht = new HeadingText(this.writer); rect.setBottom(rect.getBottom() - (72 * .33f)); ht.setColor(57, 57, 57);/*from w w w.j a v a2s .com*/ ht.setCapsColor(98, 98, 98); ht.display(rect, 12f, font, 3f, header, HeadingText.DHT_CENTER); rect.setTop(rect.getBottom() - _1_8TH); rect.setBottom(prctFull.getBottom()); rect.setLeft(_1_2TH); rect.setRight(rect.getLeft() + 11.f * 72); PageBorder pb = new PageBorder(writer); pb.setLicense(userInfo.getPlannerFirstName() + " " + userInfo.getPlannerLastName()); pb.drawNoBorder(document, Integer.toString(pageNum)); drawLifeExp(); return (rect); }
From source file:com.teag.reports.EstatePlan.java
private void page1() { EstatePlanTable ept = new EstatePlanTable(); ClientBean cb = new ClientBean(); CFRow row;/*from w w w. ja va 2 s .c o m*/ float tallest = 0; drawHeader(client, ""); String header = "Estimate Of Cash Flows - Scenario #2 After (in 000's)"; Rectangle agt = placeHeading(header); cb.setPrimaryId(clientID); cb.initialize(); ept.setClient(cb); ept.setScenarioId(epg.getScenarioId()); ept.setEstate(epg); ept.initialize(); ept.resetRows(); int colCount = MAX_COLS; float baseWidths[] = this.initWidths(colCount - 1); float widths[] = this.calcWidths(baseWidths, 11.0f * 72); Rectangle rct = new Rectangle(prctFull); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); Rectangle r = doRow(leList(), widths, agt, colCount - 1); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; boolean nPage = false; while ((row = ept.getRow()) != null) { if (rct.getTop() < (.5f * 72) + tallest) { // need to span to a new page newPage(); drawHeader(client, ""); header = "Estimate Of Net Worth - Scenario #2 After (in 000's)"; agt = placeHeading(header); rct = new Rectangle(prctFull); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); r = doRow(leList(), widths, agt, colCount - 1); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; nPage = true; } String pdfRow[] = buildRow(row, colCount); //Rectangle r = doSimpleRow(pdfRow, rct); if ((row.getHeader().startsWith("III.") || row.getHeader().startsWith("IV.")) || row.getHeader().startsWith("II") && !nPage) { // need to span to a new page newPage(); drawHeader(client, ""); header = "Estimate Of Net Worth - Scenario #2 After (in 000's)"; agt = placeHeading(header); rct = new Rectangle(prctFull); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); r = doRow(leList(), widths, agt, colCount - 1); rct.setTop(r.getBottom()); r = doRow(agesList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(), widths, rct, colCount - 1); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; } nPage = false; r = this.doRow(pdfRow, widths, rct, colCount - 1); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; rct.setTop(r.getBottom()); /* if(rct.getTop() < (.5f * 72) + tallest) { // need to span to a new page newPage(); drawHeader(client, ""); header = "Estimate Of Net Worth - Scenario #2 After (in 000's)"; agt = placeHeading(header); rct = new Rectangle(prctFull); rct.setLeft(_1_4TH); rct.setRight(rct.getLeft() + 756); r = doRow(leList(), widths, agt, colCount-1); rct.setTop(r.getBottom()); r = doRow(agesList(),widths,rct,colCount-1); rct.setTop(r.getBottom()); r = doRow(fiscalYearList(),widths,rct,colCount-1); rct.setTop(r.getBottom()); tallest = tallest < r.getHeight() ? r.getHeight() : tallest; nPage = true; } */ } }
From source file:com.teag.reports.EstatePlan.java
private Rectangle placeHeading(String header) { BaseFont font = PageUtils.LoadFont("GARA.TTF"); Rectangle rect = new Rectangle(document.getPageSize()); rect.setBottom(rect.getTop() - (72 * .6f)); HeadingText ht = new HeadingText(this.writer); rect.setBottom(rect.getBottom() - (72 * .33f)); ht.setColor(57, 57, 57);//from w w w. ja v a2 s . co m ht.setCapsColor(98, 98, 98); ht.display(rect, 12f, font, 3f, header, HeadingText.DHT_CENTER); rect.setTop(rect.getBottom() - _1_8TH); rect.setBottom(prctFull.getBottom()); rect.setLeft(_1_2TH); rect.setRight(rect.getLeft() + 11.0f * 72); drawHeader(client, ""); PageBorder pb = new PageBorder(writer); pb.setLicense(userInfo.getPlannerFirstName() + " " + userInfo.getPlannerLastName()); pb.drawNoBorder(document, Integer.toString(pageNum)); drawLifeExp(); return (rect); }
From source file:net.sf.jsignpdf.PdfExtraInfo.java
License:Mozilla Public License
/** * Returns page info.// w ww .j a v a2s . c o m * * @param aPage * number of page for which size should be returned * @return FloatPoint or null */ public PageInfo getPageInfo(int aPage) { PageInfo tmpResult = null; PdfReader reader = null; try { reader = PdfUtils.getPdfReader(options.getInFile(), options.getPdfOwnerPwdStrX().getBytes()); final Rectangle tmpRect = reader.getPageSizeWithRotation(aPage); if (tmpRect != null) { tmpResult = new PageInfo(tmpRect.getRight(), tmpRect.getTop()); } } catch (Exception e) { // nothing to do } finally { if (reader != null) { try { reader.close(); } catch (Exception e) { } } } return tmpResult; }
From source file:org.geomajas.plugin.print.component.impl.MapComponentImpl.java
License:Open Source License
private void renderViewPort(ViewPortComponentImpl viewPort, PdfContext context) { Coordinate portOrigin = viewPort.getLocation(); float x = (float) (portOrigin.x - location.x) * getPpUnit(); float y = (float) (portOrigin.y - location.y) * getPpUnit(); Rectangle shadowRect = new Rectangle(x, y, x + viewPort.getBounds().getWidth() / viewPort.getZoomScale(), y + viewPort.getBounds().getHeight() / viewPort.getZoomScale()); context.fillRectangle(shadowRect, context.makeTransparent(Color.lightGray, 0.5f)); context.strokeRectangle(shadowRect, Color.white, 1); Rectangle rect = context.toRelative(viewPort.getBounds()); // connection lines float deltaLeft = shadowRect.getLeft() - rect.getLeft(); float deltaRight = shadowRect.getRight() - rect.getRight(); float deltaBottom = shadowRect.getBottom() - rect.getBottom(); float deltaTop = shadowRect.getTop() - rect.getTop(); if ((deltaLeft <= 0 && deltaBottom >= 0) || (deltaLeft >= 0 && deltaBottom <= 0)) { context.drawLine(rect.getLeft(), rect.getBottom(), shadowRect.getLeft(), shadowRect.getBottom(), Color.white, 1);//from w ww .j a v a 2 s . com } if ((deltaLeft >= 0 && deltaTop >= 0) || (deltaLeft <= 0 && deltaTop <= 0)) { context.drawLine(rect.getLeft(), rect.getTop(), shadowRect.getLeft(), shadowRect.getTop(), Color.white, 1); } if ((deltaRight <= 0 && deltaBottom <= 0) || (deltaRight >= 0 && deltaBottom >= 0)) { context.drawLine(rect.getRight(), rect.getBottom(), shadowRect.getRight(), shadowRect.getBottom(), Color.white, 1); } if ((deltaRight >= 0 && deltaTop <= 0) || (deltaRight <= 0 && deltaTop >= 0)) { context.drawLine(rect.getRight(), rect.getTop(), shadowRect.getRight(), shadowRect.getTop(), Color.white, 1); } }
From source file:org.geomajas.plugin.print.component.impl.VectorLayerComponentImpl.java
License:Open Source License
private Rectangle calculateLabelRect(PdfContext context, InternalFeature f, String label, Font font) { Rectangle textSize = context.getTextSize(label, font); float margin = 0.25f * font.getSize(); Rectangle rect = new Rectangle(textSize.getWidth() + 2 * margin, textSize.getHeight() + 2 * margin); Coordinate labelPosition = geoService.calcDefaultLabelPosition(f); // SPRINT-53 Labels should be rendered in Screen Space new MapToUserFilter().filter(labelPosition); context.moveRectangleTo(rect, (float) labelPosition.x - rect.getWidth() / 2f, (float) labelPosition.y - rect.getHeight() / 2f); if (f.getGeometry() instanceof Point) { float shiftHeight = 0.5f * (rect.getHeight() + getSymbolHeight(f)); // move up 15 pixels to make the symbol visible context.moveRectangleTo(rect, rect.getLeft(), rect.getBottom() + shiftHeight + SYMBOL_CONNECT_LENGTH); }//from ww w. j a v a 2 s . c o m if (rect.getLeft() < 0) { context.moveRectangleTo(rect, 10, rect.getBottom()); } if (rect.getBottom() < 0) { context.moveRectangleTo(rect, rect.getLeft(), 10); } if (rect.getTop() > getBounds().getHeight()) { context.moveRectangleTo(rect, rect.getLeft(), getBounds().getHeight() - rect.getHeight() - 10); } if (rect.getRight() > getBounds().getWidth()) { context.moveRectangleTo(rect, getBounds().getWidth() - rect.getWidth() - 10, rect.getBottom()); } return rect; }
From source file:org.geomajas.plugin.print.component.PdfContext.java
License:Open Source License
/** * Draw an elliptical exterior with this color. * * @param rect rectangle in which ellipse should fit * @param color colour to use for stroking * @param linewidth line width//from w ww .ja v a2 s . c o m */ public void strokeEllipse(Rectangle rect, Color color, float linewidth) { template.saveState(); setStroke(color, linewidth, null); template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(), origY + rect.getTop()); template.stroke(); template.restoreState(); }
From source file:org.geomajas.plugin.print.component.PdfContext.java
License:Open Source License
/** * Draw an elliptical interior with this color. * * @param rect rectangle in which ellipse should fit * @param color colour to use for filling *///from w w w. ja va 2s. com public void fillEllipse(Rectangle rect, Color color) { template.saveState(); setFill(color); template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(), origY + rect.getTop()); template.fill(); template.restoreState(); }
From source file:org.geomajas.plugin.print.component.PdfContext.java
License:Open Source License
/** * Converts an absolute rectangle to a relative one wrt to the current coordinate system. * * @param rect absolute rectangle/*from w w w . j a v a 2s .c o m*/ * @return relative rectangle */ public Rectangle toRelative(Rectangle rect) { return new Rectangle(rect.getLeft() - origX, rect.getBottom() - origY, rect.getRight() - origX, rect.getTop() - origY); }