Skip to content

Commit

Permalink
Separate unf display from variables + observations on dataverse pg re…
Browse files Browse the repository at this point in the history
…sult cards [ref #5210 #6685]
  • Loading branch information
mheppler committed Jan 11, 2021
1 parent d16b6ee commit 1b27ec3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
Expand Up @@ -1201,30 +1201,43 @@ public SearchException getSearchException() {
}

public String tabularDataDisplayInfo(DataFile datafile) {
String ret = "";
String tabInfo = "";

if (datafile == null) {
return null;
}

if (datafile.isTabularData() && datafile.getDataTable() != null) {
DataTable datatable = datafile.getDataTable();
String unf = datatable.getUnf();
Long varNumber = datatable.getVarQuantity();
Long obsNumber = datatable.getCaseQuantity();
if (varNumber != null && varNumber.intValue() != 0) {
ret = ret.concat(varNumber + " " + BundleUtil.getStringFromBundle("file.metaData.dataFile.dataTab.variables"));
tabInfo = tabInfo.concat(varNumber + " " + BundleUtil.getStringFromBundle("file.metaData.dataFile.dataTab.variables"));
if (obsNumber != null && obsNumber.intValue() != 0) {
ret = ret.concat(", " + obsNumber + " " + BundleUtil.getStringFromBundle("file.metaData.dataFile.dataTab.observations"));
tabInfo = tabInfo.concat(", " + obsNumber + " " + BundleUtil.getStringFromBundle("file.metaData.dataFile.dataTab.observations"));
}
ret = ret.concat(" - ");
}
}

return tabInfo;
}

public String tabularDataUnfDisplay(DataFile datafile) {
String tabUnf = "";

if (datafile == null) {
return null;
}

if (datafile.isTabularData() && datafile.getDataTable() != null) {
DataTable datatable = datafile.getDataTable();
String unf = datatable.getUnf();
if (unf != null && !unf.equals("")) {
ret = ret.concat(BundleUtil.getStringFromBundle("file.metaData.dataFile.dataTab.unf") + ": " + unf);
tabUnf = tabUnf.concat(unf);
}
}

return ret;
return tabUnf;
}

public String dataFileSizeDisplay(DataFile datafile) {
Expand Down
12 changes: 9 additions & 3 deletions src/main/webapp/search-include-fragment.xhtml
Expand Up @@ -619,9 +619,15 @@
title="#{bundle['file.metaData.checksum.copy']} #{result.fileChecksumValue}"
jsf:rendered="#{!result.harvested and !SearchIncludeFragment.isTabular(result.entity) and !(empty result.fileChecksumValue)}">#{result.fileChecksumValue}</span>

<!-- if this is a tabular data file, extra information, such as the numbers of variables and observations and the unf, is displayed: -->
<h:outputText value=" - #{SearchIncludeFragment.tabularDataDisplayInfo(result.entity)}"
rendered="#{!empty SearchIncludeFragment.tabularDataDisplayInfo(result.entity)}"/>
<!-- if tabular data file, display number of variables and observations, and unf -->
<h:outputText value=" - " rendered="#{!empty SearchIncludeFragment.tabularDataDisplayInfo(result.entity)}"/>
<h:outputText value="#{SearchIncludeFragment.tabularDataDisplayInfo(result.entity)}" rendered="#{!empty SearchIncludeFragment.tabularDataDisplayInfo(result.entity)}"/>
<h:outputText value=" - " rendered="#{!empty SearchIncludeFragment.tabularDataUnfDisplay(result.entity)}"/>
<span class="checksum-truncate"
data-clipboard-action="copy"
data-clipboard-text="#{SearchIncludeFragment.tabularDataUnfDisplay(result.entity)}"
title="#{bundle['file.metaData.checksum.copy']} #{SearchIncludeFragment.tabularDataUnfDisplay(result.entity)}"
jsf:rendered="#{!empty SearchIncludeFragment.tabularDataUnfDisplay(result.entity)}">#{SearchIncludeFragment.tabularDataUnfDisplay(result.entity)}</span>
</div>

<div class="file-tags-block" jsf:rendered="#{(!empty result.fileCategories) or (!empty result.tabularDataTags)}">
Expand Down

0 comments on commit 1b27ec3

Please sign in to comment.