From ae432163967564e017479579a17d51f974e8381a Mon Sep 17 00:00:00 2001 From: cdtank Date: Tue, 12 Apr 2011 17:49:53 +0000 Subject: [PATCH] 1. In Temporal vis developed vis drilling up from lower level. (see http://issues.library.cornell.edu/browse/NIHVIVO-1800) 2. Refactored client-side code for temporal vis. --- .../visualization/entitycomparison/layout.css | 5 + .../entitycomparison/gui-event-manager.js | 122 +++++++++++------- .../js/visualization/entitycomparison/util.js | 15 +-- .../entitycomparison/entityComparisonBody.ftl | 5 + .../entityComparisonOnGrantsStandalone.ftl | 4 +- ...tityComparisonOnPublicationsStandalone.ftl | 4 +- .../entityComparisonSetup.ftl | 13 +- .../constants/QueryFieldLabels.java | 6 + .../EntityComparisonUtilityFunctions.java | 14 +- ...poralGrantVisualizationRequestHandler.java | 20 ++- ...ublicationVisualizationRequestHandler.java | 17 ++- .../ModelConstructorUtilities.java | 2 + ...OrganizationModelWithTypesConstructor.java | 2 - ...SubOrganizationWithinModelConstructor.java | 111 ++++++++++++++++ .../SubOrganizationWithinModelFactory.java | 42 ++++++ .../freemarker/valueobjects/Entity.java | 15 ++- .../freemarker/valueobjects/JsonObject.java | 2 - .../valueobjects/SubjectEntityJSON.java | 47 +++++++ .../visutils/SelectOnModelUtilities.java | 81 +++++++++++- 19 files changed, 449 insertions(+), 78 deletions(-) create mode 100644 src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/modelconstructor/SubOrganizationWithinModelConstructor.java create mode 100644 src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/modelconstructor/factory/SubOrganizationWithinModelFactory.java create mode 100644 src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/SubjectEntityJSON.java diff --git a/productMods/css/visualization/entitycomparison/layout.css b/productMods/css/visualization/entitycomparison/layout.css index 381646e6..ae99242c 100644 --- a/productMods/css/visualization/entitycomparison/layout.css +++ b/productMods/css/visualization/entitycomparison/layout.css @@ -13,6 +13,10 @@ display: none; } +#subject-parent-entity { + display: none; +} + #error-container { display: none; } @@ -49,6 +53,7 @@ img.bar-count-icon { .legend-bar { margin-bottom: 3px; + cursor:default; } .unknown-legend-bar { diff --git a/productMods/js/visualization/entitycomparison/gui-event-manager.js b/productMods/js/visualization/entitycomparison/gui-event-manager.js index c9f0a8b8..d46ef482 100644 --- a/productMods/js/visualization/entitycomparison/gui-event-manager.js +++ b/productMods/js/visualization/entitycomparison/gui-event-manager.js @@ -24,7 +24,7 @@ $(document).ready(function() { * update the status accordingly. */ - $("select.comparisonValues").change(function(){ + $("select.comparisonValues").change(function() { var selectedValue = $("select.comparisonValues option:selected").val(); @@ -36,6 +36,8 @@ $(document).ready(function() { currentParameter = parameter.name; selectedDataURL = parameter.dataLink; + temporalGraphCommonURL = parameter.viewBaseLink; + csvDownloadURL = parameter.csvLink; } }); @@ -175,47 +177,79 @@ function performEntityCheckboxClickedRedrawActions() { } -/* - * function to populate the labelToEntityRecord object with the - * values from the json file and - * dynamically generate checkboxes - */ -function loadData(jsonData, dataTableParams) { - - $.each(jsonData, function (index, val) { - setOfLabels.push(val.label); - URIToEntityRecord[val.entityURI] = val; - if (val.lastCachedAtDateTime) { - lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; - } - }); - - prepareTableForDataTablePagination(jsonData, dataTableParams); - setEntityLevel(getEntityVisMode(jsonData)); - - entityCheckboxOperatedOnEventListener(); - -} - -/* - * function to populate the labelToEntityRecord object with the - * values from the json file and - * dynamically generate checkboxes - */ -function reloadData(preselectedEntityURIs, jsonData) { - - $.each(jsonData, function (index, val) { - setOfLabels.push(val.label); - URIToEntityRecord[val.entityURI] = val; - if (val.lastCachedAtDateTime) { - lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; - } - }); - - reloadDataTablePagination(preselectedEntityURIs, jsonData); - setEntityLevel(getEntityVisMode(jsonData)); -} - +var processJSONData = { + + isParentEntityAvailable: false, + + setupGlobals: function(jsonContent) { + $.each(jsonContent, function (index, val) { + + /* + * We are checking if the "label" attribute is present, because that pertains to + * data used for linegraph visualization. + * */ + if (val.label) { + + setOfLabels.push(val.label); + URIToEntityRecord[val.entityURI] = val; + if (val.lastCachedAtDateTime) { + lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; + } + } else if (val.subjectEntityLabel) { + + /* + * This is to set the drill-up visualization URLs. + * */ + $.each(val.parentURIToLabel, function(index, value) { + + $("a#subject-parent-entity-temporal-url").attr("href", getTemporalVisURL(index)); + + $("a#subject-parent-entity-profile-url").attr("href", getVIVOURL(index)); + $("a#subject-parent-entity-profile-url").text(value); + + processJSONData.isParentEntityAvailable = true; + }); + } + }); + + if (processJSONData.isParentEntityAvailable) { + $("#subject-parent-entity").show(); + } else { + $("#subject-parent-entity").hide(); + } + }, + + /* + * function to populate the labelToEntityRecord object with the + * values from the json file and + * dynamically generate checkboxes + */ + loadData: function(jsonData, dataTableParams) { + + processJSONData.setupGlobals(jsonData); + + prepareTableForDataTablePagination(jsonData, dataTableParams); + setEntityLevel(getEntityVisMode(jsonData)); + + entityCheckboxOperatedOnEventListener(); + }, + + /* + * function to populate the labelToEntityRecord object with the + * values from the json file and + * dynamically generate checkboxes + */ + reloadData: function(preselectedEntityURIs, jsonData) { + + processJSONData.setupGlobals(jsonData); + + reloadDataTablePagination(preselectedEntityURIs, jsonData); + setEntityLevel(getEntityVisMode(jsonData)); + + $("a#csv").attr("href", csvDownloadURL); + } + +}; function entityCheckboxOperatedOnEventListener() { @@ -394,7 +428,7 @@ temporalGraphProcessor = { /* * render the temporal graph per the sent content. * */ - loadData(jsonData, this.dataTableParams); + processJSONData.loadData(jsonData, this.dataTableParams); lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter); @@ -438,7 +472,7 @@ temporalGraphProcessor = { /* * render the temporal graph per the sent content. * */ - reloadData(currentSelectedEntityURIs, jsonData); + processJSONData.reloadData(currentSelectedEntityURIs, jsonData); lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter); diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js index aafe6c20..0a7b5cc5 100644 --- a/productMods/js/visualization/entitycomparison/util.js +++ b/productMods/js/visualization/entitycomparison/util.js @@ -640,7 +640,7 @@ function createLegendRow(entity, bottomDiv) { * there is no drill-down possible, so don't diaply the temporal graph icon. * */ if (entity.visMode !== "PERSON") { - labelDiv.append(''); + labelDiv.append(''); } @@ -649,7 +649,7 @@ function createLegendRow(entity, bottomDiv) { checkbox.attr('checked', true); checkbox.attr('id', 'checkbox'); checkbox.attr('class', 'easyDeselectCheckbox'); - checkbox.attr('value', entity.label); + checkbox.attr('value', entity.entityURI); var hiddenLabel = $('