コード例 #1
0
 public static Element getUIPdfComponent(
     FormBuilderItemBase item, FormBuilderItemData data, String mode) {
   String type = item.getFormbuildertype();
   PdfFormBuilderItem comp;
   boolean skipPropertiesCopy = false;
   switch (type) {
     case FormBuilderItemFactory.TYPE_LABEL:
       comp = new PdfFormBuilderLabel();
       break;
     case FormBuilderItemFactory.TYPE_HEADING:
       comp = new PdfFormBuilderHeading();
       break;
     case FormBuilderItemFactory.TYPE_HR:
       comp = new PdfFormBuilderHorizontalRule();
       break;
     case FormBuilderItemFactory.TYPE_SPACE:
       comp = new PdfFormBuilderSpace();
       break;
     case FormBuilderItemFactory.TYPE_DATE:
     case FormBuilderItemFactory.TYPE_TIME:
     case FormBuilderItemFactory.TYPE_INPUT:
     case FormBuilderItemFactory.TYPE_NUMBER:
       comp = new PdfFormBuilderInput();
       break;
     case FormBuilderItemFactory.TYPE_TEXTAREA:
       comp = new PdfFormBuilderTextarea();
       break;
     case FormBuilderItemFactory.TYPE_IMAGE:
       comp = new PdfFormBuilderImage();
       break;
     case FormBuilderItemFactory.TYPE_UPLOAD:
       comp = new PdfFormBuilderUpload();
       break;
     case FormBuilderItemFactory.TYPE_SELECT:
       comp = new PdfFormBuilderSelect();
       break;
     case FormBuilderItemFactory.TYPE_LISTBOX:
       comp = new PdfFormBuilderListbox();
       break;
     case FormBuilderItemFactory.TYPE_CHECKBOX:
       comp = new PdfFormBuilderCheckbox();
       break;
     case FormBuilderItemFactory.TYPE_RADIO:
       comp = new PdfFormBuilderRadio();
       break;
     case FormBuilderItemFactory.TYPE_METADATA:
       comp = new PdfFormBuilderMetaData();
       break;
     default:
       comp = new PdfFormBuilderLabel();
       comp.getProperties().setValues(Messages.getStringJSF("pdf.error"));
       skipPropertiesCopy = true;
       break;
   }
   if (!skipPropertiesCopy) {
     BeanUtils.copyProperties(item.getProperties(), comp.getProperties());
   }
   // Set data of html object
   if (data != null) {
     comp.setValue(data.getValue());
     if (data.getNumberValue() != null) {
       comp.setValue(data.getNumberValue().toString());
     }
     comp.setFile(data.getFile());
   } else {
     comp.setItemUuid(item.getId());
   }
   if (mode != null) {
     comp.setMode(mode);
   }
   // render html object
   return comp.render();
 }
コード例 #2
0
 public static Element getUIPdfComponent(FormBuilderItemData data, String mode) {
   return getUIPdfComponent(data.getFormBuilderItem(), data, mode);
 }