1 17 18 19 20 package org.apache.fop.layoutmgr.inline; 21 22 import org.apache.fop.datatypes.URISpecification; 23 import org.apache.fop.fo.flow.BasicLink; 24 import org.apache.fop.layoutmgr.LayoutManager; 25 import org.apache.fop.area.inline.InlineArea; 26 import org.apache.fop.area.Trait; 27 import org.apache.fop.area.LinkResolver; 28 import org.apache.fop.area.PageViewport; 29 30 33 public class BasicLinkLayoutManager extends InlineLayoutManager { 34 private BasicLink fobj; 35 36 41 public BasicLinkLayoutManager(BasicLink node) { 42 super(node); 43 fobj = node; 44 } 45 46 47 protected InlineArea createArea(boolean bInlineParent) { 48 InlineArea area = super.createArea(bInlineParent); 49 setupBasicLinkArea(parentLM, area); 50 return area; 51 } 52 53 private void setupBasicLinkArea(LayoutManager parentLM, 54 InlineArea area) { 55 if (fobj.getExternalDestination() != null) { 56 area.addTrait(Trait.EXTERNAL_LINK, 57 URISpecification.getURL(fobj.getExternalDestination())); 58 } else { 59 String idref = fobj.getInternalDestination(); 60 PageViewport page = getPSLM().getFirstPVWithID(idref); 61 if (page != null) { 62 area.addTrait(Trait.INTERNAL_LINK, page.getKey()); 63 } else { 64 LinkResolver res = new LinkResolver(idref, area); 65 getPSLM().addUnresolvedArea(idref, res); 66 } 67 } 68 } 69 } 70 71 | Popular Tags |