use of com.liferay.faces.bridge.component.inputfile.InputFile in project liferay-faces-bridge-impl by liferay.
the class InputFileDelegationResponseWriter method startElement.
@Override
public void startElement(String name, UIComponent uiComponent) throws IOException {
super.startElement(name, uiComponent);
if ("input".equals(name)) {
InputFile inputFile = (InputFile) uiComponent;
String multiple = inputFile.getMultiple();
if ("multiple".equalsIgnoreCase(multiple)) {
super.writeAttribute("multiple", multiple, "multiple");
}
}
}
use of com.liferay.faces.bridge.component.inputfile.InputFile in project liferay-faces-bridge-impl 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);
if (!uploadedFileMap.isEmpty()) {
String clientId = uiComponent.getClientId(facesContext);
List<UploadedFile> uploadedFiles = uploadedFileMap.get(clientId);
if ((uploadedFiles != null) && (uploadedFiles.size() > 0)) {
List<com.liferay.faces.bridge.model.UploadedFile> bridgeUploadedFiles = new ArrayList<com.liferay.faces.bridge.model.UploadedFile>(uploadedFiles.size());
for (UploadedFile uploadedFile : uploadedFiles) {
bridgeUploadedFiles.add(uploadedFile);
}
inputFile.setSubmittedValue(bridgeUploadedFiles);
// 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