use of javax.faces.component.html.HtmlInputFile in project liferay-faces-bridge-impl by liferay.
the class HtmlInputFileRenderer method decode.
@Override
public void decode(FacesContext facesContext, UIComponent uiComponent) {
HtmlInputFile htmlInputFile = (HtmlInputFile) uiComponent;
Map<String, List<UploadedFile>> uploadedFileMap = InputFileRenderer.getUploadedFileMap(facesContext);
if (!uploadedFileMap.isEmpty()) {
String clientId = uiComponent.getClientId(facesContext);
if (uploadedFileMap.containsKey(clientId)) {
List<UploadedFile> uploadedFiles = uploadedFileMap.get(clientId);
if ((uploadedFiles != null) && (uploadedFiles.size() > 0)) {
Part part = new PartFileUploadAdapterImpl(uploadedFiles.get(0), clientId);
htmlInputFile.setTransient(true);
htmlInputFile.setSubmittedValue(part);
} else {
htmlInputFile.setSubmittedValue(new PartEmptyImpl());
}
}
}
RendererUtil.decodeClientBehaviors(facesContext, uiComponent);
}
Aggregations