1. Added updated flash vis from Asik.
2. Modified the front end for person level vis so that when the flash vis height decreases it does not leave a trail of whitepace below it. All the wrapping containers adjust properly now. 3. Made the person pub count use set instead of list. I had already made other viss do this.
This commit is contained in:
parent
0ba1e950aa
commit
8372464464
8 changed files with 40 additions and 77 deletions
|
@ -211,8 +211,13 @@ function visLoaded(nodes){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTable(tableID, tableContainer, tableData) {
|
|
||||||
|
|
||||||
|
function changeVisHeight(newHeight) {
|
||||||
|
$("#CoAuthorVis").css("height", newHeight);
|
||||||
|
$("#bodyPannel").css("height", newHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTable(tableID, tableContainer, tableData) {
|
||||||
var table = $('<table>');
|
var table = $('<table>');
|
||||||
table.attr('id', tableID);
|
table.attr('id', tableID);
|
||||||
|
|
||||||
|
@ -324,7 +329,7 @@ function renderCoAuthorshipVisualization() {
|
||||||
"width", "600",
|
"width", "600",
|
||||||
"height", "840",
|
"height", "840",
|
||||||
"align", "middle",
|
"align", "middle",
|
||||||
"id", "CoAuthor",
|
"id", "CoAuthorVis",
|
||||||
"quality", "high",
|
"quality", "high",
|
||||||
"bgcolor", "#ffffff",
|
"bgcolor", "#ffffff",
|
||||||
"name", "CoAuthor",
|
"name", "CoAuthor",
|
||||||
|
@ -341,7 +346,7 @@ function renderCoAuthorshipVisualization() {
|
||||||
"width", "600",
|
"width", "600",
|
||||||
"height", "850",
|
"height", "850",
|
||||||
"align", "top",
|
"align", "top",
|
||||||
"id", "CoAuthor",
|
"id", "CoAuthorVis",
|
||||||
"quality", "high",
|
"quality", "high",
|
||||||
"bgcolor", "#ffffff",
|
"bgcolor", "#ffffff",
|
||||||
"name", "CoAuthor",
|
"name", "CoAuthor",
|
||||||
|
|
|
@ -105,7 +105,8 @@ public class VisualizationController extends BaseEditController {
|
||||||
|
|
||||||
String resourcePath =
|
String resourcePath =
|
||||||
getServletContext()
|
getServletContext()
|
||||||
.getRealPath("/WEB-INF/visualization/visualizations-beans-injection.xml");
|
.getRealPath(VisualizationFrameworkConstants
|
||||||
|
.RELATIVE_LOCATION_OF_VISUALIZATIONS_BEAN);
|
||||||
|
|
||||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||||
"file:" + resourcePath);
|
"file:" + resourcePath);
|
||||||
|
@ -118,7 +119,7 @@ public class VisualizationController extends BaseEditController {
|
||||||
visualizationIDsToClass = visualizationInjector.getVisualizationIDToClass();
|
visualizationIDsToClass = visualizationInjector.getVisualizationIDToClass();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,16 @@ package edu.cornell.mannlib.vitro.webapp.controller.visualization;
|
||||||
|
|
||||||
public class VisualizationFrameworkConstants {
|
public class VisualizationFrameworkConstants {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Contains the location of bean containing info on all the visualizations available
|
||||||
|
* in that instance. Currently it is stored under "productMods/WEB-INF..."
|
||||||
|
* */
|
||||||
|
public static final String RELATIVE_LOCATION_OF_VISUALIZATIONS_BEAN =
|
||||||
|
"/WEB-INF/visualization/visualizations-beans-injection.xml";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Vis URL prefix that is seen by all the users
|
||||||
|
* */
|
||||||
public static final String VISUALIZATION_URL_PREFIX = "/visualization";
|
public static final String VISUALIZATION_URL_PREFIX = "/visualization";
|
||||||
|
|
||||||
public static final String VIS_TYPE_URL_HANDLE = "vis";
|
public static final String VIS_TYPE_URL_HANDLE = "vis";
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
dataSource,
|
dataSource,
|
||||||
log);
|
log);
|
||||||
|
|
||||||
QueryHandler<List<BiboDocument>> publicationQueryManager =
|
QueryHandler<Set<BiboDocument>> publicationQueryManager =
|
||||||
new PersonPublicationCountQueryHandler(egoURIParam,
|
new PersonPublicationCountQueryHandler(egoURIParam,
|
||||||
dataSource,
|
dataSource,
|
||||||
log);
|
log);
|
||||||
|
@ -114,15 +114,14 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BiboDocument> authorDocuments = publicationQueryManager
|
Set<BiboDocument> authorDocuments = publicationQueryManager
|
||||||
.getVisualizationJavaValueObjects();
|
.getVisualizationJavaValueObjects();
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of publications. Use the BiboDocument's
|
* Create a map from the year to number of publications. Use the BiboDocument's
|
||||||
* parsedPublicationYear to populate the data.
|
* parsedPublicationYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToPublicationCount =
|
Map<String, Integer> yearToPublicationCount =
|
||||||
((PersonPublicationCountQueryHandler) publicationQueryManager)
|
UtilityFunctions.getYearToPublicationCount(authorDocuments);
|
||||||
.getYearToPublicationCount(authorDocuments);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Computations required to generate HTML for the sparklines & related context.
|
* Computations required to generate HTML for the sparklines & related context.
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.personpubcount;
|
package edu.cornell.mannlib.vitro.webapp.visualization.personpubcount;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -36,7 +38,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryHandler;
|
||||||
* @author cdtank
|
* @author cdtank
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PersonPublicationCountQueryHandler implements QueryHandler<List<BiboDocument>> {
|
public class PersonPublicationCountQueryHandler implements QueryHandler<Set<BiboDocument>> {
|
||||||
|
|
||||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||||
|
|
||||||
|
@ -81,8 +83,8 @@ public class PersonPublicationCountQueryHandler implements QueryHandler<List<Bib
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BiboDocument> createJavaValueObjects(ResultSet resultSet) {
|
private Set<BiboDocument> createJavaValueObjects(ResultSet resultSet) {
|
||||||
List<BiboDocument> authorDocuments = new ArrayList<BiboDocument>();
|
Set<BiboDocument> authorDocuments = new HashSet<BiboDocument>();
|
||||||
|
|
||||||
while (resultSet.hasNext()) {
|
while (resultSet.hasNext()) {
|
||||||
QuerySolution solution = resultSet.nextSolution();
|
QuerySolution solution = resultSet.nextSolution();
|
||||||
|
@ -192,7 +194,7 @@ public class PersonPublicationCountQueryHandler implements QueryHandler<List<Bib
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BiboDocument> getVisualizationJavaValueObjects()
|
public Set<BiboDocument> getVisualizationJavaValueObjects()
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(this.queryParam)) {
|
if (StringUtils.isNotBlank(this.queryParam)) {
|
||||||
|
@ -219,57 +221,4 @@ public class PersonPublicationCountQueryHandler implements QueryHandler<List<Bib
|
||||||
return createJavaValueObjects(resultSet);
|
return createJavaValueObjects(resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getYearToPublicationCount(
|
|
||||||
List<BiboDocument> authorDocuments) {
|
|
||||||
|
|
||||||
//List<Integer> publishedYears = new ArrayList<Integer>();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a map from the year to number of publications. Use the BiboDocument's
|
|
||||||
* parsedPublicationYear to populate the data.
|
|
||||||
* */
|
|
||||||
Map<String, Integer> yearToPublicationCount = new TreeMap<String, Integer>();
|
|
||||||
|
|
||||||
for (BiboDocument curr : authorDocuments) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Increment the count because there is an entry already available for
|
|
||||||
* that particular year.
|
|
||||||
*
|
|
||||||
* I am pushing the logic to check for validity of year in "getPublicationYear" itself
|
|
||||||
* because,
|
|
||||||
* 1. We will be using getPub... multiple times & this will save us duplication of code
|
|
||||||
* 2. If we change the logic of validity of a pub year we would not have to make
|
|
||||||
* changes all throughout the codebase.
|
|
||||||
* 3. We are asking for a publication year & we should get a proper one or NOT at all.
|
|
||||||
* */
|
|
||||||
String publicationYear;
|
|
||||||
if (curr.getPublicationYear() != null) {
|
|
||||||
publicationYear = curr.getPublicationYear();
|
|
||||||
} else {
|
|
||||||
publicationYear = curr.getParsedPublicationYear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yearToPublicationCount.containsKey(publicationYear)) {
|
|
||||||
yearToPublicationCount.put(publicationYear,
|
|
||||||
yearToPublicationCount
|
|
||||||
.get(publicationYear) + 1);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
yearToPublicationCount.put(publicationYear, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (!parsedPublicationYear.equalsIgnoreCase(BiboDocument.DEFAULT_PUBLICATION_YEAR)) {
|
|
||||||
// publishedYears.add(Integer.parseInt(parsedPublicationYear));
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return yearToPublicationCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
|
@ -61,21 +62,20 @@ public class PersonPublicationCountRequestHandler implements VisualizationReques
|
||||||
VisualizationFrameworkConstants
|
VisualizationFrameworkConstants
|
||||||
.VIS_CONTAINER_URL_HANDLE);
|
.VIS_CONTAINER_URL_HANDLE);
|
||||||
|
|
||||||
QueryHandler<List<BiboDocument>> queryManager =
|
QueryHandler<Set<BiboDocument>> queryManager =
|
||||||
new PersonPublicationCountQueryHandler(individualURIParam,
|
new PersonPublicationCountQueryHandler(individualURIParam,
|
||||||
dataSource,
|
dataSource,
|
||||||
log);
|
log);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<BiboDocument> authorDocuments = queryManager.getVisualizationJavaValueObjects();
|
Set<BiboDocument> authorDocuments = queryManager.getVisualizationJavaValueObjects();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of publications. Use the BiboDocument's
|
* Create a map from the year to number of publications. Use the BiboDocument's
|
||||||
* parsedPublicationYear to populate the data.
|
* parsedPublicationYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToPublicationCount =
|
Map<String, Integer> yearToPublicationCount =
|
||||||
((PersonPublicationCountQueryHandler) queryManager)
|
UtilityFunctions.getYearToPublicationCount(authorDocuments);
|
||||||
.getYearToPublicationCount(authorDocuments);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In order to avoid unneeded computations we have pushed this "if" condition up.
|
* In order to avoid unneeded computations we have pushed this "if" condition up.
|
||||||
|
@ -165,7 +165,7 @@ public class PersonPublicationCountRequestHandler implements VisualizationReques
|
||||||
|
|
||||||
private void prepareVisualizationQueryPDFResponse(
|
private void prepareVisualizationQueryPDFResponse(
|
||||||
Individual author,
|
Individual author,
|
||||||
List<BiboDocument> authorDocuments,
|
Set<BiboDocument> authorDocuments,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class PersonPublicationCountRequestHandler implements VisualizationReques
|
||||||
|
|
||||||
private void prepareVisualizationQueryDataResponse(
|
private void prepareVisualizationQueryDataResponse(
|
||||||
Individual author,
|
Individual author,
|
||||||
List<BiboDocument> authorDocuments,
|
Set<BiboDocument> authorDocuments,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -56,7 +55,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
String individualURIParam,
|
String individualURIParam,
|
||||||
String visMode,
|
String visMode,
|
||||||
String visContainer,
|
String visContainer,
|
||||||
List<BiboDocument> authorDocuments,
|
Set<BiboDocument> authorDocuments,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
SparklineVOContainer valueObjectContainer,
|
SparklineVOContainer valueObjectContainer,
|
||||||
Log log) {
|
Log log) {
|
||||||
|
@ -79,7 +78,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
|
|
||||||
private void generateVisualizationCode(String visMode,
|
private void generateVisualizationCode(String visMode,
|
||||||
String visContainer,
|
String visContainer,
|
||||||
List<BiboDocument> authorDocuments) {
|
Set<BiboDocument> authorDocuments) {
|
||||||
|
|
||||||
valueObjectContainer.setSparklineContent(getMainVisualizationCode(authorDocuments,
|
valueObjectContainer.setSparklineContent(getMainVisualizationCode(authorDocuments,
|
||||||
visMode,
|
visMode,
|
||||||
|
@ -90,7 +89,7 @@ public class PersonPublicationCountVisCodeGenerator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMainVisualizationCode(List<BiboDocument> authorDocuments,
|
private String getMainVisualizationCode(Set<BiboDocument> authorDocuments,
|
||||||
String visMode,
|
String visMode,
|
||||||
String providedVisContainerID) {
|
String providedVisContainerID) {
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue