List of usage examples for com.itextpdf.text.pdf PdfPTable addCell
public void addCell(final Phrase phrase)
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);/* w w w . j a va 2s.c om*/ 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 {/* w w w . j a va 2s .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);/* w w w. jav a 2 s. c om*/ 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.info.CharacterBasicsCompleteTableFactory.java
License:Open Source License
public static PdfPTable getCharacterBasicsTable(CharacterPlayer characterPlayer) { float[] widths = { 1f, 1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w w w. j a v a2 s.c o m*/ table.addCell(getFirstColumnTable(characterPlayer)); table.addCell(getSecondColumnTable(characterPlayer)); table.addCell(getThirdColumnTable()); return table; }
From source file:com.softwaremagico.tm.pdf.complete.info.CharacterBasicsCompleteTableFactory.java
License:Open Source License
private static PdfPCell getFirstColumnTable(CharacterPlayer characterPlayer) { float[] widths = { 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w ww . j ava 2 s.c om*/ table.addCell(createField(characterPlayer, "name", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "player", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "gender", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "age", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); PdfPCell cell = new PdfPCell(); setCellProperties(cell); cell.addElement(table); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.info.CharacterBasicsCompleteTableFactory.java
License:Open Source License
private static PdfPCell getSecondColumnTable(CharacterPlayer characterPlayer) { float[] widths = { 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);//ww w . j av a 2 s . c om table.addCell(createField(characterPlayer, "race", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "planet", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "faction", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); table.addCell(createField(characterPlayer, "rank", FadingSunsTheme.CHARACTER_BASICS_FONT_SIZE)); PdfPCell cell = new PdfPCell(); setCellProperties(cell); cell.addElement(table); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.info.CharacterBasicsTableFactory.java
License:Open Source License
protected static PdfPCell createField(CharacterPlayer characterPlayer, String tag, int fontSize) { float[] widths = { 0.7f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w w w .jav a 2 s. c om*/ table.addCell(getCell(getTranslatedTag(tag), Element.ALIGN_RIGHT, fontSize)); if (characterPlayer == null) { table.addCell(getCell(LINE, Element.ALIGN_LEFT, fontSize)); } else { if (tag.equals("name")) { table.addCell(getHandwrittingCell(characterPlayer.getNameRepresentation(), Element.ALIGN_LEFT, fontSize - 1)); } else if (tag.equals("race")) { if (characterPlayer.getRace() != null) { table.addCell(getHandwrittingCell(characterPlayer.getRace().getName(), Element.ALIGN_LEFT, fontSize - 1)); } else { table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1)); } } else if (tag.equals("faction")) { if (characterPlayer.getFaction() != null) { table.addCell(getHandwrittingCell(characterPlayer.getFaction().getName(), Element.ALIGN_LEFT, fontSize - 1)); } else { table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1)); } } else if (tag.equals("rank")) { try { if (characterPlayer.getRank() != null) { table.addCell( getHandwrittingCell(characterPlayer.getRank(), Element.ALIGN_LEFT, fontSize - 1)); } else { table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1)); } } catch (InvalidXmlElementException e) { PdfExporterLog.errorMessage(CharacterBasicsTableFactory.class.getName(), e); } } else if (tag.equals("planet")) { if (characterPlayer.getInfo().getPlanet() != null) { table.addCell(getHandwrittingCell(characterPlayer.getInfo().getPlanet().getName(), Element.ALIGN_LEFT, fontSize - 1)); } else { table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1)); } } else if (tag.equals("gender")) { table.addCell(getHandwrittingCell(characterPlayer.getInfo().getTranslatedParameter(tag), Element.ALIGN_LEFT, fontSize - 1)); } else { table.addCell(getHandwrittingCell(characterPlayer.getInfo().getTranslatedParameter(tag), Element.ALIGN_LEFT, fontSize - 1)); } } PdfPCell cell = new PdfPCell(); cell.addElement(table); setCellProperties(cell); cell.setMinimumHeight(20); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CompleteSkillsTable.java
License:Open Source License
public static PdfPTable getSkillsTable(CharacterPlayer characterPlayer, String language) throws InvalidXmlElementException { float[] widths = { 1f, 1f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);//from w ww . ja va2 s . c o m Stack<PdfPCell> learnedSkillsRows = createLearnedSkillsRows(ROWS - (2 * TITLE_ROWSPAN) - SkillsDefinitionsFactory.getInstance().getNaturalSkills(language).size() + ROWS + ROWS - OCCULTISM_ROWS, characterPlayer, language); table.addCell(getFirstColumnTable(characterPlayer, language, learnedSkillsRows)); table.addCell(getSecondColumnTable(characterPlayer, language, learnedSkillsRows)); table.addCell(getThirdColumnTable(characterPlayer, language, learnedSkillsRows)); return table; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CompleteSkillsTable.java
License:Open Source License
private static PdfPCell getFirstColumnTable(CharacterPlayer characterPlayer, String language, Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException { float[] widths = { 4f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/* w w w . j a va 2 s. c o m*/ table.addCell(createTitle(getTranslator().getTranslatedText("naturalSkills"), FadingSunsTheme.SKILLS_TITLE_FONT_SIZE)); if (characterPlayer == null) { for (AvailableSkill skill : AvailableSkillsFactory.getInstance().getNaturalSkills(language)) { table.addCell(createSkillElement(characterPlayer, skill, FadingSunsTheme.SKILLS_LINE_FONT_SIZE, MAX_SKILL_COLUMN_WIDTH)); table.addCell(createSkillLine(SKILL_VALUE_GAP, FadingSunsTheme.SKILLS_LINE_FONT_SIZE)); } } else { for (AvailableSkill skill : characterPlayer.getNaturalSkills()) { table.addCell(createSkillElement(characterPlayer, skill, FadingSunsTheme.SKILLS_LINE_FONT_SIZE, MAX_SKILL_COLUMN_WIDTH)); table.addCell(createSkillValue(characterPlayer.getSkillTotalRanks(skill), characterPlayer.isSkillSpecial(skill) || characterPlayer.hasSkillTemporalModificator(skill), characterPlayer.hasSkillModificator(skill), FadingSunsTheme.SKILLS_LINE_FONT_SIZE)); } } table.addCell(createTitle(getTranslator().getTranslatedText("learnedSkills"), FadingSunsTheme.SKILLS_TITLE_FONT_SIZE)); int totalRows = Math.min(getTotalLearnedSkillsToShow(language), ROWS - (2 * TITLE_ROWSPAN) - SkillsDefinitionsFactory.getInstance().getNaturalSkills(language).size()); for (int i = 0; i < totalRows; i++) { // Two columns: skill and value. table.addCell(learnedSkillsRows.pop()); table.addCell(learnedSkillsRows.pop()); } PdfPCell cell = new PdfPCell(); setCellProperties(cell); cell.addElement(table); cell.setVerticalAlignment(Element.ALIGN_TOP); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CompleteSkillsTable.java
License:Open Source License
private static PdfPCell getSecondColumnTable(CharacterPlayer characterPlayer, String language, Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException { float[] widths = { 4f, 1f }; PdfPTable table = new PdfPTable(widths); setTablePropierties(table);/*from w ww.ja v a2 s. com*/ PdfPCell cell = new PdfPCell(); setCellProperties(cell); for (int i = 0; i < ROWS; i++) { // Two columns: skill and value. table.addCell(learnedSkillsRows.pop()); table.addCell(learnedSkillsRows.pop()); } cell.addElement(table); cell.setVerticalAlignment(Element.ALIGN_TOP); return cell; }