The Paper information for output sheets
| 31 | * The Paper information for output sheets |
| 32 | */ |
| 33 | public final class PaperInfo implements Loadable, SortKeyRequired |
| 34 | { |
| 35 | /** |
| 36 | * The source URI of this PaperInfo. |
| 37 | */ |
| 38 | private URI sourceURI; |
| 39 | |
| 40 | /** |
| 41 | * The name of this PaperInfo |
| 42 | */ |
| 43 | private String infoName; |
| 44 | |
| 45 | /** |
| 46 | * The sort key of this PaperInfo, to indicate which items should appear first. |
| 47 | */ |
| 48 | private String sortKey; |
| 49 | |
| 50 | /** Array of 6 paper information variables to keep hold of */ |
| 51 | private final String[] paperInfo = new String[7]; |
| 52 | |
| 53 | public static final int NAME = 0; |
| 54 | public static final int HEIGHT = 1; |
| 55 | public static final int WIDTH = 2; |
| 56 | public static final int TOPMARGIN = 3; |
| 57 | public static final int BOTTOMMARGIN = 4; |
| 58 | public static final int LEFTMARGIN = 5; |
| 59 | public static final int RIGHTMARGIN = 6; |
| 60 | |
| 61 | /** |
| 62 | * Set a paper info item |
| 63 | * |
| 64 | * @param infoType The type (key) |
| 65 | * @param info The value |
| 66 | */ |
| 67 | public void setPaperInfo(final int infoType, final String info) |
| 68 | { |
| 69 | if (!validIndex(infoType)) |
| 70 | { |
| 71 | throw new IndexOutOfBoundsException("invalid index: " + infoType); |
| 72 | } |
| 73 | |
| 74 | if (StringUtils.isNotBlank(info) && info.startsWith("in_")) |
| 75 | { |
| 76 | paperInfo[infoType] = LanguageBundle.getString(info); |
| 77 | } |
| 78 | else |
| 79 | { |
| 80 | paperInfo[infoType] = info; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | String getName() |
| 85 | { |
| 86 | return getPaperInfo(PaperInfo.NAME); |
| 87 | } |
| 88 | |
| 89 | public String getPaperInfo(final int infoType) |
| 90 | { |
nothing calls this directly
no outgoing calls
no test coverage detected