From 101bd927c0fb7382f295b371475ed2e0337ccbc5 Mon Sep 17 00:00:00 2001 From: ZitRos Date: Sat, 30 Apr 2016 23:10:05 +0300 Subject: [PATCH] Links remove notification --- package.json | 2 +- web/css/interface.css | 7 +++++++ web/index.html | 1 + web/js/CacheClassExplorer.js | 20 ++++++++++++++++++++ web/js/ClassView.js | 8 ++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fd4f270..1e699bc 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "CacheClassExplorer", - "version": "1.16.2", + "version": "1.16.3", "description": "Class Explorer for InterSystems Caché", "directories": { "test": "test" diff --git a/web/css/interface.css b/web/css/interface.css index be5679f..663a0b5 100644 --- a/web/css/interface.css +++ b/web/css/interface.css @@ -71,6 +71,13 @@ html, body { text-shadow: 1px 1px 0 white, -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white; } +#subLabel { + position: absolute; + font-size: initial; + font-style: initial; + font-weight: initial; +} + .central { position: absolute; left: 0; diff --git a/web/index.html b/web/index.html index 9797807..7c40468 100755 --- a/web/index.html +++ b/web/index.html @@ -49,6 +49,7 @@
Welcome!
+
diff --git a/web/js/CacheClassExplorer.js b/web/js/CacheClassExplorer.js index da960cb..cf65b73 100755 --- a/web/js/CacheClassExplorer.js +++ b/web/js/CacheClassExplorer.js @@ -47,6 +47,7 @@ var CacheClassExplorer = function (treeViewContainer, classViewContainer) { settingsView: id("settingsView"), closeSettings: id("closeSettings"), helpView: id("helpView"), + subLabel: id("subLabel"), closeHelp: id("closeHelp"), settingsExtraText: id("settingsExtraText"), settings: { @@ -174,6 +175,25 @@ CacheClassExplorer.prototype.updateNamespace = function () { }; +/** + * Sets the subLabel on the diagram. + * @param {string} [text] + * @param {string} [style] + */ +CacheClassExplorer.prototype.setSubLabel = function (text, style) { + + if (!text) { + this.elements.subLabel.textContent = ""; + this.elements.subLabel.setAttribute("style", ""); + return; + } + + this.elements.subLabel.innerHTML = text; + if (style) + this.elements.subLabel.setAttribute("style", style); + +}; + CacheClassExplorer.prototype.updateURL = function () { var obj = { diff --git a/web/js/ClassView.js b/web/js/ClassView.js index af77c24..f84393f 100755 --- a/web/js/ClassView.js +++ b/web/js/ClassView.js @@ -749,6 +749,7 @@ ClassView.prototype.confirmRender = function (data) { // Don't ask me why. Just believe we need this peace of code. this.zoom(null); this.resetView(); + this.cacheClassExplorer.setSubLabel(); if (!data["classes"]) { console.error("Wrong data: no 'classes' property.", data); @@ -820,6 +821,13 @@ ClassView.prototype.confirmRender = function (data) { connector._toClass.instance = relFrom; } self.links.push(connector); + connector.on("all", function (e) { + if (e !== "remove") return; + self.cacheClassExplorer.setSubLabel( + "*Some links are removed on this diagram.", + "color:red" + ); + }); } } }