/** * Applies the properties of the Anchor to a Chunk. * @param chunk the Chunk (part of the Anchor) * @param notGotoOK if true, this chunk will determine the local destination * @param localDestination true if the chunk is a local goto and the reference a local destination * @return the value of notGotoOK or false, if a previous Chunk was used to determine the local destination */ protected boolean applyAnchor(Chunk chunk, boolean notGotoOK, boolean localDestination) { if (name != null && notGotoOK && !chunk.isEmpty()) { chunk.setLocalDestination(name); notGotoOK = false; } if (localDestination) { chunk.setLocalGoto(reference.substring(1)); } else if (reference != null) chunk.setAnchor(reference); return notGotoOK; }
/** * Applies the properties of the Anchor to a Chunk. * @param chunk the Chunk (part of the Anchor) * @param notGotoOK if true, this chunk will determine the local destination * @param localDestination true if the chunk is a local goto and the reference a local destination * @return the value of notGotoOK or false, if a previous Chunk was used to determine the local destination */ protected boolean applyAnchor(Chunk chunk, boolean notGotoOK, boolean localDestination) { if (name != null && notGotoOK && !chunk.isEmpty()) { chunk.setLocalDestination(name); notGotoOK = false; } if (localDestination) { chunk.setLocalGoto(reference.substring(1)); } else if (reference != null) chunk.setAnchor(reference); return notGotoOK; }
/** * Adds a link to the current paragraph. * @since 5.0.6 */ public void processLink() { if (currentParagraph == null) { currentParagraph = new Paragraph(); } // The link provider allows you to do additional processing LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER); if (i == null || !i.process(currentParagraph, chain)) { // sets an Anchor for all the Chunks in the current paragraph String href = chain.getProperty(HtmlTags.HREF); if (href != null) { for (Chunk ck : currentParagraph.getChunks()) { ck.setAnchor(href); } } } // a link should be added to the current paragraph as a phrase if (stack.isEmpty()) { // no paragraph to add too, 'a' tag is first element Paragraph tmp = new Paragraph(new Phrase(currentParagraph)); currentParagraph = tmp; } else { Paragraph tmp = (Paragraph) stack.pop(); tmp.add(new Phrase(currentParagraph)); currentParagraph = tmp; } }
/** * Adds a link to the current paragraph. * @since 5.0.6 */ public void processLink() { if (currentParagraph == null) { currentParagraph = new Paragraph(); } // The link provider allows you to do additional processing LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER); if (i == null || !i.process(currentParagraph, chain)) { // sets an Anchor for all the Chunks in the current paragraph String href = chain.getProperty(HtmlTags.HREF); if (href != null) { for (Chunk ck : currentParagraph.getChunks()) { ck.setAnchor(href); } } } // a link should be added to the current paragraph as a phrase if (stack.isEmpty()) { // no paragraph to add too, 'a' tag is first element Paragraph tmp = new Paragraph(new Phrase(currentParagraph)); currentParagraph = tmp; } else { Paragraph tmp = (Paragraph) stack.pop(); tmp.add(new Phrase(currentParagraph)); currentParagraph = tmp; } }