Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Sep 21, 2015
2 parents 189f45c + c0a4a97 commit 493a928
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CacheUMLExplorer",
"version": "1.1.0",
"version": "1.2.0",
"description": "An UML Class explorer for InterSystems Caché",
"directories": {
"test": "test"
Expand Down
4 changes: 4 additions & 0 deletions web/css/settingsView.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
padding: 1em;
z-index: 2;
text-align: right;
}

#settingsView table td {
text-align: left;
}
24 changes: 20 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,26 @@ <h2 id="methodLabel"></h2>
<h1>
Settings
</h1>
<label>
<input id="setting.showDataTypesOnDiagram" type="checkbox"/>
Show data types on diagram
</label>
<table>
<tbody>
<tr>
<td><input id="setting.showDataTypesOnDiagram" type="checkbox"/></td>
<td><label for="setting.showDataTypesOnDiagram">Show Data Types</label></td>
</tr>
<tr>
<td><input id="setting.showParameters" type="checkbox"/></td>
<td><label for="setting.showParameters">Show Parameters</label></td>
</tr>
<tr>
<td><input id="setting.showProperties" type="checkbox"/></td>
<td><label for="setting.showProperties">Show Properties</label></td>
</tr>
<tr>
<td><input id="setting.showMethods" type="checkbox"/></td>
<td><label for="setting.showMethods">Show Methods</label></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Expand Down
36 changes: 25 additions & 11 deletions web/js/CacheUMLExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,24 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
settingsView: id("settingsView"),
closeSettings: id("closeSettings"),
settings: {
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram")
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram"),
showParameters: id("setting.showParameters"),
showProperties: id("setting.showProperties"),
showMethods: id("setting.showMethods")
}
};

var settingsValue = function (name, defaultVal) {
return localStorage.getItem(name) === null ? (defaultVal || false)
: localStorage.getItem(name) === "true"
};

// note: this.elements is required to be modified with the same name as settings keys
this.settings = {
showDataTypesOnDiagram:
localStorage.getItem("showDataTypesOnDiagram") === null ? false :
localStorage.getItem("showDataTypesOnDiagram") === "true"
showDataTypesOnDiagram: settingsValue("showDataTypesOnDiagram"),
showParameters: settingsValue("showParameters", true),
showProperties: settingsValue("showProperties", true),
showMethods: settingsValue("showMethods", true)
};

this.UI = new UI(this);
Expand All @@ -63,13 +73,17 @@ CacheUMLExplorer.prototype.initSettings = function () {

var self = this;

this.elements.settings.showDataTypesOnDiagram.checked = this.settings.showDataTypesOnDiagram;
this.elements.settings.showDataTypesOnDiagram.addEventListener("change", function (e) {
localStorage.setItem(
"showDataTypesOnDiagram",
self.settings.showDataTypesOnDiagram = (e.target || e.srcElement).checked
);
});
for (var st in this.elements.settings) {
this.elements.settings[st].checked = this.settings[st];
this.elements.settings[st].addEventListener("change", (function (st) {
return function (e) {
localStorage.setItem(
st,
self.settings[st] = (e.target || e.srcElement).checked
);
};
})(st));
}

};

Expand Down
15 changes: 8 additions & 7 deletions web/js/Logic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Logic = function (parent) {

this.cacheUMLExplorer = parent;
this.umlExplorer = parent;

};

Expand All @@ -14,8 +14,6 @@ Logic.prototype.process = function (data) {
var self = this,
cls, clsName;

console.log("before", JSON.parse(JSON.stringify(data)));

this.data = data;

data.classes["%Persistent"] = data.classes["%Library.Persistent"] = {
Expand All @@ -34,12 +32,17 @@ Logic.prototype.process = function (data) {
if (!this.data.inheritance) this.data.inheritance = {};
for (clsName in data.classes) {
cls = data.classes[clsName];
if (cls.super) cls.super.split(",").forEach(function (name) { self.inherits(clsName, name); });
if (cls.super) cls.super.split(",").forEach(function (name) {
self.inherits(clsName, name);
});
if (cls.parameters && !this.umlExplorer.settings.showParameters) delete cls.parameters;
if (cls.properties && !this.umlExplorer.settings.showProperties) delete cls.properties;
if (cls.methods && !this.umlExplorer.settings.showMethods) delete cls.methods;
}

this.alignClassTypes(); // call after inheritance scheme done

if (!this.cacheUMLExplorer.settings.showDataTypesOnDiagram) {
if (!this.umlExplorer.settings.showDataTypesOnDiagram) {
for (clsName in data.classes) {
if (/%Library\..*/.test(clsName)) delete data.classes[clsName];
}
Expand All @@ -56,8 +59,6 @@ Logic.prototype.process = function (data) {
delete data.classes["%Library.DataType"];
delete data.classes["%DataType"];

console.log("after", JSON.parse(JSON.stringify(data)));

};

Logic.prototype.fillAssociations = function () {
Expand Down
7 changes: 3 additions & 4 deletions web/jsLib/joint.shapes.uml.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,10 @@ joint.shapes.uml.Association = joint.dia.Link.extend({
type: 'uml.Association',
attrs: {
'.marker-target': {
d: 'M 15 0 L 0 8 L 15 15',
fill: 'none',
'stroke-dasharray': '3,3'
d: 'M 15 0 L 0 7.5 L 15 15 M 0 7.5 L 15 7.5',
fill: 'none'
},
'.connection': { 'stroke-dasharray': '3,3' }
'.connection': { stroke: "gray" }
}
}
});
Expand Down

0 comments on commit 493a928

Please sign in to comment.