Skip to content

Commit 955f2a7

Browse files
hide data types from diagram option, options add
1 parent cc1dc94 commit 955f2a7

File tree

8 files changed

+128
-11
lines changed

8 files changed

+128
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ An UML Class explorer for InterSystems Caché.
1313

1414
## Screenshots
1515

16-
![Demo](https://cloud.githubusercontent.com/assets/4989256/7968221/00d348b0-0a38-11e5-81af-89c547655c12.png)
16+
![Demo](https://cloud.githubusercontent.com/assets/4989256/7972419/ec9ef408-0a54-11e5-96a1-8ef70e24a168.png)
1717

1818
## Installation
1919

2020
To install latest Caché UML Explorer, you just need to import UMLExplorer package. Download the
2121
archive from [latest releases](https://github.com/ZitRos/CacheUMLExplorer/releases), and then import
2222
<code>Cache/CacheUMLExplorer-vX.X.X.xml</code> file.
2323

24-
###### Web application
24+
###### Web applicationgulp
2525
Note that importing UMLExplorer.WebAppInstaller class will also create a /UMLExplorer application.
2626
If you want to create WEB application manually, please, do not import this class. Anyway, <b>
2727
importing this class requires %SYS permission.</b>

cache/projectTemplate.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>
55
Cache UML Explorer vX.X.X/*build.replace:pkg.version*/
66
Class contains methods that return structured classes/packages data.</Description>
7-
<TimeChanged>63697,66596.619226</TimeChanged>
7+
<TimeChanged>63706,86042.410811</TimeChanged>
88
<TimeCreated>63653,67019.989197</TimeCreated>
99

1010
<Method name="getAllNamespacesList">
@@ -102,6 +102,7 @@ Return structured data about class.</Description>
102102
set oClass.HIDDEN = classDefinition.Hidden
103103
set oClass.classType = classDefinition.ClassType
104104
set oClass.serverOnly = classDefinition.ServerOnly // -
105+
set oClass.isDataType = classDefinition.ClientDataTypeIsDefined()
105106
106107
if (oData.restrictPackage) && ('..inPackage(oData.basePackageName, package)) quit oClass
107108

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": "0.14.0",
3+
"version": "0.15.0",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/css/extras.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@
8484
box-shadow: 0 0 5px 2px #ffcc1b;
8585
}
8686

87+
.icon.gear:before {
88+
content: "";
89+
display: block;
90+
position: absolute;
91+
left: 3px;
92+
top: 3px;
93+
width: 12px;
94+
height: 12px;
95+
border-radius: 12px;
96+
border: 3px white dotted;
97+
}
98+
99+
.icon.gear:after {
100+
content: "";
101+
display: block;
102+
position: absolute;
103+
left: 7px;
104+
top: 7px;
105+
width: 6px;
106+
height: 6px;
107+
box-shadow: 0 0 0 2px white, 0 0 0 2px white inset;
108+
border-radius: 12px;
109+
border: 2px solid transparent;
110+
}
111+
87112
.icon.search:after {
88113
content: "";
89114
position: absolute;

web/css/settingsView.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#settingsView {
2+
position: absolute;
3+
width: 100%;
4+
bottom: 0;
5+
height: 0;
6+
background: rgba(245, 245, 245, 0.95);
7+
z-index: 10;
8+
-webkit-transition: all .5s ease;
9+
-moz-transition: all .5s ease;
10+
-o-transition: all .5s ease;
11+
transition: all .5s ease;
12+
}
13+
14+
#settingsView.active {
15+
box-shadow: 0 0 5px black;
16+
height: 100%;
17+
}
18+
19+
#settingsView > div.head {
20+
position: absolute;
21+
width: 100%;
22+
box-sizing: border-box;
23+
top: 0;
24+
left: 0;
25+
padding: 1em;
26+
z-index: 2;
27+
text-align: right;
28+
}

web/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<link rel="stylesheet" href="css/classView.css"/>
1212
<link rel="stylesheet" href="css/joint.min.css"/>
1313
<link rel="stylesheet" href="css/methodCodeView.css"/>
14+
<link rel="stylesheet" href="css/settingsView.css"/>
1415
<!-- endbuild -->
1516
<!-- build:js -->
1617
<script type="text/javascript" src="jsLib/joint.js"></script>
@@ -43,6 +44,7 @@
4344
<div class="ui-topRightToolBar">
4445
<div id="button.showInfo" class="icon info"></div>
4546
<div id="button.showHelp" class="icon help"></div>
47+
<div id="button.showSettings" class="icon gear"></div>
4648
<select id="namespaces" class="icon select">
4749
<option value="Loading..." selected>Loading...</option>
4850
</select>
@@ -79,6 +81,24 @@ <h2 id="methodLabel"></h2>
7981
</div>
8082
</div>
8183
</div>
84+
<div id="settingsView">
85+
<div class="head">
86+
<div id="closeSettings" class="icon cross"></div>
87+
</div>
88+
<div class="central">
89+
<div>
90+
<div>
91+
<h1>
92+
Settings
93+
</h1>
94+
<label>
95+
<input id="setting.showDataTypesOnDiagram" type="checkbox"/>
96+
Show data types on diagram
97+
</label>
98+
</div>
99+
</div>
100+
</div>
101+
</div>
82102
</div>
83103
</body>
84104
</html>

web/js/CacheUMLExplorer.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
1919
zoomInButton: id("button.zoomIn"),
2020
zoomOutButton: id("button.zoomOut"),
2121
zoomNormalButton: id("button.zoomNormal"),
22+
showSettingsButton: id("button.showSettings"),
2223
helpButton: id("button.showHelp"),
2324
infoButton: id("button.showInfo"),
2425
methodCodeView: id("methodCodeView"),
@@ -33,7 +34,18 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
3334
classTreeSearch: id("classTreeSearch"),
3435
searchBlock: id("searchBlock"),
3536
diagramSearch: id("diagramSearch"),
36-
diagramSearchButton: id("button.diagramSearch")
37+
diagramSearchButton: id("button.diagramSearch"),
38+
settingsView: id("settingsView"),
39+
closeSettings: id("closeSettings"),
40+
settings: {
41+
showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram")
42+
}
43+
};
44+
45+
this.settings = {
46+
showDataTypesOnDiagram:
47+
localStorage.getItem("showDataTypesOnDiagram") === null ? false :
48+
localStorage.getItem("showDataTypesOnDiagram") === "true"
3749
};
3850

