NIHVIVO-3771 new object and data property hierarchies and listings
This commit is contained in:
parent
3646a214a5
commit
8ee4d7cd8e
11 changed files with 1250 additions and 33 deletions
|
@ -32,6 +32,7 @@
|
|||
this.form = $('form#classHierarchyForm');
|
||||
this.select = $('select#displayOption');
|
||||
this.addClass = $('input#addClass');
|
||||
this.addGroup = $('input#addGroup');
|
||||
},
|
||||
|
||||
bindEventListeners: function() {
|
||||
|
@ -49,6 +50,10 @@
|
|||
classHierarchyUtils.form.attr("action", "vclass_retry");
|
||||
classHierarchyUtils.form.submit();
|
||||
});
|
||||
this.addGroup.click(function() {
|
||||
classHierarchyUtils.form.attr("action", "editForm?controller=Classgroup");
|
||||
classHierarchyUtils.form.submit();
|
||||
});
|
||||
},
|
||||
|
||||
buildClassHierarchyHtml: function() {
|
||||
|
@ -148,13 +153,13 @@
|
|||
$clickableHeader.click(function() {
|
||||
if ( $clickableHeader.attr('view') == "less" ) {
|
||||
$clickableHeader.addClass("headerSpanMinus");
|
||||
$('table#classHierarchy' + ctr).find('span').addClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('span.subclassExpandPlus').addClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('table.subclassTable').show();
|
||||
$clickableHeader.attr('view', 'more' );
|
||||
}
|
||||
else {
|
||||
$clickableHeader.removeClass("headerSpanMinus");
|
||||
$('table#classHierarchy' + ctr).find('span').removeClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('span.subclassExpandPlus').removeClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('table.subclassTable').hide();
|
||||
$clickableHeader.attr('view', 'less' );
|
||||
}
|
||||
|
@ -187,14 +192,14 @@
|
|||
if ( classHierarchyUtils.expandAll.text() == "expand all" ) {
|
||||
classHierarchyUtils.expandAll.text("collapse all");
|
||||
$('span.headerSpanPlus').addClass("headerSpanMinus");
|
||||
$('table.classHierarchy').find('span').addClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('span.subclassExpandPlus').addClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('table.subclassTable').show();
|
||||
$('section#container').find('span.headerSpanPlus').attr('view','more');
|
||||
}
|
||||
else {
|
||||
classHierarchyUtils.expandAll.text("expand all");
|
||||
$('span.headerSpanPlus').removeClass("headerSpanMinus");
|
||||
$('table.classHierarchy').find('span').removeClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('span.subclassExpandPlus').removeClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('table.subclassTable').hide();
|
||||
$('section#container').find('span.headerSpanPlus').attr('view','less');
|
||||
}
|
||||
|
|
293
webapp/web/js/siteAdmin/objectPropertyHierarchyUtils.js
Normal file
293
webapp/web/js/siteAdmin/objectPropertyHierarchyUtils.js
Normal file
|
@ -0,0 +1,293 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
var objectPropHierarchyUtils = {
|
||||
onLoad: function(urlBase,displayOption,type) {
|
||||
this.imagePath = urlBase + "/images/";
|
||||
this.propType = type;
|
||||
this.initObjects();
|
||||
this.expandAll.hide();
|
||||
this.checkJsonTree();
|
||||
|
||||
if ( noProps ) {
|
||||
this.buildNoPropsHtml();
|
||||
}
|
||||
else if ( displayOption == "all" ) {
|
||||
this.buildAllPropsHtml();
|
||||
}
|
||||
else {
|
||||
this.buildPropertyHierarchyHtml();
|
||||
this.wireExpandLink();
|
||||
}
|
||||
|
||||
if ( displayOption == "hierarchy" ) {
|
||||
this.expandAll.show();
|
||||
}
|
||||
this.bindEventListeners();
|
||||
},
|
||||
|
||||
initObjects: function() {
|
||||
this.expandAll = $('span#expandAll').find('a');
|
||||
this.classCounter = 1;
|
||||
this.expandCounter = 1;
|
||||
this.classHtml = "";
|
||||
this.clickableSpans = [] ;
|
||||
this.form = $('form#classHierarchyForm');
|
||||
this.select = $('select#displayOption');
|
||||
this.addProperty = $('input#addProperty');
|
||||
noProps = new Boolean;
|
||||
},
|
||||
|
||||
bindEventListeners: function() {
|
||||
if ( this.propType == "object" ) {
|
||||
this.select.change(function() {
|
||||
if ( objectPropHierarchyUtils.select.val() == "all") {
|
||||
objectPropHierarchyUtils.form.attr("action", "listPropertyWebapps");
|
||||
}
|
||||
else {
|
||||
objectPropHierarchyUtils.form.attr("action", "showObjectPropertyHierarchy");
|
||||
}
|
||||
objectPropHierarchyUtils.form.submit();
|
||||
});
|
||||
|
||||
this.addProperty.click(function() {
|
||||
objectPropHierarchyUtils.form.attr("action", "editForm?controller=Property");
|
||||
objectPropHierarchyUtils.form.submit();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.select.change(function() {
|
||||
if ( objectPropHierarchyUtils.select.val() == "all") {
|
||||
objectPropHierarchyUtils.form.attr("action", "listDatatypeProperties");
|
||||
}
|
||||
else {
|
||||
objectPropHierarchyUtils.form.attr("action", "showDataPropertyHierarchy");
|
||||
}
|
||||
objectPropHierarchyUtils.form.submit();
|
||||
});
|
||||
|
||||
this.addProperty.click(function() {
|
||||
objectPropHierarchyUtils.form.attr("action", "editForm?controller=Dataprop");
|
||||
objectPropHierarchyUtils.form.submit();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
checkJsonTree: function() {
|
||||
if ( json.length == 1 ) {
|
||||
$.each(json, function() {
|
||||
// check to see whether we have a 'no properties' message or an actual json tree
|
||||
if ( this.name.indexOf("properties") != -1 && this.data == undefined ) {
|
||||
noProps = true;
|
||||
}
|
||||
else {
|
||||
noProps = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
noProps = false;
|
||||
}
|
||||
},
|
||||
|
||||
buildPropertyHierarchyHtml: function() {
|
||||
|
||||
$.each(json, function() {
|
||||
$newClassSection = jQuery("<section></section>", {
|
||||
id: "classContainer" + objectPropHierarchyUtils.classCounter
|
||||
});
|
||||
var descendants = "";
|
||||
var headerSpan = "";
|
||||
|
||||
if ( this.children.length ) {
|
||||
descendants = objectPropHierarchyUtils.getTheChildren(this);
|
||||
headerSpan = "<span class='headerSpanPlus' id='headerSpan" + objectPropHierarchyUtils.classCounter
|
||||
+ "' view='less'> </span>";
|
||||
}
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<div>" + this.name + headerSpan + "</div>" + "<table class='classHierarchy' id='classHierarchy"
|
||||
+ objectPropHierarchyUtils.classCounter + "'>" ;
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Local Name:</td><td>"
|
||||
+ (this.data.internalName.length > 0 ? this.data.internalName : "none" ) + "</td></tr>";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Group:</td><td>"
|
||||
+ (this.data.group.length > 0 ? this.data.group : "unspecified" ) + "</td></tr>";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Domain Class:</td><td>"
|
||||
+ (this.data.domainVClass.length > 0 ? this.data.domainVClass : "none" ) + " ";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<span class='rangeClass'>Range Class:</span>"
|
||||
+ (this.data.rangeVClass.length > 0 ? this.data.rangeVClass : "none" ) + "</td></tr>";
|
||||
|
||||
|
||||
objectPropHierarchyUtils.classHtml += descendants;
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "</table>";
|
||||
// alert(objectPropHierarchyUtils.classHtml);
|
||||
$newClassSection.html(objectPropHierarchyUtils.classHtml);
|
||||
$newClassSection.appendTo($('section#container'));
|
||||
objectPropHierarchyUtils.makeHeaderSpansClickable(objectPropHierarchyUtils.classCounter);
|
||||
objectPropHierarchyUtils.makeSubpropertySpansClickable();
|
||||
objectPropHierarchyUtils.clickableSpans = [] ;
|
||||
objectPropHierarchyUtils.classHtml = "";
|
||||
objectPropHierarchyUtils.classCounter += 1;
|
||||
});
|
||||
},
|
||||
|
||||
getTheChildren: function(node) {
|
||||
var childDetails = "";
|
||||
var subclassString = " ";
|
||||
var ctr = 0
|
||||
$.each(node.children, function() {
|
||||
if ( ctr == 0 ) {
|
||||
childDetails += "<tr><td class='classDetail'>Subproperties:</td>";
|
||||
ctr = ctr + 1;
|
||||
}
|
||||
else {
|
||||
childDetails += "<tr><td></td>" ;
|
||||
}
|
||||
|
||||
if ( this.children.length == 1 ) {
|
||||
subclassString += "<span style='font-size:0.8em'> (1 subclass)</span>";
|
||||
}
|
||||
else if ( this.children.length > 1 ) {
|
||||
subclassString += "<span style='font-size:0.8em'> (" + this.children.length + " subclasses)</span>";
|
||||
}
|
||||
|
||||
childDetails += "<td class='subclassCell' colspan='2'><span class='subclassExpandPlus' id='subclassExpand"
|
||||
+ objectPropHierarchyUtils.expandCounter + "'> </span>"
|
||||
+ this.name + subclassString + "</td></tr><tr><td></td><td colspan='2'><table id='subclassTable"
|
||||
+ objectPropHierarchyUtils.expandCounter + "' class='subclassTable'>";
|
||||
|
||||
subclassString = " ";
|
||||
|
||||
objectPropHierarchyUtils.clickableSpans.push('subclassExpand' + objectPropHierarchyUtils.expandCounter);
|
||||
|
||||
objectPropHierarchyUtils.expandCounter += 1;
|
||||
|
||||
childDetails += "<tr><td class='classDetail'>Local Name:</td><td>"
|
||||
+ (this.data.internalName.length > 0 ? this.data.internalName : "none" ) + "</td></tr>";
|
||||
|
||||
childDetails += "<tr><td class='classDetail'>Group:</td><td>"
|
||||
+ (this.data.group.length > 0 ? this.data.group : "unspecified" ) + "</td></tr>";
|
||||
|
||||
childDetails += "<tr><td class='classDetail'>Domain Class:</td><td>"
|
||||
+ (this.data.domainVClass.length > 0 ? this.data.domainVClass : "none" ) + " ";
|
||||
|
||||
childDetails += "<span class='rangeClass'>Range Class:</span>"
|
||||
+ (this.data.rangeVClass.length > 0 ? this.data.rangeVClass : "none" ) + "</td></tr>";
|
||||
|
||||
if ( this.children ) {
|
||||
var grandChildren = objectPropHierarchyUtils.getTheChildren(this);
|
||||
childDetails += grandChildren;
|
||||
}
|
||||
});
|
||||
childDetails += "</table></td></tr>";
|
||||
return childDetails;
|
||||
},
|
||||
|
||||
makeHeaderSpansClickable: function(ctr) {
|
||||
|
||||
var $clickableHeader = $('section#classContainer' + ctr).find('span.headerSpanPlus');
|
||||
|
||||
$clickableHeader.click(function() {
|
||||
if ( $clickableHeader.attr('view') == "less" ) {
|
||||
$clickableHeader.addClass("headerSpanMinus");
|
||||
$('table#classHierarchy' + ctr).find('span.subclassExpandPlus').addClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('table.subclassTable').show();
|
||||
$clickableHeader.attr('view', 'more' );
|
||||
}
|
||||
else {
|
||||
$clickableHeader.removeClass("headerSpanMinus");
|
||||
$('table#classHierarchy' + ctr).find('span.subclassExpandPlus').removeClass("subclassExpandMinus");
|
||||
$('table#classHierarchy' + ctr).find('table.subclassTable').hide();
|
||||
$clickableHeader.attr('view', 'less' );
|
||||
}
|
||||
});
|
||||
},// $('myOjbect').css('background-image', 'url(' + imageUrl + ')');
|
||||
|
||||
makeSubpropertySpansClickable: function() {
|
||||
$.each(objectPropHierarchyUtils.clickableSpans, function() {
|
||||
var currentSpan = this;
|
||||
var $clickableSpan = $('section#container').find('span#' + currentSpan);
|
||||
var $subclassTable = $('section#container').find('table#subclassTable' + currentSpan.replace("subclassExpand",""));
|
||||
|
||||
$clickableSpan.click(function() {
|
||||
if ( $subclassTable.is(':visible') ) {
|
||||
$subclassTable.hide();
|
||||
$subclassTable.find('table.subclassTable').hide();
|
||||
$subclassTable.find('span').removeClass("subclassExpandMinus");
|
||||
$clickableSpan.removeClass("subclassExpandMinus");
|
||||
}
|
||||
else {
|
||||
$subclassTable.show();
|
||||
$clickableSpan.addClass("subclassExpandMinus");
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
wireExpandLink: function() {
|
||||
this.expandAll.click(function() {
|
||||
if ( objectPropHierarchyUtils.expandAll.text() == "expand all" ) {
|
||||
objectPropHierarchyUtils.expandAll.text("collapse all");
|
||||
$('span.headerSpanPlus').addClass("headerSpanMinus");
|
||||
$('table.classHierarchy').find('span.subclassExpandPlus').addClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('table.subclassTable').show();
|
||||
$('section#container').find('span.headerSpanPlus').attr('view','more');
|
||||
}
|
||||
else {
|
||||
objectPropHierarchyUtils.expandAll.text("expand all");
|
||||
$('span.headerSpanPlus').removeClass("headerSpanMinus");
|
||||
$('table.classHierarchy').find('span.subclassExpandPlus').removeClass("subclassExpandMinus");
|
||||
$('table.classHierarchy').find('table.subclassTable').hide();
|
||||
$('section#container').find('span.headerSpanPlus').attr('view','less');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
buildAllPropsHtml: function() {
|
||||
|
||||
$.each(json, function() {
|
||||
$newClassSection = jQuery("<section></section>", {
|
||||
id: "classContainer" + objectPropHierarchyUtils.classCounter
|
||||
});
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<div>" + this.name + "</div>" + "<table class='classHierarchy' id='classHierarchy"
|
||||
+ objectPropHierarchyUtils.classCounter + "'>" ;
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Local Name:</td><td>"
|
||||
+ (this.data.internalName.length > 0 ? this.data.internalName : "none" ) + "</td></tr>";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Group:</td><td>"
|
||||
+ (this.data.group.length > 0 ? this.data.group : "unspecified" ) + "</td></tr>";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<tr><td class='classDetail'>Domain Class:</td><td>"
|
||||
+ (this.data.domainVClass.length > 0 ? this.data.domainVClass : "none" ) + " ";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "<span class='rangeClass'>Range Class:</span>"
|
||||
+ (this.data.rangeVClass.length > 0 ? this.data.rangeVClass : "none" ) + "</td></tr>";
|
||||
|
||||
objectPropHierarchyUtils.classHtml += "</table>";
|
||||
|
||||
$newClassSection.html(objectPropHierarchyUtils.classHtml);
|
||||
$newClassSection.appendTo($('section#container'));
|
||||
objectPropHierarchyUtils.classHtml = "";
|
||||
objectPropHierarchyUtils.classCounter += 1;
|
||||
});
|
||||
},
|
||||
|
||||
buildNoPropsHtml: function() {
|
||||
|
||||
$.each(json, function() {
|
||||
$newClassSection = jQuery("<section></section>", {
|
||||
id: "classContainer" + objectPropHierarchyUtils.classCounter
|
||||
});
|
||||
|
||||
objectPropHierarchyUtils.classHtml = "<h4>" + this.name + "</h4>";
|
||||
$newClassSection.html(objectPropHierarchyUtils.classHtml);
|
||||
$newClassSection.appendTo($('section#container'));
|
||||
objectPropHierarchyUtils.classHtml = "";
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue