Skip to content

Commit bfb8e40

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 5537b1c + be5be22 commit bfb8e40

13 files changed

+284
-36
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ An UML Class explorer for InterSystems Caché.
66
+ Build diagrams for any package or subpackage;
77
+ Edit diagrams after build;
88
+ Export diagrams as an image;
9+
+ View class methods code;
910
+ Zoom in and out, explore big packages and more.
1011

1112
## Screenshots
1213

13-
![Demo](https://cloud.githubusercontent.com/assets/4989256/7586381/19008d24-f8b5-11e4-8893-a63d5373dfa1.png)
14+
![Demo](https://cloud.githubusercontent.com/assets/4989256/7622499/9cb98048-f9d8-11e4-9c27-4257e53ec70d.png)
1415

1516
## Installation
1617

cache/projectTemplate.xml

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Class name="UMLExplorer.ClassView">
44
<Description>
55
Class contains methods that return structured classes/packages data.</Description>
6-
<TimeChanged>63684,52343.305666</TimeChanged>
6+
<TimeChanged>63686,4398.893381</TimeChanged>
77
<TimeCreated>63653,67019.989197</TimeCreated>
88

99
<Method name="getClassTree">
@@ -70,38 +70,49 @@ Return structured data about class.</Description>
7070
set oClass.FINAL = classDefinition.Final
7171
set oClass.HIDDEN = classDefinition.Hidden
7272
set oClass.classType = classDefinition.ClassType
73+
set oClass.serverOnly = classDefinition.ServerOnly // -
7374
7475
if (oData.restrictPackage) && ('..inPackage(oData.basePackageName, package)) quit oClass
7576
7677
set oClass.properties = oProperties
7778
set count = classDefinition.Properties.Count()
78-
for i = 1:1:count {
79+
for i=1:1:count {
7980
set oProp = ##class(%ZEN.proxyObject).%New()
8081
set p = classDefinition.Properties.GetAt(i)
8182
do oProperties.%DispatchSetProperty(p.Name, oProp)
82-
do oProp.%DispatchSetProperty("private", p.Private)
83-
do oProp.%DispatchSetProperty("readOnly", p.ReadOnly)
84-
do oProp.%DispatchSetProperty("type", p.Type)
83+
set oProp.private = p.Private
84+
set oProp.readOnly = p.ReadOnly
85+
set oProp.type = p.Type
8586
do ..collectAggregation(oData, classDefinition, p.Type, p.Private)
8687
do ..collectAggregation(oData, classDefinition, package _ "." _ p.Type, p.Private)
8788
}
8889
8990
set oMethods = ##class(%ZEN.proxyObject).%New()
9091
set oClass.methods = oMethods
9192
set count = classDefinition.Methods.Count()
92-
for i = 1:1:count {
93+
for i=1:1:count {
9394
set oMeth = ##class(%ZEN.proxyObject).%New()
9495
set met = classDefinition.Methods.GetAt(i)
9596
do oMethods.%DispatchSetProperty(met.Name, oMeth)
96-
do oMeth.%DispatchSetProperty("private", met.Private)
97-
do oMeth.%DispatchSetProperty("returns", met.ReturnType)
98-
do oMeth.%DispatchSetProperty("classMethod", met.ClassMethod)
97+
set oMeth.private = met.Private
98+
set oMeth.returns = met.ReturnType
99+
set oMeth.classMethod = met.ClassMethod
100+
set oMeth.clientMethod = met.ClientMethod
101+
set oMeth.final = met.Final
102+
set oMeth.abstract = met.Abstract
103+
set oMeth.language = met.Language
104+
set oMeth.notInheritable = met.NotInheritable
105+
set oMeth.serverOnly = met.ServerOnly
106+
set oMeth.sqlProc = met.SqlProc
107+
set oMeth.sqlName = met.SqlName
108+
set oMeth.webMethod = met.WebMethod
109+
set oMeth.zenMethod = met.ZenMethod
99110
}
100111
101112
set oParameters = ##class(%ZEN.proxyObject).%New()
102113
set oClass.parameters = oParameters
103114
set count = classDefinition.Parameters.Count()
104-
for i = 1:1:count {
115+
for i=1:1:count {
105116
set oPar = ##class(%ZEN.proxyObject).%New()
106117
set p = classDefinition.Parameters.GetAt(i)
107118
do oParameters.%DispatchSetProperty(p.Name, oPar)
@@ -114,6 +125,30 @@ Return structured data about class.</Description>
114125
]]></Implementation>
115126
</Method>
116127

128+
<Method name="getMethod">
129+
<Description>
130+
Return method data.</Description>
131+
<ClassMethod>1</ClassMethod>
132+
<FormalSpec>className:%String,methodName:%String</FormalSpec>
133+
<ReturnType>%ZEN.proxyObject</ReturnType>
134+
<Implementation><![CDATA[
135+
set oMeth = ##class(%ZEN.proxyObject).%New()
136+
set met = ##class(%Dictionary.MethodDefinition).%OpenId(className _ "||" _ methodName)
137+
if (met = "") { set oMeth.error = 1 quit oMeth }
138+
139+
set oMeth.description = met.Description
140+
set oMeth.arguments = met.FormalSpec
141+
set oMeth.returns = met.ReturnType
142+
set oMeth.code = ""
143+
do {
144+
set chars = met.Implementation.Read()
145+
set oMeth.code = oMeth.code _ chars
146+
} while (chars)
147+
148+
quit oMeth
149+
]]></Implementation>
150+
</Method>
151+
117152
<Method name="inPackage">
118153
<Description><![CDATA[
119154
Returns if <var>packageName</var> is in <var>basePackageName</var>.]]></Description>
@@ -280,7 +315,7 @@ Returns structured package data</Description>
280315
<Description>
281316
REST interface for UMLExplorer</Description>
282317
<Super>%CSP.REST</Super>
283-
<TimeChanged>63679,81701.423669</TimeChanged>
318+
<TimeChanged>63685,85586.177035</TimeChanged>
284319
<TimeCreated>63648,30450.187229</TimeCreated>
285320

286321
<XData name="UrlMap">
@@ -294,6 +329,7 @@ REST interface for UMLExplorer</Description>
294329
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
295330
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
296331
<Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
332+
<Route Url="/GetMethod/:ClassName/:MethodName" Method="GET" Call="GetMethod"/>
297333
</Routes>
298334
]]></Data>
299335
</XData>
@@ -335,6 +371,19 @@ Returns all package class trees by given package name</Description>
335371
]]></Implementation>
336372
</Method>
337373

374+
<Method name="GetMethod">
375+
<Description>
376+
Returns method description and code</Description>
377+
<ClassMethod>1</ClassMethod>
378+
<FormalSpec>className:%String,methodName:%String</FormalSpec>
379+
<ReturnType>%Status</ReturnType>
380+
<Implementation><![CDATA[
381+
set methodData = ##class(ClassView).getMethod(className, methodName)
382+
do methodData.%ToJSON(, "ou")
383+
return $$$OK
384+
]]></Implementation>
385+
</Method>
386+
338387
<Method name="GetCss">
339388
<Description>
340389
Method returns user application CSS.</Description>

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

web/css/classView.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ svg {
44
}
55

66
#classView {
7+
position: relative;
8+
height: 100%;
9+
}
10+
11+
#svgContainer {
12+
z-index: 0;
13+
position: relative;
714
height: 100%;
815
cursor: -webkit-grab; cursor: -moz-grab;
916
}
@@ -37,6 +44,10 @@ text {
3744

3845
.uml-class-name-text {
3946
cursor: help;
47+
-webkit-transition: all .2s ease;
48+
-moz-transition: all .2s ease;
49+
-o-transition: all .2s ease;
50+
transition: all .2s ease;
4051
}
4152

4253
.uml-class-name-text:hover {
@@ -59,4 +70,16 @@ text {
5970
font-family: monospace;
6071
font-weight: 900;
6172
fill: magenta;
73+
}
74+
75+
.line-clickable {
76+
cursor: pointer;
77+
-webkit-transition: all .2s ease;
78+
-moz-transition: all .2s ease;
79+
-o-transition: all .2s ease;
80+
transition: all .2s ease;
81+
}
82+
83+
.line-clickable:hover {
84+
fill: red;
6285
}

web/css/extras.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,30 @@
106106
left: 5px;
107107
}
108108

109+
.icon.cross:before {
110+
content: "";
111+
background-color: #fff;
112+
width: 4px;
113+
height: 14px;
114+
border-radius: 1px;
115+
position: absolute;
116+
top: 5px;
117+
left: 10px;
118+
transform: rotate(45deg);
119+
}
120+
121+
.icon.cross:after {
122+
content: "";
123+
background-color: #fff;
124+
width: 14px;
125+
height: 4px;
126+
border-radius: 1px;
127+
position: absolute;
128+
top: 10px;
129+
left: 5px;
130+
transform: rotate(45deg);
131+
}
132+
109133
.icon.minus:after {
110134
content: "";
111135
background-color: #fff;

web/css/interface.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ html, body {
1515
.ui-sideBlock {
1616
position: relative;
1717
float: left;
18-
width: 300px;
18+
width: 250px;
1919
height: 100%;
2020
}
2121

2222
.ui-mainBlock {
2323
position: relative;
24-
margin-left: 300px;
24+
margin-left: 250px;
2525
height: 100%;
2626
}
2727

web/css/methodCodeView.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#methodCodeView {
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+
#methodCodeView > div.head {
15+
position: relative;
16+
overflow: visible; /* kept for button shadow */
17+
margin: 1em;
18+
}
19+
20+
#methodDescription {
21+
box-sizing: border-box;
22+
padding: 1em;
23+
color: gray;
24+
font-style: italic;
25+
}
26+
27+
#methodViewBounds {
28+
overflow: auto;
29+
}
30+
31+
#methodCode {
32+
padding: 1em;
33+
box-sizing: border-box;
34+
white-space: pre;
35+
}
36+
37+
#closeMethodCodeView {
38+
float: right;
39+
}
40+
41+
#methodCodeView.active {
42+
box-shadow: 0 0 5px black;
43+
height: 100%;
44+
}

