Hi all,
what I'm trying to develop is an auto refresh of a panelSerie after a file upload via an inputFile component.
Basically, when users upload a file, the panelSerie shows the new element with the others.
Like the component showcase, I set the value of the PanelSerie to a synchronized list in session scope. An actionListener on the inputFile component will add the new uploaded element to the list, but the panel serie doesn't refresh.
I need to add a refresh button which is what I want to avoid.
Here is my xhtml for inputFile component:
Code:
<ice:inputFile id="ifImages" disabled="#{!itemIndex.editMode}"
progressListener="#{itemImageUploadController.fileUploadProgressListener}"
label="#{msgs.uploadImage}"
actionListener="#{itemImageUploadController.fileUploadActionListener}"
uniqueFolder="false"
uploadDirectory="#{itemImageUploadController.uploadDirectory}" />
Here is the xhtml code of the panelserie
Code:
<ice:selectOneRadio id="sorImagesSession" layout="spread"
value="#{itemIndex.selectedSessionImageId}"
partialSubmit="true">
<f:selectItems value="#{itemIndex.sessionImagesSelectItems}" />
</ice:selectOneRadio>
<ice:panelSeries value="#{itemIndex.sessionImageSerieList}"
var="imageSerieSession">
<div
style="float: left; margin: 2px; padding: 5px; margin-right: 20px; border: 1px solid #999999;">
<ice:panelGroup>
<ice:panelBorder>
<f:facet name="center">
<ice:outputLink target="_new"
value="#{applicationBean.imagesUrl}#{imageSerieSession.entityId}">
<ice:graphicImage id="giImageSession" width="200"
height="200"
alt="#{msgs.download} #{imageSerie.description}"
url="#{applicationBean.imagesUrl}#{imageSerieSession.entityId}" />
</ice:outputLink>
</f:facet>
<f:facet name="south">
<ice:panelBorder>
<f:facet name="center">
<ice:outputLabel for="giImageSession"
value="#{imageSerieSession.description}" />
</f:facet>
<f:facet name="west">
<ice:radio id="laMiaRadioSession" for="sorImagesSession"
index="#{imageSerieSession.index}" />
</f:facet>
</ice:panelBorder>
</f:facet>
</ice:panelBorder>
</ice:panelGroup></div>
</ice:panelSeries>
Here is the actionListener code
Code:
ImageFile imgFile = new ImageFile();
String fileName = fileInfo.getFile().getName();
imgFile.setName(fileName);
imgFile.setFileExtension(fileName.substring(fileName.lastIndexOf('.')));
imgFile.setDescription(imageDescription);
Thumbnail thumbnail = new Thumbnail();
byte[] thumbnailBytes = thumbnail.scaleImage(fileInfo.getFile(), this.applicationBean.getThumbnailMaxSize(), this.applicationBean.getThumbnailMaxSize());
imgFile.setThumbnail(thumbnailBytes);
synchronized (this.imageFileContainer.getImageFileList()) {
this.imageFileContainer.getImageFileList().add(imgFile);
}
this.imageDescription = null;
and finally my session-scope list
Code:
private final List<ImageFile> imageFileList = Collections.synchronizedList(new ArrayList<ImageFile>());
...
public List<ImageFile> getImageFileList() {
return imageFileList;
}
Any help will be really appreciated
Thanks in advance guys