use of com.liferay.faces.alloy.component.inputfile.FileUploadEvent in project liferay-faces-alloy by liferay.
the class InputFileRenderer method decode.
@Override
public void decode(FacesContext facesContext, UIComponent uiComponent) {
InputFile inputFile = (InputFile) uiComponent;
Map<String, List<UploadedFile>> uploadedFileMap = getUploadedFileMap(facesContext, inputFile.getLocation());
if (uploadedFileMap != null) {
String clientId = uiComponent.getClientId(facesContext);
List<UploadedFile> uploadedFiles = uploadedFileMap.get(clientId);
if ((uploadedFiles != null) && (uploadedFiles.size() > 0)) {
inputFile.setSubmittedValue(uploadedFiles);
// ActionListener.
for (UploadedFile uploadedFile : uploadedFiles) {
FileUploadEvent fileUploadEvent = new FileUploadEvent(uiComponent, uploadedFile);
uiComponent.queueEvent(fileUploadEvent);
}
} else // FACES-3136: Ensure that the required attribute is enforced.
{
inputFile.setSubmittedValue(Collections.emptyList());
}
} else // FACES-3136: Ensure that the required attribute is enforced.
{
inputFile.setSubmittedValue(Collections.emptyList());
}
}
Aggregations