The SECS/GEM module does this with the following:
0. The stuff you're already doing in the form meta.
- Subclassing
RecordEditForm
- Setting up a private final field to hold the
FileUploadField
:
private FileUploadField uploadField;
- Overriding
newEditorComponent
to capture the value in the field:
@Override
protected Component newEditorComponent(String id, FormMeta formMeta, RecordEditMode mode, SRecordInstance record) {
Component comp = super.newEditorComponent(id, formMeta, mode, record);
if (formMeta.getField().equals(EquipmentRecord.SecsDefinitionFile)) {
uploadField = (FileUploadField) ((AbstractFormComponentEditor<?>) comp).getFormComponent();
}
- Overriding
onSubmit
and extracting the list of uploaded files:
List<FileUpload> fuList = uploadField.getModelObject();
The same general approach should work, though I'll echo Phil's general sentiment that the less engineering effort spent on wrangling Wicket the better.