From 75c93f38555e3865a26362911043f52a577c2ea0 Mon Sep 17 00:00:00 2001 From: ZitRo Date: Wed, 29 Apr 2015 18:02:06 +0300 Subject: [PATCH 1/2] fixed docs opening issues, missed line in previous commit --- cache/projectTemplate.xml | 5 +++-- package.json | 2 +- web/jsLib/joint.js | 6 +++--- web/jsLib/joint.shapes.uml.js | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cache/projectTemplate.xml b/cache/projectTemplate.xml index 53bb53c..26f94b0 100644 --- a/cache/projectTemplate.xml +++ b/cache/projectTemplate.xml @@ -3,7 +3,7 @@ Class contains methods that return structured class data. -63670,72515.130814 +63671,64479.682329 63653,67019.989197 @@ -60,6 +60,7 @@ return structured data about class set oProperties = ##class(%ZEN.proxyObject).%New() set oClass.NAMESPACE = $NAMESPACE + set oClass.ABSTRACT = classDefinition.Abstract set oClass.super = classDefinition.Super set oClass.properties = oProperties set count = classDefinition.Properties.Count() @@ -220,7 +221,7 @@ return structured data about class - + diff --git a/package.json b/package.json index 393c029..5e0fa69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "CacheUMLExplorer", - "version": "0.5.0", + "version": "0.5.1", "description": "An UML Class explorer for InterSystems Caché", "directories": { "test": "test" diff --git a/web/jsLib/joint.js b/web/jsLib/joint.js index 9e8085c..40cba43 100644 --- a/web/jsLib/joint.js +++ b/web/jsLib/joint.js @@ -17222,9 +17222,9 @@ if ( typeof window === "object" && typeof window.document === "object" ) { tspan.node.style[j] = setup["STYLES"][j]; } } - if (opt.clickHandler) { - tspan.node.onclick = opt.clickHandler; - } + } + if (opt.clickHandler) { + tspan.node.onclick = opt.clickHandler; } // Make sure the textContent is never empty. If it is, add an additional // space (an invisible character) so that following lines are correctly diff --git a/web/jsLib/joint.shapes.uml.js b/web/jsLib/joint.shapes.uml.js index 2be2234..d4cec50 100644 --- a/web/jsLib/joint.shapes.uml.js +++ b/web/jsLib/joint.shapes.uml.js @@ -103,7 +103,9 @@ joint.shapes.uml.Class = joint.shapes.basic.Generic.extend({ attrs['.uml-class-' + rect.type + '-text'].text = lines.join('\n'); if (nameClickHandler) { - if (rect.type === "name") attrs['.uml-class-' + rect.type + '-text'].clickHandler = nameClickHandler; + if (rect.type === "name") { + attrs['.uml-class-' + rect.type + '-text'].clickHandler = nameClickHandler; + } } attrs['.uml-class-' + rect.type + '-rect'].height = rectHeight; attrs['.uml-class-' + rect.type + '-rect'].transform = 'translate(0,'+ offsetY + ')'; From 0bcac398d8ddf432e5cf792977c253e0a38707d1 Mon Sep 17 00:00:00 2001 From: ZitRo Date: Wed, 29 Apr 2015 20:01:48 +0300 Subject: [PATCH 2/2] fixes, build version, UI info --- README.md | 4 +-- gulpfile.js | 5 +++- package.json | 4 +-- web/css/extras.css | 22 +++++++++++++++ web/css/interface.css | 35 ++++++++++++++++++++++++ web/index.html | 8 ++++-- web/js/CacheUMLExplorer.js | 26 +++++++++++++++--- web/js/UI.js | 56 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 web/js/UI.js diff --git a/README.md b/README.md index 0967e6e..cbe629d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # CacheUMLExplorer -An UML Class explorer for InterSystems Caché. It can build UML class diagram for any class or even for whole package in Caché. +An UML Class explorer for InterSystems Caché. It is able to build UML class diagram for any class or even for whole package in Caché. ## Screenshots -![2015-04-21_214058](https://cloud.githubusercontent.com/assets/4989256/7260103/6c1e2a20-e870-11e4-8bf0-9832885be9ab.png) +![2015-04-21_214058](https://cloud.githubusercontent.com/assets/4989256/7396518/65ba1924-eeaa-11e4-808b-5f648c0011e4.png) ## Installation diff --git a/gulpfile.js b/gulpfile.js index 44c7ac8..7fb7571 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -60,7 +60,10 @@ gulp.task("gatherLibs", ["clean"], function () { gulp.task("gatherScripts", ["clean", "gatherLibs"], function () { return gulp.src("web/js/*.js") .pipe(concat("CacheUMLExplorer.js")) - .pipe(replace(/[^\s]+\/\*build.replace:(.*)\*\//g, "$1")) + .pipe(replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) { + var s = match.toString(); + return s.replace(/pkg\.([a-zA-Z]+)/g, function (p,a) { return pkg[a]; }); + })) .pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());")) .pipe(uglify({ output: { diff --git a/package.json b/package.json index 5e0fa69..bbb2db7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "CacheUMLExplorer", - "version": "0.5.1", + "version": "0.5.2", "description": "An UML Class explorer for InterSystems Caché", "directories": { "test": "test" @@ -18,7 +18,7 @@ "gulp-minify-css": "^0.3.11", "gulp-postcss": "^5.1.3", "gulp-rename": "^1.2.0", - "gulp-replace": "^0.5.0", + "gulp-replace": "^0.5.3", "gulp-strip-comments": "^1.0.1", "gulp-uglify": "^1.2.0", "gulp-wrap": "^0.5.0", diff --git a/web/css/extras.css b/web/css/extras.css index 0921c8f..8d33901 100644 --- a/web/css/extras.css +++ b/web/css/extras.css @@ -140,6 +140,28 @@ left: 9px; } +.icon.info:after { + content: ""; + background-color: #fff; + width: 4px; + height: 10px; + border-radius: 1px; + position: absolute; + top: 10px; + left: 10px; +} + +.icon.info:before { + content: ""; + background-color: #fff; + width: 4px; + height: 4px; + border-radius: 2px; + position: absolute; + top: 4px; + left: 10px; +} + .icon.scaleNormal:after { content: "1:1"; position: absolute; diff --git a/web/css/interface.css b/web/css/interface.css index 4076ceb..7e390b9 100644 --- a/web/css/interface.css +++ b/web/css/interface.css @@ -48,6 +48,41 @@ html, body { padding: .5em; } +.ui-topRightToolBar { + position: absolute; + top: 0; + right: 0; + padding: .5em; +} + #className { text-shadow: 1px 1px 0 white, -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white; +} + +.central { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + display: table; +} + +.central > div { + display: table-cell; + vertical-align: middle; + text-align: center; +} + +.central > div > div { + display: inline-block; +} + +.message { + font-size: 14pt; + background: rgba(245, 245, 245, 0.9); + -webkit-transition: all .2s ease; + -moz-transition: all .2s ease; + -o-transition: all .2s ease; + transition: all .2s ease; } \ No newline at end of file diff --git a/web/index.html b/web/index.html index af5d99f..f296930 100644 --- a/web/index.html +++ b/web/index.html @@ -20,10 +20,11 @@ + -
+
@@ -31,7 +32,10 @@
- + Welcome! +
+
+
diff --git a/web/js/CacheUMLExplorer.js b/web/js/CacheUMLExplorer.js index ffcf0d8..9ea06a6 100644 --- a/web/js/CacheUMLExplorer.js +++ b/web/js/CacheUMLExplorer.js @@ -8,15 +8,20 @@ */ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) { + var id = function (e) { return document.getElementById(e); }; + this.elements = { - className: document.getElementById("className"), + uiBody: id("ui-body"), + className: id("className"), treeViewContainer: treeViewContainer, classViewContainer: classViewContainer, - zoomInButton: document.getElementById("button.zoomIn"), - zoomOutButton: document.getElementById("button.zoomOut"), - zoomNormalButton: document.getElementById("button.zoomNormal") + zoomInButton: id("button.zoomIn"), + zoomOutButton: id("button.zoomOut"), + zoomNormalButton: id("button.zoomNormal"), + infoButton: id("button.showInfo") }; + this.UI = new UI(this); this.source = new Source(); this.classTree = new ClassTree(this, treeViewContainer); this.classView = new ClassView(this, classViewContainer); @@ -43,6 +48,19 @@ CacheUMLExplorer.prototype.init = function () { } } + this.elements.infoButton.addEventListener("click", function () { + self.UI.displayMessage( + "Caché UML explorer v" + + "[NOT-BUILT]"/*build.replace:"pkg.version"*/ + + "
for InterSystems Caché" + + "
By Nikita Savchenko" + + "
" + + "Project page / Bug tracker" + + "

Enjoy!" + ); + }); + enableSVGDownload(this.classTree); }; \ No newline at end of file diff --git a/web/js/UI.js b/web/js/UI.js new file mode 100644 index 0000000..42f9916 --- /dev/null +++ b/web/js/UI.js @@ -0,0 +1,56 @@ +/** + * User interface functions. + * @param {CacheUMLExplorer} cacheUMLExplorer + * @constructor + */ +var UI = function (cacheUMLExplorer) { + + this.cacheUMLExplorer = cacheUMLExplorer; + this.BODY = cacheUMLExplorer.elements.uiBody; + + /** + * @type {HTMLElement} + * @private + */ + this.messageElement = null; + +}; + +/** + * Display hovering message. + * + * @param {string} text + * @param {boolean} [removeByClick] - Define whether user be able to remove message by clicking on + * it. + */ +UI.prototype.displayMessage = function (text, removeByClick) { + + this.removeMessage(); + + var self = this, + d1 = document.createElement("div"), + d2 = document.createElement("div"), + d3 = document.createElement("div"); + + d1.className = "central message"; + d1.style.opacity = 0; + d3.innerHTML = text; + d2.appendChild(d3); + d1.appendChild(d2); + this.BODY.appendChild(d1); + this.messageElement = d1; + setTimeout(function () { if (d1) d1.style.opacity = 1; }, 25); + if (removeByClick === undefined || removeByClick) d1.addEventListener("click", function () { + self.removeMessage(); + }); + +}; + +UI.prototype.removeMessage = function () { + + if (this.messageElement) { + this.messageElement.parentNode.removeChild(this.messageElement); + this.messageElement = null; + } + +}; \ No newline at end of file