List of usage examples for com.itextpdf.text.pdf PdfPTable getDefaultCell
public PdfPCell getDefaultCell()
PdfPCell
that will be used as reference for all the addCell
methods except addCell(PdfPCell)
. From source file:com.softwaremagico.tm.pdf.complete.CharacterSheet.java
License:Open Source License
private PdfPTable createRearTablePsiExtended() throws InvalidXmlElementException { PdfPTable mainTable = new PdfPTable(REAR_TABLE_WIDTHS); mainTable.getDefaultCell().setBorder(0); mainTable.setWidthPercentage(100);//from w w w. j a v a 2s .c o m mainTable.addCell(new DescriptionTable(characterPlayer)); PdfPCell cell = new PdfPCell(new AnnotationsTable()); cell.setBorderWidth(0); cell.setColspan(2); mainTable.addCell(cell); PdfPCell blackSeparator = BaseElement.createBigSeparator(90); mainTable.addCell(blackSeparator); PdfPCell separatorCell = new PdfPCell(BaseElement.createWhiteSeparator()); separatorCell.setColspan(2); mainTable.addCell(separatorCell); mainTable.addCell(new PropertiesTable(characterPlayer)); PdfPCell psiCell = new PdfPCell(new OccultismsPowerTable(characterPlayer, PSI_EXTENDED_ROWS)); psiCell.setColspan(2); psiCell.setRowspan(3); mainTable.addCell(psiCell); mainTable.addCell(BaseElement.createBigSeparator(90)); PdfPTable othersTable = new OthersTable(); mainTable.addCell(othersTable); return mainTable; }
From source file:com.softwaremagico.tm.pdf.complete.elements.BaseElement.java
License:Open Source License
public static void setTablePropierties(PdfPTable table) { table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.setWidthPercentage(100);//from w w w .java2 s .c om table.setPaddingTop(0); table.setSpacingAfter(0); table.setSpacingBefore(0); }
From source file:com.softwaremagico.tm.pdf.complete.fighting.ArmourTable.java
License:Open Source License
private PdfPTable getArmourProperty(String text, boolean selected) { float[] widths = { 1f, 1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); table.getDefaultCell().setPadding(0); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); if (!selected) { table.addCell(createRectangle()); } else {//from w w w . j av a2s. com table.addCell(createRectangle("X")); } table.addCell(createEmptyElementLine(text)); return table; }
From source file:com.softwaremagico.tm.pdf.complete.fighting.FightingManeuvers.java
License:Open Source License
public static PdfPTable getFightingManoeuvresTable(CharacterPlayer characterPlayer) throws InvalidXmlElementException { float[] widths = { 1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/* www .j a va 2s . c o m*/ table.getDefaultCell().setPadding(PADDING); table.getDefaultCell().setBorder(0); table.addCell(BaseElement.createWhiteSeparator()); table.addCell(BaseElement.createWhiteSeparator()); table.addCell(BaseElement.createWhiteSeparator()); table.addCell(BaseElement.createWhiteSeparator()); PdfPCell fireArmsCell = new PdfPCell(new RangedManeuversTable(characterPlayer)); table.addCell(fireArmsCell); PdfPCell fencingCell = new PdfPCell(new MeleeManeuversTable(characterPlayer)); table.addCell(fencingCell); return table; }
From source file:com.softwaremagico.tm.pdf.complete.fighting.ShieldTable.java
License:Open Source License
private PdfPTable getShieldRange(CharacterPlayer characterPlayer) { float[] widths = { 1f, 1f, 1f, 1f, 1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); table.getDefaultCell().setPadding(0); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(createEmptyElementLine("(")); if (characterPlayer == null || characterPlayer.getShield() == null) { table.addCell(createRectangle()); } else {//from w w w .ja v a2s. c o m table.addCell(createRectangle(characterPlayer.getShield().getImpact())); } table.addCell(createEmptyElementLine("/")); if (characterPlayer == null || characterPlayer.getShield() == null) { table.addCell(createRectangle()); } else { table.addCell(createRectangle(characterPlayer.getShield().getForce())); } table.addCell(createEmptyElementLine(")")); return table; }
From source file:com.softwaremagico.tm.pdf.complete.fighting.WeaponsAndArmours.java
License:Open Source License
public static PdfPTable getWeaponsAndArmoursTable(CharacterPlayer characterPlayer) throws InvalidXmlElementException { float[] widths = { 4f, 1.1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);//from w ww .j av a2 s . c o m table.getDefaultCell().setPadding(PADDING); table.getDefaultCell().setBorder(0); PdfPTable leftTable = new PdfPTable(new float[] { 1f }); setTablePropierties(leftTable); leftTable.getDefaultCell().setBorder(0); leftTable.getDefaultCell().setPadding(0); PdfPCell fireArmsCell = new PdfPCell(new WeaponsTable(characterPlayer)); leftTable.addCell(fireArmsCell); PdfPTable stancesXpTable = new PdfPTable(new float[] { 4f, 1f }); setTablePropierties(stancesXpTable); stancesXpTable.getDefaultCell().setBorder(0); stancesXpTable.getDefaultCell().setPadding(0); PdfPCell stancesCell = new PdfPCell(new StancesTable(characterPlayer)); stancesXpTable.addCell(stancesCell); PdfPCell experienceCell = new PdfPCell(new ExperienceTable(characterPlayer)); stancesXpTable.addCell(experienceCell); leftTable.addCell(stancesXpTable); PdfPCell leftCell = new PdfPCell(leftTable); leftCell.setRowspan(2); table.addCell(leftCell); PdfPCell armourCell = new PdfPCell(new ArmourTable(characterPlayer)); table.addCell(armourCell); PdfPCell shieldCell = new PdfPCell(new ShieldTable(characterPlayer)); table.addCell(shieldCell); 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);//w ww . j av a 2s. c o m // psiTitleCell.setMinimumHeight(30); psiqueTitleCell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(psiqueTitleCell); 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);/* www . jav a 2 s . co m*/ 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 {/*from w ww . j ava 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.characteristics.CharacteristicsTableFactory.java
License:Open Source License
public static PdfPTable getCharacteristicsBasicsTable(CharacterPlayer characterPlayer) { float[] widths = { 1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w ww. j a v a 2 s . co m*/ table.getDefaultCell().setBorder(0); Phrase content = new Phrase(getTranslator().getTranslatedText("characteristics"), new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_SMALL_TITLE_FONT_SIZE)); PdfPCell titleCell = new PdfPCell(content); setCellProperties(titleCell); titleCell.setHorizontalAlignment(Element.ALIGN_CENTER); titleCell.setColspan(widths.length); titleCell.setFixedHeight(30); table.addCell(titleCell); table.getDefaultCell().setPadding(0); for (CharacteristicType type : CharacteristicType.values()) { table.addCell(new CharacteristicsColumn(characterPlayer, type, CharacteristicsDefinitionFactory.getInstance().getAll(type, Translator.getLanguage()))); } return table; }