in the class groups list, added a link to hide/show the classes for each group

This commit is contained in:
tworrall 2012-07-05 14:31:40 +00:00
parent 6e6989d984
commit ae8319dd5a
2 changed files with 27 additions and 6 deletions

View file

@ -3,21 +3,21 @@
var classHierarchyUtils = { var classHierarchyUtils = {
onLoad: function(urlBase,displayOption) { onLoad: function(urlBase,displayOption) {
this.imagePath = urlBase + "/images/"; this.imagePath = urlBase + "/images/";
this.displayOption = displayOption;
this.initObjects(); this.initObjects();
this.expandAll.hide(); this.expandAll.hide();
if ( displayOption == "all" ) { if ( this.displayOption == "all" ) {
this.buildAllClassesHtml(); this.buildAllClassesHtml();
} }
else if ( displayOption == "group" ) { else if ( this.displayOption == "group" ) {
this.buildClassGroupHtml(); this.buildClassGroupHtml();
} }
else { else {
this.buildClassHierarchyHtml(); this.buildClassHierarchyHtml();
this.wireExpandLink(); this.wireExpandLink();
} }
if ( this.displayOption == "asserted" || this.displayOption == "inferred" || this.displayOption == "group") {
if ( displayOption == "asserted" || displayOption == "inferred" ) {
this.expandAll.show(); this.expandAll.show();
} }
this.bindEventListeners(); this.bindEventListeners();
@ -54,6 +54,23 @@
classHierarchyUtils.form.attr("action", "editForm?controller=Classgroup"); classHierarchyUtils.form.attr("action", "editForm?controller=Classgroup");
classHierarchyUtils.form.submit(); classHierarchyUtils.form.submit();
}); });
if ( this.displayOption == "group" ) {
this.expandAll.click(function() {
if ( classHierarchyUtils.expandAll.text() == "hide subclasses" ) {
$('td.subclassCell').parent('tr').hide();
$('table.innerDefinition').hide();
classHierarchyUtils.expandAll.text("show subclasses");
}
else {
$('td.subclassCell').parent('tr').show();
$('table.innerDefinition').show();
classHierarchyUtils.expandAll.text("hide subclasses");
}
});
}
}, },
buildClassHierarchyHtml: function() { buildClassHierarchyHtml: function() {
@ -97,6 +114,7 @@
classHierarchyUtils.classHtml = ""; classHierarchyUtils.classHtml = "";
classHierarchyUtils.classCounter += 1; classHierarchyUtils.classCounter += 1;
}); });
}, },
getTheChildren: function(node) { getTheChildren: function(node) {
@ -271,7 +289,6 @@
classHierarchyUtils.classHtml += descendants; classHierarchyUtils.classHtml += descendants;
classHierarchyUtils.classHtml += "</table>"; classHierarchyUtils.classHtml += "</table>";
// alert(classHierarchyUtils.classHtml);
$newClassSection.html(classHierarchyUtils.classHtml); $newClassSection.html(classHierarchyUtils.classHtml);
$newClassSection.appendTo($('section#container')); $newClassSection.appendTo($('section#container'));
classHierarchyUtils.classHtml = ""; classHierarchyUtils.classHtml = "";

View file

@ -21,7 +21,11 @@
</#if> </#if>
</form> </form>
<div id="expandLink"><span id="expandAll" ><a href="#" title="expand all">expand all</a></span></div> <#if displayOption == "group">
<div id="expandLink"><span id="expandAll" ><a href="javascript:" title="hide/show subclasses">hide subclasses</a></span></div>
<#else>
<div id="expandLink"><span id="expandAll" ><a href="#" title="expand all">expand all</a></span></div>
</#if>
<section id="container"> <section id="container">
</section> </section>