use of org.primefaces.context.RequestContext in project dataverse by IQSS.
the class FileDownloadHelper method writeGuestbookAndStartDownload.
public void writeGuestbookAndStartDownload(GuestbookResponse guestbookResponse) {
RequestContext requestContext = RequestContext.getCurrentInstance();
boolean valid = validateGuestbookResponse(guestbookResponse);
if (!valid) {
JH.addMessage(FacesMessage.SEVERITY_ERROR, JH.localize("dataset.message.validationError"));
} else {
requestContext.execute("PF('downloadPopup').hide()");
guestbookResponse.setDownloadtype("Download");
fileDownloadService.writeGuestbookAndStartDownload(guestbookResponse);
}
}
use of org.primefaces.context.RequestContext in project dataverse by IQSS.
the class DatasetPage method validateFilesForDownload.
public void validateFilesForDownload(boolean guestbookRequired) {
setSelectedDownloadableFiles(new ArrayList<>());
setSelectedNonDownloadableFiles(new ArrayList<>());
if (this.selectedFiles.isEmpty()) {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("PF('selectFilesForDownload').show()");
return;
}
List<FileMetadata> allFiles = new ArrayList<>();
if (isSelectAllFiles()) {
for (FileMetadata fm : workingVersion.getFileMetadatas()) {
allFiles.add(fm);
}
this.selectedFiles = allFiles;
}
for (FileMetadata fmd : this.selectedFiles) {
if (this.fileDownloadHelper.canDownloadFile(fmd)) {
getSelectedDownloadableFiles().add(fmd);
} else {
getSelectedNonDownloadableFiles().add(fmd);
}
}
if (!getSelectedDownloadableFiles().isEmpty() && getSelectedNonDownloadableFiles().isEmpty()) {
if (guestbookRequired) {
modifyGuestbookMultipleResponse();
} else {
startMultipleFileDownload(false);
}
}
if (getSelectedDownloadableFiles().isEmpty() && !getSelectedNonDownloadableFiles().isEmpty()) {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("PF('downloadInvalid').show()");
return;
}
if (!getSelectedDownloadableFiles().isEmpty() && !getSelectedNonDownloadableFiles().isEmpty()) {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("PF('downloadMixed').show()");
}
}
use of org.primefaces.context.RequestContext in project dataverse by IQSS.
the class DatasetPage method testSelectedFilesForRestrict.
public String testSelectedFilesForRestrict() {
RequestContext requestContext = RequestContext.getCurrentInstance();
if (selectedFiles.isEmpty()) {
requestContext.execute("PF('selectFilesForRestrict').show()");
return "";
} else {
boolean validSelection = false;
for (FileMetadata fmd : selectedFiles) {
if (!fmd.isRestricted()) {
validSelection = true;
}
}
if (!validSelection) {
requestContext.execute("PF('selectFilesForRestrict').show()");
return "";
}
testSelectedFilesForMapData();
requestContext.execute("PF('accessPopup').show()");
return "";
}
}
use of org.primefaces.context.RequestContext in project dataverse by IQSS.
the class ThemeWidgetFragment method resetForm.
public void resetForm() {
RequestContext context = RequestContext.getCurrentInstance();
context.reset(":dataverseForm:themeWidgetsTabView");
}
use of org.primefaces.context.RequestContext in project dataverse by IQSS.
the class FileDownloadHelper method startWorldMapDownloadLink.
public String startWorldMapDownloadLink(GuestbookResponse guestbookResponse, FileMetadata fmd) {
RequestContext requestContext = RequestContext.getCurrentInstance();
boolean valid = validateGuestbookResponse(guestbookResponse);
if (!valid) {
return "";
}
guestbookResponse.setDownloadtype("WorldMap");
String retVal = fileDownloadService.startWorldMapDownloadLink(guestbookResponse, fmd);
requestContext.execute("PF('downloadPopup').hide()");
return retVal;
}
Aggregations