Skip to content

Commit 493a928

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 189f45c + c0a4a97 commit 493a928

File tree

6 files changed

+61
-27
lines changed

6 files changed

+61
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheUMLExplorer",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/css/settingsView.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
padding: 1em;
2626
z-index: 2;
2727
text-align: right;
28+
}
29+
30+
#settingsView table td {
31+
text-align: left;
2832
}

web/index.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,26 @@ <h2 id="methodLabel"></h2>
9292
<h1>
9393
Settings
9494
</h1>
95-
<label>
96-
<input id="setting.showDataTypesOnDiagram" type="checkbox"/>
97-
Show data types on diagram
98-
</label>
95+
<table>
96+
<tbody>
97+
<tr>
98+
<td><input id="setting.showDataTypesOnDiagram" type="checkbox"/></td>
99+
<td><label for="setting.showDataTypesOnDiagram">Show Data Types</label></td>
100+
</tr>
101+
<tr>
102+
<td><input id="setting.showParameters" type="checkbox"/></td>
103+
<td><label for="setting.showParameters">Show Parameters</label></td>
104+
</tr>
105+
<tr>
106+
<td><input id="setting.showProperties" type="checkbox"/></td>
107+
<td><label for="setting.showProperties">Show Properties</label></td>
108+
</tr>
109+
<tr>
110+
<td><input id="setting.showMethods" type="checkbox"/></td>
111+
<td><label for="setting.showMethods">Show Methods</label></td>
112+
</tr>
113+
</tbody>
114+
</table>
99115
</div>
100116
</div>
101117
</div>

web/js/CacheUMLExplorer.js

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,24 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
3838
settingsView: id("settingsView"),
3939
closeSettings: id("closeSettings"),
4040
settings: {
41-
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram")
41+
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram"),
42+
showParameters: id("setting.showParameters"),
43+
showProperties: id("setting.showProperties"),
44+
showMethods: id("setting.showMethods")
4245
}
4346
};
4447

48+
var settingsValue = function (name, defaultVal) {
49+
return localStorage.getItem(name) === null ? (defaultVal || false)
50+
: localStorage.getItem(name) === "true"
51+
};
52+
53+
// note: this.elements is required to be modified with the same name as settings keys
4554
this.settings = {
46-
showDataTypesOnDiagram:
47-
localStorage.getItem("showDataTypesOnDiagram") === null ? false :
48-
localStorage.getItem("showDataTypesOnDiagram") === "true"
55+
showDataTypesOnDiagram: settingsValue("showDataTypesOnDiagram"),
56+
showParameters: settingsValue("showParameters", true),
57+
showProperties: settingsValue("showProperties", true),
58+
showMethods: settingsValue("showMethods", true)
4959
};
5060

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

6474
var self = this;
6575

66-
this.elements.settings.showDataTypesOnDiagram.checked = this.settings.showDataTypesOnDiagram;
67-
this.elements.settings.showDataTypesOnDiagram.addEventListener("change", function (e) {
68-
localStorage.setItem(
69-
"showDataTypesOnDiagram",
70-
self.settings.showDataTypesOnDiagram = (e.target || e.srcElement).checked
71-
);
72-
});
76+
for (var st in this.elements.settings) {
77+
this.elements.settings[st].checked = this.settings[st];
78+
this.elements.settings[st].addEventListener("change", (function (st) {
79+
return function (e) {
80+
localStorage.setItem(
81+
st,
82+
self.settings[st] = (e.target || e.srcElement).checked
83+
);
84+
};
85+
})(st));
86+
}
7387

7488
};
7589

web/js/Logic.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var Logic = function (parent) {
22

3-
this.cacheUMLExplorer = parent;
3+
this.umlExplorer = parent;
44

55
};
66

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

17-
console.log("before", JSON.parse(JSON.stringify(data)));
18-
1917
this.data = data;
2018

2119
data.classes["%Persistent"] = data.classes["%Library.Persistent"] = {
@@ -34,12 +32,17 @@ Logic.prototype.process = function (data) {
3432
if (!this.data.inheritance) this.data.inheritance = {};
3533
for (clsName in data.classes) {
3634
cls = data.classes[clsName];
37-
if (cls.super) cls.super.split(",").forEach(function (name) { self.inherits(clsName, name); });
35+
if (cls.super) cls.super.split(",").forEach(function (name) {
36+
self.inherits(clsName, name);
37+
});
38+
if (cls.parameters && !this.umlExplorer.settings.showParameters) delete cls.parameters;
39+
if (cls.properties && !this.umlExplorer.settings.showProperties) delete cls.properties;
40+
if (cls.methods && !this.umlExplorer.settings.showMethods) delete cls.methods;
3841
}
3942

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

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

59-
console.log("after", JSON.parse(JSON.stringify(data)));
60-
6162
};
6263

6364
Logic.prototype.fillAssociations = function () {

web/jsLib/joint.shapes.uml.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,10 @@ joint.shapes.uml.Association = joint.dia.Link.extend({
321321
type: 'uml.Association',
322322
attrs: {
323323
'.marker-target': {
324-
d: 'M 15 0 L 0 8 L 15 15',
325-
fill: 'none',
326-
'stroke-dasharray': '3,3'
324+
d: 'M 15 0 L 0 7.5 L 15 15 M 0 7.5 L 15 7.5',
325+
fill: 'none'
327326
},
328-
'.connection': { 'stroke-dasharray': '3,3' }
327+
'.connection': { stroke: "gray" }
329328
}
330329
}
331330
});

0 commit comments

Comments
 (0)