diff --git a/web/js/CacheClassExplorer.js b/web/js/CacheClassExplorer.js
index 7083327..60c1f15 100755
--- a/web/js/CacheClassExplorer.js
+++ b/web/js/CacheClassExplorer.js
@@ -50,6 +50,7 @@ var CacheClassExplorer = function (treeViewContainer, classViewContainer) {
subLabel: id("subLabel"),
closeHelp: id("closeHelp"),
settingsExtraText: id("settingsExtraText"),
+ showMappedCheckbox: id("showMappedCheckbox"),
settings: {
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram"),
showClassIcons: id("setting.showClassIcons"),
@@ -150,16 +151,10 @@ CacheClassExplorer.prototype.updateNamespaces = function (nsData) {
*/
CacheClassExplorer.prototype.setNamespace = function (namespace) {
- var self = this;
-
this.NAMESPACE = namespace;
this.classTree.setSelectedClassList([]);
- self.classTree.container.textContent = "";
- self.classTree.showLoader();
- this.source.getClassTree(function (err, data) {
- if (!err) self.classTree.updateTree(data);
- });
+ this.classTree.update();
this.updateNamespace();
this.updateURL();
@@ -269,9 +264,7 @@ CacheClassExplorer.prototype.init = function () {
restored = this.restoreFromURL();
this.classTree.showLoader();
- this.source.getClassTree(function (err, data) {
- if (!err) self.classTree.updateTree(data);
- });
+ this.classTree.init();
this.source.getNamespacesInfo(function (err, data) {
if (restored && restored.namespace) data.currentNamespace = restored.namespace;
if (!err) self.updateNamespaces(data);
diff --git a/web/js/ClassTree.js b/web/js/ClassTree.js
index 81edf70..877017c 100755
--- a/web/js/ClassTree.js
+++ b/web/js/ClassTree.js
@@ -15,6 +15,7 @@ var ClassTree = function (parent, treeViewContainer) {
this.SELECTED_TYPE = null; // "class" || "package"
this.SELECTED_ELEMENT = null;
this.SELECTED_LEVEL = null;
+ this.INCLUDE_MAPPED = this.cacheClassExplorer.elements.showMappedCheckbox.checked;
this.treeObject = null;
/**
* @private
@@ -25,6 +26,10 @@ var ClassTree = function (parent, treeViewContainer) {
this.cacheClassExplorer.elements.classTreeSearch.addEventListener("input", function (e) {
self.searchChanged.call(self, (e.target || e.srcElement).value);
});
+ this.cacheClassExplorer.elements.showMappedCheckbox.addEventListener("change", function () {
+ self.INCLUDE_MAPPED = self.cacheClassExplorer.elements.showMappedCheckbox.checked;
+ self.update();
+ });
window.addEventListener("resize", function () {
self.updateSizes();
@@ -34,6 +39,19 @@ var ClassTree = function (parent, treeViewContainer) {
};
+ClassTree.prototype.update = function () {
+
+ var self = this;
+
+ this.cacheClassExplorer.elements.classTreeSearch.value = "";
+ this.container.textContent = "";
+ this.showLoader();
+ this.cacheClassExplorer.source.getClassTree(this.INCLUDE_MAPPED, function (err, data) {
+ if (!err) self.updateTree(data);
+ });
+
+};
+
ClassTree.prototype.setSelectedClassList = function (list) {
// this enables saved view to be consistent for any class names order
@@ -70,7 +88,8 @@ ClassTree.prototype.removeLoader = function () {
if (!this.loader) return;
this.cacheClassExplorer.elements.classTreeSearch.value = "";
- this.loader.parentNode.removeChild(this.loader);
+ if (this.loader.parentNode)
+ this.loader.parentNode.removeChild(this.loader);
this.loader = null;
};
@@ -255,7 +274,7 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) {
arr = [];
for (i in object) {
- arr.push({ name: getRealName(i), val: object[i] });
+ arr.push({ name: getRealName(i), val: object[i], isPackage: i[0] === "/" });
}
arr.sort(function (a, b) {
@@ -268,7 +287,7 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) {
if (rec = append(
rootElement,
element.name,
- typeof element.val === "object",
+ element.isPackage,
path.join("."),
level
)) {
@@ -282,4 +301,8 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) {
if (!doNotChangeRoot) this.treeObject = treeObject;
+};
+
+ClassTree.prototype.init = function () {
+ this.update();
};
\ No newline at end of file
diff --git a/web/js/Source.js b/web/js/Source.js
index a0fc2f7..9f78e25 100755
--- a/web/js/Source.js
+++ b/web/js/Source.js
@@ -9,13 +9,15 @@ var Source = function (cacheUMLExplorer) {
/**
* Return class tree.
+ * @param {boolean} includeMapped
* @param {Source~dataCallback} callback
*/
-Source.prototype.getClassTree = function (callback) {
+Source.prototype.getClassTree = function (includeMapped, callback) {
lib.load(
this.URL + "/GetClassTree"
- + (this.cue.NAMESPACE ? "?namespace=" + encodeURIComponent(this.cue.NAMESPACE) : ""),
+ + (this.cue.NAMESPACE ? "?namespace=" + encodeURIComponent(this.cue.NAMESPACE) : "")
+ + "&mapped=" + (includeMapped ? "1" : "0"),
null,
callback
);