web/index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="css/extras.css"/>
1010
<link rel="stylesheet" href="css/classView.css"/>
1111
<link rel="stylesheet" href="css/joint.min.css"/>
12+
<link rel="stylesheet" href="css/methodCodeView.css"/>
1213
<!-- endbuild -->
1314
<!-- build:js -->
1415
<script type="text/javascript" src="jsLib/joint.js"></script>
@@ -23,7 +24,7 @@
2324
<script type="text/javascript" src="js/UI.js"></script>
2425
<!-- endbuild -->
2526
</head>
26-
<body onload="cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
27+
<body onload="cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('svgContainer'))">
2728
<div class="ui-body" id="ui-body">
2829
<div class="ui-sideBlock">
2930
<div id="treeView">
@@ -46,7 +47,23 @@
4647
<div id="button.zoomOut" class="icon minus"></div>
4748
</div>
4849
<div id="classView">
50+
<div id="methodCodeView">
51+
<div class="head">
52+
<div id="closeMethodCodeView" class="icon cross"></div>
53+
<h2 id="methodLabel"></h2>
54+
</div>
55+
<div id="methodViewBounds">
56+
<div id="methodDescription">
4957

58+
</div>
59+
<div id="methodCode">
60+
61+
</div>
62+
</div>
63+
</div>
64+
<div id="svgContainer">
65+
66+
</div>
5067
</div>
5168
</div>
5269
</div>

web/js/CacheUMLExplorer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
1818
zoomInButton: id("button.zoomIn"),
1919
zoomOutButton: id("button.zoomOut"),
2020
zoomNormalButton: id("button.zoomNormal"),
21-
infoButton: id("button.showInfo")
21+
infoButton: id("button.showInfo"),
22+
methodCodeView: id("methodCodeView"),
23+
closeMethodCodeView: id("closeMethodCodeView"),
24+
methodLabel: id("methodLabel"),
25+
methodCode: id("methodCode"),
26+
classView: id("classView"),
27+
svgContainer: id("svgContainer"),
28+
methodDescription: id("methodDescription"),
29+
methodViewBounds: id("methodViewBounds")
2230
};
2331

2432
this.UI = new UI(this);

0 commit comments

Comments
 (0)