1 51 package org.apache.fop.datatypes; 52 53 import org.apache.fop.pdf.PDFGoTo; 54 55 56 public class IDNode { 57 private String idValue, internalLinkGoToPageReference; 58 59 private PDFGoTo internalLinkGoTo; 60 61 private String pageNumber; 62 private int xPosition = 0; private int yPosition = 0; 65 66 71 protected IDNode(String idValue) { 72 this.idValue = idValue; 73 } 74 75 76 81 protected void setPageNumber(String pageNumber) { 82 this.pageNumber = pageNumber; 83 } 84 85 86 91 public String getPageNumber() { 92 return pageNumber; 93 } 94 95 100 public String getPageReference() { 101 if (null != internalLinkGoTo) { 102 return internalLinkGoTo.getPageReference(); 103 } else { 104 return internalLinkGoToPageReference; 105 } 106 } 107 108 public int getXPosition() { 109 return xPosition; 110 } 111 112 public int getYPosition() { 113 return yPosition; 114 } 115 116 122 protected void createInternalLinkGoTo(int objectNumber) { 123 if (internalLinkGoToPageReference == null) { 124 internalLinkGoTo = new PDFGoTo(objectNumber, null); 125 } else { 126 internalLinkGoTo = new PDFGoTo(objectNumber, 127 internalLinkGoToPageReference); 128 } 129 130 if (xPosition 131 != 0) { 133 internalLinkGoTo.setXPosition(xPosition); 134 internalLinkGoTo.setYPosition(yPosition); 135 } 136 137 } 138 139 140 141 148 protected void setInternalLinkGoToPageReference(String pageReference) { 149 if (internalLinkGoTo != null) { 150 internalLinkGoTo.setPageReference(pageReference); 151 } else { 152 internalLinkGoToPageReference = pageReference; 153 } 154 155 } 156 157 158 159 164 protected String getInternalLinkGoToReference() { 165 return internalLinkGoTo.referencePDF(); 166 } 167 168 169 170 175 protected String getIDValue() { 176 return idValue; 177 } 178 179 180 181 186 protected PDFGoTo getInternalLinkGoTo() { 187 return internalLinkGoTo; 188 } 189 190 191 196 protected boolean isThereInternalLinkGoTo() { 197 return internalLinkGoTo != null; 198 } 199 200 201 207 protected void setPosition(int x, int y) { 208 if (internalLinkGoTo != null) { 209 internalLinkGoTo.setXPosition(x); 210 internalLinkGoTo.setYPosition(y); 211 } else { 212 xPosition = x; 213 yPosition = y; 214 } 215 } 216 217 } 218 | Popular Tags |