1 3 package org.faceless.pdf; 4 5 import java.util.*; 6 import java.awt.Color ; 7 8 43 public final class FormChoice extends FormElement 44 { 45 FormChoice(org.faceless.pdf2.FormChoice b) 46 { 47 super(b); 48 } 49 50 54 public static final int TYPE_DROPDOWN=131272; 55 56 60 public static final int TYPE_SCROLLABLE=0; 61 62 66 public static final int TYPE_COMBO=393216; 67 68 75 public FormChoice(int type) 76 { 77 this(null, type, 0,0,0,0); 78 } 79 80 89 public FormChoice(PDFPage page, int type, float x1, float y1, float x2, float y2) 90 { 91 super(new org.faceless.pdf2.FormChoice(type==TYPE_COMBO ? org.faceless.pdf2.FormChoice.TYPE_COMBO : (type==TYPE_SCROLLABLE ? org.faceless.pdf2.FormChoice.TYPE_SCROLLABLE : org.faceless.pdf2.FormChoice.TYPE_DROPDOWN), page==null ? null : page.page, x1, y1, x2, y2)); 92 } 93 94 112 public void setStyle(PDFStyle text, PDFStyle background) 113 throws IllegalArgumentException 114 { 115 List l = element.getAnnotations(); 116 for (int i=0;i<l.size();i++) { 117 org.faceless.pdf2.WidgetAnnotation annot = element.getAnnotation(i); 118 annot.setTextStyle(text==null ? null : text.style); 119 annot.setBackgroundStyle(background==null ? null : background.style); 120 } 121 } 122 123 128 public int getType() 129 { 130 int style = ((org.faceless.pdf2.FormChoice)element).getType(); 131 132 int oldtype=TYPE_DROPDOWN; 133 if (style==org.faceless.pdf2.FormChoice.TYPE_COMBO) oldtype=TYPE_COMBO; 134 if (style==org.faceless.pdf2.FormChoice.TYPE_SCROLLABLE) oldtype=TYPE_SCROLLABLE; 135 return oldtype; 136 } 137 138 159 public Map getOptions() 160 { 161 return ((org.faceless.pdf2.FormChoice)element).getOptions(); 162 } 163 164 173 public void setValue(String value) 174 { 175 ((org.faceless.pdf2.FormChoice)element).setValue(value); 176 } 177 178 184 public String getValue() 185 { 186 return ((org.faceless.pdf2.FormChoice)element).getValue(); 187 } 188 189 195 public void setDefaultValue(String value) 196 { 197 ((org.faceless.pdf2.FormChoice)element).setDefaultValue(value); 198 } 199 200 206 public String getDefaultValue() 207 { 208 return ((org.faceless.pdf2.FormChoice)element).getDefaultValue(); 209 } 210 } 211 | Popular Tags |