protected String getFieldType() {
return FIELD_TYPE;
}
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) {
PdfWriter writer = outputDevice.getWriter();
String[][] options = getPDFOptions();
int selectedIndex = getSelectedIndex();
PdfFormField field;
/*
* Comment out for now. We need to draw an appropriate appearance for
* this to work correctly.
*/
/*
if (isMultiple(box.getElement())) {
field = PdfFormField.createList(writer, options, selectedIndex);
} else {
field = PdfFormField.createCombo(writer, false, options, selectedIndex);
}
*/
field = PdfFormField.createCombo(writer, false, options, selectedIndex);
field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT);
field.setFieldName(getFieldName(outputDevice, box.getElement()));
if (options.length > 0) {
field.setValueAsString(options[selectedIndex][0]);
}
createAppearance(c, outputDevice, box, field);
if (isReadOnly(box.getElement())) {
field.setFieldFlags(PdfFormField.FF_READ_ONLY);
}
/*
if (isMultiple(box.getElement())) {
field.setFieldFlags(PdfFormField.FF_MULTISELECT);
}
*/
writer.addAnnotation(field);
}