List of usage examples for com.itextpdf.text Element ALIGN_LEFT
int ALIGN_LEFT
To view the source code for com.itextpdf.text Element ALIGN_LEFT.
Click Source Link
From source file:com.softwaremagico.tm.pdf.small.characteristics.CharacteristicsColumn.java
License:Open Source License
private static PdfPCell createCharacteristicLine(String text) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_LEFT, BaseColor.WHITE, FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE); //cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS)); //cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell;/*from ww w . ja va 2 s . co m*/ }
From source file:com.softwaremagico.tm.pdf.small.cybernetics.CyberneticsTable.java
License:Open Source License
public CyberneticsTable(CharacterPlayer characterPlayer) { super(WIDTHS); getDefaultCell().setBorder(0);//from w w w . j a v a 2 s.c om addCell(createTitle(getTranslator().getTranslatedText("cybernetics"), FadingSunsTheme.CHARACTER_SMALL_CYBERNETICS_TITLE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("cyberneticsName"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_LEFT)); addCell(createSubtitleLine(getTranslator().getTranslatedText("cyberneticsPoints"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); int added = 0; if (characterPlayer != null) { for (SelectedCyberneticDevice device : characterPlayer.getCybernetics()) { addCell(createFirstElementLine(device.getName(), NAME_COLUMN_WIDTH, FadingSunsTheme.CYBERNETICS_CONTENT_FONT_SIZE)); addCell(createElementLine(device.getPoints() + "", POINTS_COLUMN_WIDTH, FadingSunsTheme.CYBERNETICS_CONTENT_FONT_SIZE)); added++; } } if (characterPlayer == null) { for (int i = added; i < ROWS; i++) { addCell(createEmptyElementLine(GAP, NAME_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, POINTS_COLUMN_WIDTH)); } } else { for (int i = added; i < ROWS; i++) { for (int j = 0; j < WIDTHS.length; j++) { addCell(createEmptyElementLine(FadingSunsTheme.CYBERNETICS_CONTENT_FONT_SIZE)); } } } }
From source file:com.softwaremagico.tm.pdf.small.fighting.ArmourTable.java
License:Open Source License
public ArmourTable(CharacterPlayer characterPlayer) { super(new float[] { 2.2f, 3 }); getDefaultCell().setBorder(0);//from ww w . ja v a 2 s . c o m // Armor Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_SMALL_ARMOR_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("armor"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); addCell(titleCell); PdfPCell nameCell; if (characterPlayer == null) { nameCell = CustomPdfTable.createEmptyElementLine(GAP, NAME_COLUMN_WIDTH); } else if (characterPlayer.getArmour() == null) { nameCell = createElementLine("", NAME_COLUMN_WIDTH); } else { nameCell = createElementLine(characterPlayer.getArmour().getName() + "(" + characterPlayer.getArmour().getProtection() + "d)", NAME_COLUMN_WIDTH, FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE - 1); } nameCell.setBorder(0); nameCell.setHorizontalAlignment(Element.ALIGN_LEFT); addCell(nameCell); // Shield addCell(getShieldRange(characterPlayer)); Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph(getTranslator().getTranslatedText("shieldHits") + ": ", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE))); if (characterPlayer != null && characterPlayer.getShield() != null) { paragraph.add(new Paragraph(characterPlayer.getShield().getHits() + "-", new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.getHandWrittingFontSize(FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)))); } PdfPCell shieldCell = new PdfPCell(paragraph); shieldCell.setVerticalAlignment(Element.ALIGN_MIDDLE); shieldCell.setBorder(0); addCell(shieldCell); }
From source file:com.softwaremagico.tm.pdf.small.fighting.WeaponsTable.java
License:Open Source License
public WeaponsTable(CharacterPlayer characterPlayer) { super(WIDTHS); getDefaultCell().setBorder(0);// ww w. j a v a 2 s. c o m PdfPCell title = createTitle(getTranslator().getTranslatedText("combat"), FadingSunsTheme.CHARACTER_SMALL_WEAPONS_TITLE_FONT_SIZE); // To adapt height with Occultism. title.setMinimumHeight(20); addCell(title); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponsAction"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_LEFT)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponGoal"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponDamage"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponRange"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponShots"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponRate"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); int added = 0; if (characterPlayer != null) { for (Weapon weapon : characterPlayer.getAllWeapons()) { addCell(createFirstElementLine(weapon.getName(), NAME_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine((weapon.getGoal() != null ? weapon.getGoal() : ""), GOAL_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(weapon.getDamageWithoutArea()); if (!weapon.getDamageWithoutArea().endsWith("d")) { stringBuilder.append("d"); } if (weapon.getAreaMeters() > 0) { stringBuilder.append(" "); stringBuilder.append(weapon.getAreaMeters()); } addCell(createElementLine(stringBuilder.toString(), DAMAGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine( weapon.getShots() == null ? characterPlayer.getStrengthDamangeModification() + "" : weapon.getStrengthOrRange(), RANGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine(weapon.getShots() + "", SHOTS_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine(weapon.getRate(), RATE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); added++; for (Ammunition ammunition : weapon.getAmmunitions()) { addCell(createFirstElementLine(" - " + ammunition.getName(), NAME_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine((ammunition.getGoal() != null ? weapon.getGoal() : ""), GOAL_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine(ammunition.getDamage() + "d", DAMAGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine(ammunition.getStrengthOrRange(), RANGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine("", SHOTS_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine("", RATE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); added++; } } } if (characterPlayer == null) { for (int i = added; i < ROWS; i++) { addCell(createEmptyElementLine(GAP, NAME_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, GOAL_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, DAMAGE_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, RANGE_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, SHOTS_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, RATE_COLUMN_WIDTH)); } } else { for (int i = added; i < ROWS; i++) { for (int j = 0; j < WIDTHS.length; j++) { addCell(createEmptyElementLine(FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); } } } }
From source file:com.softwaremagico.tm.pdf.small.occultism.OccultismTable.java
License:Open Source License
public OccultismTable(CharacterPlayer characterPlayer, String language) throws InvalidXmlElementException { super(WIDTHS); getDefaultCell().setBorder(0);//from w ww.j a v a2 s .c om addCell(createTitle(getTranslator().getTranslatedText("occultism"), FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_TITLE_FONT_SIZE)); for (OccultismType occultismType : OccultismTypeFactory.getInstance().getElements(language)) { addCell(createSubtitleLine(occultismType.getName(), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_LEFT)); if (characterPlayer != null) { addCell(createValueLine("" + characterPlayer.getPsiqueLevel(occultismType), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); } else { addCell(createValueLine(" ", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); } addCell(createSubtitleLine("/", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); if (characterPlayer != null) { addCell(createValueLine("" + characterPlayer.getDarkSideLevel(occultismType), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); } else { addCell(createValueLine(" ", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); } addCell(createSubtitleLine(occultismType.getDarkSideName(), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_RIGHT)); } addCell(createSubtitleLine(getTranslator().getTranslatedText("occultismTablePower"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, 4, Element.ALIGN_LEFT)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponGoal"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_RIGHT)); int added = 0; if (characterPlayer != null) { for (Entry<String, List<String>> occultismPathEntry : characterPlayer.getSelectedPowers().entrySet()) { OccultismPath occultismPath = OccultismPathFactory.getInstance() .getElement(occultismPathEntry.getKey(), characterPlayer.getLanguage()); for (String occultismPowerName : occultismPathEntry.getValue()) { OccultismPower occultismPower = occultismPath.getOccultismPowers().get(occultismPowerName); if (occultismPower.isEnabled()) { PdfPCell cell = createFirstElementLine(occultismPower.getName(), POWER_COLUMN_WIDTH, FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE); cell.setColspan(WIDTHS.length - 1); addCell(cell); addCell(createElementLine(occultismPower.getRoll(), ROLL_COLUMN_WIDTH, FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE)); added++; } if (added >= ROWS) { break; } } } } if (characterPlayer == null) { for (int i = added; i < ROWS; i++) { PdfPCell cell = createEmptyElementLine(GAP, POWER_COLUMN_WIDTH); cell.setColspan(WIDTHS.length - 1); addCell(cell); addCell(createEmptyElementLine(GAP, ROLL_COLUMN_WIDTH)); } } else { for (int i = added; i < ROWS; i++) { for (int j = 0; j < WIDTHS.length; j++) { addCell(createEmptyElementLine(FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE)); } } } }
From source file:com.softwaremagico.tm.pdf.small.traits.BlessingTable.java
License:Open Source License
public BlessingTable(CharacterPlayer characterPlayer) { super(WIDTHS); getDefaultCell().setBorder(0);/*from w ww. j a v a 2 s .c o m*/ addCell(createTitle(getTranslator().getTranslatedText("blessingTable"), FadingSunsTheme.CHARACTER_SMALL_BLESSING_TITLE_FONT_SIZE)); addCell(createSubtitleLine("+/-", FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("blessingTableTrait"), FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("blessingTableSituation"), FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE)); int added = 0; if (characterPlayer != null) { for (Blessing blessing : characterPlayer.getAllBlessings()) { Iterator<Bonification> it = blessing.getBonifications().iterator(); while (it.hasNext()) { Bonification bonification = it.next(); addCell(createElementLine(bonification.getBonification(), BONIFICATION_COLUMN_WIDTH, FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE)); PdfPCell nameCell = createElementLine( bonification.getAffects() != null ? bonification.getAffects().getName() : "", TRAIT_COLUMN_WIDTH, FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE); nameCell.setHorizontalAlignment(Element.ALIGN_LEFT); addCell(nameCell); PdfPCell descriptionCell = createElementLine(bonification.getSituation(), SITUATION_COLUMN_WIDTH, FadingSunsTheme.CHARACTER_SMALL_TRAITS_FONT_SIZE); descriptionCell.setHorizontalAlignment(Element.ALIGN_LEFT); addCell(descriptionCell); added++; } } } if (characterPlayer == null) { for (int i = added; i < ROWS; i++) { addCell(createEmptyElementLine(GAP, BONIFICATION_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, TRAIT_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, SITUATION_COLUMN_WIDTH)); } } else { for (int i = added; i < ROWS; i++) { for (int j = 0; j < WIDTHS.length; j++) { addCell(createEmptyElementLine(FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); } } } }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCell(PdfPTable table, String text, Integer colSpan) { if (text == null) { text = ""; }/*from w w w . jav a 2 s .co m*/ // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(colSpan); cell.setPadding(5f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellProtocol(PdfPTable table, LicensePFEntity license) { this.insertHeaderCell(table, "6- CONTROLE DE RECEBIMENTO DO PROCESSO", 4); Paragraph officialPhrase = new Paragraph("USO OFICIAL" + SEPARATOR, FONT_PARAGRAPH); officialPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph protocolPhrase = new Paragraph("ETIQUETA PROTOCOLO" + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE, FONT_PROTOCOL);// w w w. j a v a 2 s . c o m protocolPhrase.setAlignment(Element.ALIGN_LEFT); Paragraph obsPhrase = new Paragraph(SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + "Observao Importante!" + SEPARATOR, FONT_HEADER); Paragraph obsStringPhrase = new Paragraph("- Etiqueta com data e assinatura." + SEPARATOR + "- Renovao: verificar a data de vencimento da licena." + SEPARATOR + "- Alterao Cadastral: apresentar o Anexo VI." + SEPARATOR_DOUBLE, FONT_PARAGRAPH); Paragraph phraseProtocol = new Paragraph(); phraseProtocol.add(officialPhrase); phraseProtocol.add(protocolPhrase); Paragraph phraseObs = new Paragraph(); phraseObs.add(obsPhrase); phraseObs.add(obsStringPhrase); PdfPCell cellProtocol = new PdfPCell(phraseProtocol); cellProtocol.setColspan(2); cellProtocol.disableBorderSide(Rectangle.RIGHT); PdfPCell cellObs = new PdfPCell(phraseObs); cellObs.setColspan(2); cellObs.disableBorderSide(Rectangle.LEFT); table.addCell(cellProtocol); table.addCell(cellObs); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) { String fullText = ""; if (selected) { fullText += number + " |X|" + " " + text; } else {// ww w .j av a 2s. c o m fullText += number + " | |" + " " + text; } if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) { fullText = ""; } // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (fullText.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(Rectangle.RIGHT); cell.setPaddingTop(10f); cell.setPaddingBottom(10f); cell.setPaddingLeft(10f); cell.setPaddingRight(10f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.LicenseCivilIncludeProductPDF.java
License:Open Source License
private void generateProducts(Document doc, List<LicensePCProductEntity> listProducts) throws DocumentException { DecimalFormat dc = new DecimalFormat("########0.00"); // specify column widths float[] columnWidths = { 2f, 2f, 2f }; // create PDF table with the given widths PdfPTable table = new PdfPTable(columnWidths); // set table width a percentage of the page width table.setWidthPercentage(100f);/*w w w .j a v a2 s .c o m*/ // insert column headings insertCell(table, "Nome da Substncia de Controle", Element.ALIGN_CENTER, FONT_PARAGRAPH); insertCell(table, "Volume mximo de estoque", Element.ALIGN_CENTER, FONT_PARAGRAPH); insertCell(table, "Unidade de medida", Element.ALIGN_CENTER, FONT_PARAGRAPH); table.setHeaderRows(1); for (LicensePCProductEntity product : listProducts) { // Cria a tabela com os Produtos insertCell(table, product.getProduct().getName(), Element.ALIGN_LEFT, FONT_PARAGRAPH); insertCell(table, dc.format(product.getQtdProduct()), Element.ALIGN_LEFT, FONT_PARAGRAPH); insertCell(table, product.getTypeQtdProduct(), Element.ALIGN_LEFT, FONT_PARAGRAPH); } doc.add(Chunk.NEXTPAGE); doc.add(table); }