Skip to content

Commit

Permalink
current state of the "lazy" hack. the thumbnails and buttons should b…
Browse files Browse the repository at this point in the history
…e properly rendered. (#4091)
  • Loading branch information
landreev committed Sep 22, 2017
1 parent 75bc45e commit 9a5a051
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ public boolean isThumbnailAvailable(FileMetadata fileMetadata) {
return false;
}



//logger.info("isThumbnailAvailable() called on file "+dataFileId);
//try{Thread.sleep(1000L);}catch(Exception e){}
String thumbnailAsBase64 = ImageThumbConverter.getImageThumbnailAsBase64(fileMetadata.getDataFile(), ImageThumbConverter.DEFAULT_THUMBNAIL_SIZE);


Expand All @@ -703,12 +703,13 @@ public boolean isThumbnailAvailable(FileMetadata fileMetadata) {
}

public String getDataFileThumbnailAsBase64(FileMetadata fileMetadata) {
//logger.info("THUMBNAIL REQUESTED FOR DATAFILE "+fileMetadata.getDataFile().getId());
return datafileThumbnailsMap.get(fileMetadata.getDataFile().getId());
}

public void enableThumbnails() {
pageLoadInProgress = false;
logger.fine("ENABLED thumbnails on the page.");
//logger.info("ENABLED thumbnails on the page.");
}

public boolean isPageLoadInProgress() {
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/file-download-button-fragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<p:commandLink rendered="#{ fileDownloadHelper.canDownloadFile(fileMetadata) and !(fileMetadata.dataFile.tabularData) and !(downloadPopupRequired) }"
type="button" styleClass="btn btn-default"
disabled="#{DatasetPage.pageLoadInProgress}"
update="@none"
actionListener="#{fileDownloadService.startFileDownload(guestbookResponse, fileMetadata, 'Download')}">
<!-- non-tabular data file: -->
<!-- no guest book/terms of use/etc. - straight to the download API url: -->
Expand Down
13 changes: 7 additions & 6 deletions src/main/webapp/filesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,17 @@


<h:inputHidden value="#{DatasetPage.pageLoadInProgress}" id="pageLoadInProgress" />


<p:remoteCommand name="enableThumbnails" immediate="true" process="@this" update=":datasetForm:tabView:filesTable" actionListener="#{DatasetPage.enableThumbnails}"/>
<p:remoteCommand name="enableThumbnails" immediate="true" process="@this" update=":datasetForm:tabView:filesTable,:datasetForm:tabView:pageLoadInProgress" actionListener="#{DatasetPage.enableThumbnails}"/>


<script type="text/javascript">
$(document).ready(function () {
if ($('input[id$="pageLoadInProgress"]').val() === 'true') {
enableThumbnails();
}
});
$(this).ready(function () {
//if ($('input[id$="pageLoadInProgress"]').val() === 'true') {
enableThumbnails();
//}
});
</script>

</ui:composition>

0 comments on commit 9a5a051

Please sign in to comment.