This commit is contained in:
rjy7 2010-07-19 21:37:59 +00:00
parent ddae9bb311
commit a5f60a9f7f
5 changed files with 60 additions and 55 deletions

View file

@ -80,28 +80,32 @@ public class MiscWebUtils {
return (String) contentObj;
}
// Get custom short view from either the object's class or one of its
// superclasses.
// This is needed because the inference update happens asynchronously, so
// when a new
// property has been added and the page is reloaded, the custom short view
// from a
// superclass may not have been inferred yet.
public static String getCustomShortView(HttpServletRequest request) {
Individual object = ((ObjectPropertyStatement) request
.getAttribute("opStmt")).getObject();
return getCustomShortView(object, request);
}
// Get custom short view from either the object's class or one of its
// superclasses. This is needed because the inference update happens asynchronously,
// so when a new property has been added and the page is reloaded, the custom short view
// from a superclass may not have been inferred yet.
public static String getCustomShortView(Individual individual, HttpServletRequest request) {
VitroRequest vreq = new VitroRequest(request);
VClassDao vcDao = vreq.getWebappDaoFactory().getVClassDao();
String customShortView = null;
Individual object = ((ObjectPropertyStatement) request
.getAttribute("opStmt")).getObject();
List<VClass> vclasses = object.getVClasses(true); // get directly
List<VClass> vclasses = individual.getVClasses(true); // get directly
// asserted vclasses
Set<String> superClasses = new HashSet<String>();
// First try directly asserted classes, there is no useful decision
// mechanism for
// the case where two directly asserted classes have a custom short
// view.
// mechanism for the case where two directly asserted classes
// have a custom short view.
// RY If we're getting the custom short view with reference to an object property.
// should we use the property's getRangeVClass() method instead?
for (VClass vclass : vclasses) {
// Use this class's custom short view, if there is one
customShortView = vclass.getCustomShortView();

View file

@ -432,6 +432,12 @@ public class InputElementFormattingTag extends TagSupport {
out.print("<input "+classStr+" "+sizeStr+" type=\"text\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
if (definitionTags) { out.print("</dd>"); }
out.println();
} else if( getType().equalsIgnoreCase("hidden")) {
String valueStr = doValue(editConfig, editSub);
if (definitionTags) { out.print("<dd>"); }
out.print("<input "+classStr+ "type=\"hidden\" id=\""+getId()+"\" name=\""+getName()+"\" value=\""+valueStr+"\" />");
if (definitionTags) { out.print("</dd>"); }
out.println();
} else if (getType().equalsIgnoreCase("textarea")) {
String valueStr = doValue(editConfig, editSub);
String rowStr = doRows();

View file

@ -21,6 +21,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ page import="java.util.List" %>
@ -110,19 +111,12 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
request.setAttribute("objectName", FrontEndEditingUtils.getVitroNsObjDisplayName(predicateUri, object, model));
log.debug("setting object name " + (String)request.getAttribute("objectName") + " for vitro namespace object property " + predicateUri);
} else {
for (VClass clas : object.getVClasses()) {
request.setAttribute("rangeClassName", clas.getName());
customShortView = MiscWebUtils.getCustomShortView(object, request);
if (customShortView != null) {
foundClass = true;
customShortView = clas.getCustomShortView();
if (customShortView != null && customShortView.trim().length()>0) {
log.debug("setting object name from VClass custom short view");
request.setAttribute("customShortView",shortViewPrefix + customShortView.trim());
request.setAttribute("individual",object);
} else {
log.debug("No custom short view for class, so setting object name from object individual name");
request.setAttribute("objectName",object.getName());
}
}
if (!foundClass) {
VClass clas = prop.getRangeVClass();

View file

@ -13,7 +13,6 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmissionPreprocessor" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %>
<%@ page import="java.io.StringReader" %>
<%@ page import="java.util.*" %>

View file

@ -26,6 +26,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Collections" %>
@ -34,13 +35,14 @@
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.HashSet" %>
<%@page import="java.util.LinkedList"%>
<%@page import="java.util.Set"%>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@page import="java.util.LinkedList"%>
<%@page import="java.util.Set"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%><jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.entity.entityMergedPropsList.jsp");
%>