1 50 51 package com.lowagie.text; 52 53 54 66 67 public class HeaderFooter extends Rectangle { 68 69 71 72 private boolean numbered; 73 74 75 private Phrase before = null; 76 77 78 private int pageN; 79 80 81 private Phrase after = null; 82 83 84 private int alignment; 85 86 88 94 95 public HeaderFooter(Phrase before, Phrase after) { 96 super(0, 0, 0, 0); 97 setBorder(TOP + BOTTOM); 98 setBorderWidth(1); 99 100 numbered = true; 101 this.before = before; 102 this.after = after; 103 } 104 105 111 112 public HeaderFooter(Phrase before, boolean numbered) { 113 super(0, 0, 0, 0); 114 setBorder(TOP + BOTTOM); 115 setBorderWidth(1); 116 117 this.numbered = numbered; 118 this.before = before; 119 } 120 121 123 128 129 public boolean isNumbered() { 130 return numbered; 131 } 132 133 138 139 public Phrase getBefore() { 140 return before; 141 } 142 143 148 149 public Phrase getAfter() { 150 return after; 151 } 152 153 158 159 public void setPageNumber(int pageN) { 160 this.pageN = pageN; 161 } 162 163 168 169 public void setAlignment(int alignment) { 170 this.alignment = alignment; 171 } 172 173 175 180 181 public Paragraph paragraph() { 182 Paragraph paragraph = new Paragraph(before.getLeading()); 183 paragraph.add(before); 184 if (numbered) { 185 paragraph.addSpecial(new Chunk(String.valueOf(pageN), before.getFont())); 186 } 187 if (after != null) { 188 paragraph.addSpecial(after); 189 } 190 paragraph.setAlignment(alignment); 191 return paragraph; 192 } 193 194 199 200 public int alignment() { 201 return alignment; 202 } 203 204 } | Popular Tags |