3951
this.UI = new UI(this);
@@ -42,10 +54,25 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
4254
this.classView = new ClassView(this, classViewContainer);
4355
this.NAMESPACE = null;
4456

57+
this.initSettings();
4558
this.init();
4659

4760
};
4861

62+
CacheUMLExplorer.prototype.initSettings = function () {
63+
64+
var self = this;
65+
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+
});
73+
74+
};
75+
4976
/**
5077
* Render namespaces.
5178
* @param nsData
@@ -153,6 +180,12 @@ CacheUMLExplorer.prototype.init = function () {
153180
self.setNamespace(ns);
154181
}
155182
});
183+
this.elements.showSettingsButton.addEventListener("click", function () {
184+
self.elements.settingsView.classList.add("active");
185+
});
186+
this.elements.closeSettings.addEventListener("click", function () {
187+
self.elements.settingsView.classList.remove("active");
188+
});
156189

157190
enableSVGDownload(this.classTree);
158191

web/js/ClassView.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ ClassView.prototype.filterInherits = function (data) {
230230

231231
if (!data || !data.inheritance) return;
232232

233-
var p1, p2, filter = {
233+
var p1, p2, toFilter = ["inheritance", "composition", "aggregation"], filter = {
234234
"%Library.Persistent": true,
235235
"%Persistent": true,
236236
"%Library.SerialObject": true,
@@ -241,14 +241,24 @@ ClassView.prototype.filterInherits = function (data) {
241241
"%DataType": true
242242
};
243243

244-
for (p1 in data.inheritance) { // classes
245-
for (p2 in data.inheritance[p1]) { // inherits
246-
if (filter.hasOwnProperty(p2)) delete data.inheritance[p1][p2];
244+
var f = function (p) {
245+
return filter.hasOwnProperty(p) || (data.classes[p] || {})["isDataType"] ||
246+
lib.obj(((data.classes[p] || {}).super || "").split(",")).hasOwnProperty("%DataType");
247+
};
248+
249+
if (this.cacheUMLExplorer.settings.showDataTypesOnDiagram)
250+
return;
251+
252+
toFilter.forEach(function (p) {
253+
for (p1 in data[p]) { // classes
254+
for (p2 in data[p][p1]) { // inherits
255+
if (f(p2)) delete data[p][p1][p2];
256+
}
247257
}
248-
}
258+
});
249259

250260
for (p1 in data.classes) {
251-
if (filter.hasOwnProperty(p1)) delete data.classes[p1];
261+
if (f(p1)) delete data.classes[p1];
252262
}
253263

254264
};

0 commit comments

Comments
 (0)