List of usage examples for com.itextpdf.text.pdf PdfPCell setBorder
public void setBorder(final int border)
From source file:com.softwaremagico.tm.pdf.complete.skills.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(-4f);/* w ww . ja va 2s .c o m*/ circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0); // Some position corrections. circleCell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / CIRCLES) + 1.3f); return circleCell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.MainSkillsTableFactory.java
License:Open Source License
public static PdfPTable getSkillsTable(CharacterPlayer characterPlayer, String language) throws InvalidXmlElementException { float[] widths = { 1f, 12f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);// ww w . ja v a 2 s. co m PdfPCell separator = createSeparator(); separator.setPadding(PADDING); table.addCell(separator); table.addCell(separator); table.addCell(separator); PdfPCell vitalityCell = new PdfPCell(new VitalityTable(characterPlayer)); vitalityCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT); vitalityCell.setPadding(0); table.addCell(vitalityCell); PdfPCell skillsCell = new PdfPCell(CompleteSkillsTable.getSkillsTable(characterPlayer, language)); skillsCell.setBorder(0); skillsCell.setPadding(0); skillsCell.setPaddingRight(FadingSunsTheme.DEFAULT_MARGIN); skillsCell.setPaddingLeft(FadingSunsTheme.DEFAULT_MARGIN); table.addCell(skillsCell); PdfPCell wyrdCell = new PdfPCell(new WyrdTable(characterPlayer)); wyrdCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT); wyrdCell.setPadding(0); table.addCell(wyrdCell); return table; }
From source file:com.softwaremagico.tm.pdf.complete.skills.occultism.OccultismTable.java
License:Open Source License
private PdfPCell createContent(CharacterPlayer characterPlayer, String language) throws InvalidXmlElementException { float[] widths = { 3f, 1f, 1f, 3f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); table.getDefaultCell().setPadding(0); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); for (OccultismType occulstimType : OccultismTypeFactory.getInstance().getElements(language)) { PdfPCell psiqueTitleCell = new PdfPCell(new Phrase(occulstimType.getName(), new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); psiqueTitleCell.setBorder(0); // psiTitleCell.setMinimumHeight(30); psiqueTitleCell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(psiqueTitleCell);// w w w. ja v a2s.c o m if (characterPlayer == null) { table.addCell(createRectangle()); table.addCell(createRectangle()); } else { table.addCell(createRectangle(characterPlayer.getPsiqueLevel(occulstimType))); table.addCell(createRectangle(characterPlayer.getDarkSideLevel(occulstimType))); } PdfPCell darkSideTitleCell = new PdfPCell(new Phrase(occulstimType.getDarkSideName(), new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))); darkSideTitleCell.setBorder(0); darkSideTitleCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(darkSideTitleCell); } PdfPCell cell = new PdfPCell(); cell.addElement(table); cell.setPadding(0); BaseElement.setCellProperties(cell); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.traits.MainPerksTableFactory.java
License:Open Source License
public static PdfPTable getPerksTable(CharacterPlayer characterPlayer) { float[] widths = { 4f, 0.1f, 4f, 0.1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w ww . j av a 2s .c om*/ table.getDefaultCell().setPadding(PADDING); PdfPCell whiteSeparator = createWhiteSeparator(); whiteSeparator.setColspan(widths.length); table.addCell(whiteSeparator); PdfPCell blackSeparator = createBlackSeparator(); whiteSeparator.setColspan(1); table.addCell(blackSeparator); table.addCell(whiteSeparator); table.addCell(blackSeparator); table.addCell(whiteSeparator); PdfPCell victoryPointsCell = new PdfPCell(new VictoryPointsTable()); victoryPointsCell.setPadding(0); victoryPointsCell.setRowspan(2); table.addCell(victoryPointsCell); PdfPCell blessingCell = new PdfPCell(new BlessingTable(characterPlayer)); blessingCell.setPadding(0); blessingCell.setBorder(0); table.addCell(blessingCell); table.addCell(whiteSeparator); PdfPCell perksCell = new PdfPCell(new BeneficesTable(characterPlayer)); perksCell.setPadding(0); perksCell.setBorder(0); table.addCell(perksCell); table.addCell(whiteSeparator); return table; }
From source file:com.softwaremagico.tm.pdf.small.characteristics.CharacteristicsColumn.java
License:Open Source License
private PdfPCell createContent(CharacterPlayer characterPlayer, List<CharacteristicDefinition> content) { float[] widths = { 4f, 1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); for (CharacteristicDefinition characteristic : content) { Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph(getTranslator().getTranslatedText(characteristic.getId()), new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); paragraph.add(new Paragraph(" (", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); if (characterPlayer == null) { paragraph.add(new Paragraph(GAP, new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); } else {// ww w . j a v a 2 s . c o m paragraph.add( new Paragraph(characterPlayer.getStartingValue(characteristic.getCharacteristicName()) + "", new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.getHandWrittingFontSize( FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)))); } paragraph.add(new Paragraph(")", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); PdfPCell characteristicTitle = new PdfPCell(paragraph); characteristicTitle.setBorder(0); characteristicTitle.setMinimumHeight(ROW_HEIGHT / content.size()); table.addCell(characteristicTitle); // Rectangle if (characterPlayer == null) { table.addCell(createCharacteristicLine(SKILL_VALUE_GAP)); } else { table.addCell(getHandwrittingCell(getCharacteristicValueRepresentation(characterPlayer, characteristic.getCharacteristicName()), Element.ALIGN_LEFT)); } } PdfPCell cell = new PdfPCell(); cell.addElement(table); BaseElement.setCellProperties(cell); return cell; }
From source file:com.softwaremagico.tm.pdf.small.counters.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(paddingTop); circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0); circleCell.setMinimumHeight(20);/*from ww w .j av a 2s .c o m*/ return circleCell; }
From source file:com.softwaremagico.tm.pdf.small.counters.VitalityTable.java
License:Open Source License
public VitalityTable(CharacterPlayer characterPlayer) { super(characterPlayer); getDefaultCell().setBorder(0);/*from w ww. j a v a 2 s .c o m*/ Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_VITALITY_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("vitality"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); titleCell.setPaddingRight(0); titleCell.setPaddingTop(paddingTop); titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); addCell(titleCell); addedCircle = 0; for (int i = 0; i < getNumberOfCircles(); i++) { addCell(getCircle()); addedCircle++; } }
From source file:com.softwaremagico.tm.pdf.small.counters.WyrdTable.java
License:Open Source License
public WyrdTable(CharacterPlayer characterPlayer) { super(characterPlayer); getDefaultCell().setBorder(0);/* w w w . java 2 s .c om*/ Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_VITALITY_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("wyrd"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); titleCell.setPaddingTop(paddingTop); titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); addCell(titleCell); addedCircle = 0; for (int i = 0; i < getNumberOfCircles(); i++) { addCell(getCircle()); addedCircle++; } }
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);/* w w w .j av 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.SmallCharacterSheet.java
License:Open Source License
protected PdfPTable createCharacterContent(CharacterPlayer characterPlayer) throws Exception { float[] widths = { 2.2f, 1f }; PdfPTable mainTable = new PdfPTable(widths); BaseElement.setTablePropierties(mainTable); mainTable.getDefaultCell().setPadding(0); PdfPTable infoTable = CharacterBasicsReducedTableFactory.getCharacterBasicsTable(characterPlayer); PdfPCell infoCell = new PdfPCell(infoTable); infoCell.setBorderWidthTop(0);/* w w w .j a v a 2 s . c o m*/ infoCell.setBorderWidthLeft(0); infoCell.setBorderWidthBottom(1); mainTable.addCell(infoCell); PdfPTable learnedSkillsTable = LearnedSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell learnedSkillsCell = new PdfPCell(learnedSkillsTable); learnedSkillsCell.setColspan(2); learnedSkillsCell.setRowspan(3); learnedSkillsCell.setBorderWidthTop(0); learnedSkillsCell.setBorderWidthRight(0); mainTable.addCell(learnedSkillsCell); PdfPTable basicTable = new PdfPTable(new float[] { 5f, 4f }); BaseElement.setTablePropierties(basicTable); basicTable.getDefaultCell().setBorder(0); PdfPTable characteristicsTable = CharacteristicsTableFactory.getCharacteristicsBasicsTable(characterPlayer); PdfPCell characteristicCell = new PdfPCell(characteristicsTable); characteristicCell.setBorderWidthLeft(0); basicTable.addCell(characteristicCell); PdfPTable naturalSkillsTable = NaturalSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell naturalSkillsCell = new PdfPCell(naturalSkillsTable); naturalSkillsCell.setBorderWidthRight(0); basicTable.addCell(naturalSkillsCell); PdfPCell basicComposedCell = new PdfPCell(basicTable); basicComposedCell.setBorder(0); mainTable.addCell(basicComposedCell); PdfPTable composedTable = new PdfPTable(new float[] { 5f, 2f }); PdfPTable blessingsTable = new BlessingTable(characterPlayer); PdfPCell blessingsCell = new PdfPCell(blessingsTable); blessingsCell.setBorderWidthLeft(0); blessingsCell.setBorderWidthBottom(1); composedTable.addCell(blessingsCell); PdfPTable beneficesTable = new BeneficesTable(characterPlayer); PdfPCell beneficesCell = new PdfPCell(beneficesTable); beneficesCell.setBorderWidthBottom(1); composedTable.addCell(beneficesCell); PdfPCell composedCell = new PdfPCell(composedTable); composedCell.setRowspan(2); composedCell.setBorder(0); mainTable.addCell(composedCell); PdfPTable armourTable = new ArmourTable(characterPlayer); PdfPCell armourCell = new PdfPCell(armourTable); armourCell.setBorderWidthRight(0); armourCell.setBorderWidthBottom(1); mainTable.addCell(armourCell); PdfPTable fightTable = new PdfPTable(new float[] { 3f, 5f, 1f }); if (characterPlayer != null && (characterPlayer.getSelectedPowers().isEmpty() && !characterPlayer.getCybernetics().isEmpty())) { PdfPTable cyberneticsTable = new CyberneticsTable(characterPlayer); PdfPCell cyberneticsCell = new PdfPCell(cyberneticsTable); cyberneticsCell.setBorderWidthLeft(0); fightTable.addCell(cyberneticsCell); } else { PdfPTable occultismTable = new OccultismTable(characterPlayer, getLanguage()); PdfPCell occultismCell = new PdfPCell(occultismTable); occultismCell.setBorderWidthLeft(0); fightTable.addCell(occultismCell); } PdfPTable weaponsTable = new WeaponsTable(characterPlayer); fightTable.addCell(weaponsTable); PdfPCell victoryPointsCell = new PdfPCell(new VerticalVictoryPointsTable()); victoryPointsCell.setPadding(0); victoryPointsCell.setRowspan(3); fightTable.addCell(victoryPointsCell); PdfPTable vitalityTable = new VitalityTable(characterPlayer); PdfPCell vitalityCell = new PdfPCell(vitalityTable); vitalityCell.setColspan(2); vitalityCell.setBorderWidth(1); fightTable.addCell(vitalityCell); PdfPTable wyrdTable = new WyrdTable(characterPlayer); PdfPCell wyrdCell = new PdfPCell(wyrdTable); wyrdCell.setBorderWidth(1); wyrdCell.setColspan(2); fightTable.addCell(wyrdCell); PdfPCell fightCell = new PdfPCell(fightTable); fightCell.setBorder(0); fightCell.setColspan(2); mainTable.addCell(fightCell); return mainTable; }