1 3 package org.faceless.pdf; 4 5 import java.io.*; 6 import java.util.*; 7 import java.awt.Color ; 8 9 40 public final class FormText extends FormElement 41 { 42 FormText(org.faceless.pdf2.FormText b) 43 { 44 super(b); 45 } 46 47 53 public FormText() 54 { 55 this(null,0,0,0,0); 56 } 57 58 66 public FormText(PDFPage page, float x1, float y1, float x2, float y2) 67 { 68 super(new org.faceless.pdf2.FormText(page==null ? null : page.page, x1, y1, x2, y2)); 69 } 70 71 94 public void setStyle(PDFStyle text, PDFStyle background) 95 { 96 List l = element.getAnnotations(); 97 for (int i=0;i<l.size();i++) { 98 org.faceless.pdf2.WidgetAnnotation annot = element.getAnnotation(i); 99 annot.setTextStyle(text==null ? null : text.style); 100 annot.setBackgroundStyle(background==null ? null : background.style); 101 } 102 } 103 104 110 public void setMultiline(boolean multiline) 111 { 112 ((org.faceless.pdf2.FormText)element).setType(multiline ? org.faceless.pdf2.FormText.TYPE_MULTILINE : org.faceless.pdf2.FormText.TYPE_NORMAL); 113 } 114 115 120 public boolean isMultiline() 121 { 122 return ((org.faceless.pdf2.FormText)element).getType()==org.faceless.pdf2.FormText.TYPE_MULTILINE; 123 } 124 125 133 public void setMultilineScrollable(boolean scrollable) 134 { 135 if (isMultiline()) { 136 ((org.faceless.pdf2.FormText)element).setScrollable(scrollable); 137 } 138 } 139 140 146 public boolean isMultilineScrollable() 147 { 148 return ((org.faceless.pdf2.FormText)element).getType()==org.faceless.pdf2.FormText.TYPE_MULTILINE && ((org.faceless.pdf2.FormText)element).isScrollable(); 149 } 150 151 158 public void setPassword(boolean password) 159 { 160 ((org.faceless.pdf2.FormText)element).setType(password ? org.faceless.pdf2.FormText.TYPE_PASSWORD : org.faceless.pdf2.FormText.TYPE_NORMAL); 161 } 162 163 168 public boolean isPassword() 169 { 170 return ((org.faceless.pdf2.FormText)element).getType()==org.faceless.pdf2.FormText.TYPE_PASSWORD; 171 } 172 173 183 public void setFilename(boolean filename) 184 { 185 ((org.faceless.pdf2.FormText)element).setType(filename ? org.faceless.pdf2.FormText.TYPE_FILESELECT : org.faceless.pdf2.FormText.TYPE_NORMAL); 186 } 187 188 193 public boolean isFilename() 194 { 195 return ((org.faceless.pdf2.FormText)element).getType()==org.faceless.pdf2.FormText.TYPE_FILESELECT; 196 } 197 198 203 public void setMaxLength(int maxlen) 204 { 205 ((org.faceless.pdf2.FormText)element).setMaxLength(maxlen); 206 } 207 208 212 public int getMaxLength() 213 { 214 return ((org.faceless.pdf2.FormText)element).getMaxLength(); 215 } 216 217 218 236 public void setValue(String value) 237 throws IllegalArgumentException , IllegalStateException 238 { 239 ((org.faceless.pdf2.FormText)element).setValue(value); 240 } 241 242 250 public void setDefaultValue(String value) 251 { 252 ((org.faceless.pdf2.FormText)element).setDefaultValue(value); 253 } 254 255 260 public String getValue() 261 { 262 return ((org.faceless.pdf2.FormText)element).getValue(); 263 } 264 265 270 public String getDefaultValue() 271 { 272 return ((org.faceless.pdf2.FormText)element).getDefaultValue(); 273 } 274 } 275 | Popular Tags |