Skip to content

Commit 9d37e50

Browse files
basic aggregation visualizing, package/class label fixed
1 parent 1ce6d16 commit 9d37e50

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

web/js/ClassTree.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ ClassTree.prototype.classSelected = function (element, className) {
4646
this.cacheUMLExplorer.classView.loadClass(className);
4747
}
4848

49-
this.cacheUMLExplorer.elements.className.textContent = className;
50-
5149
};
5250

5351
ClassTree.prototype.packageSelected = function (element, packageName) {
@@ -62,8 +60,6 @@ ClassTree.prototype.packageSelected = function (element, packageName) {
6260
this.cacheUMLExplorer.classView.loadPackage(packageName);
6361
}
6462

65-
this.cacheUMLExplorer.elements.className.textContent = packageName;
66-
6763
};
6864

6965
ClassTree.prototype.updateTree = function (treeObject) {

web/js/ClassView.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,24 @@ ClassView.prototype.render = function (data) {
154154
}
155155
}
156156

157+
for (p in data["aggregation"]) {
158+
relTo = (classes[p] || {}).instance;
159+
for (pp in data["aggregation"][p]) {
160+
relFrom = (classes[pp] || {}).instance;
161+
if (relFrom && relTo) {
162+
this.graph.addCell(connector = new uml.Aggregation({
163+
source: { id: relFrom.id },
164+
target: { id: relTo.id },
165+
router: { name: "manhattan" },
166+
connector: { name: "rounded" }
167+
}));
168+
this.links.push(connector);
169+
}
170+
}
171+
}
172+
157173
joint.layout.DirectedGraph.layout(this.graph, {
158-
setLinkVertices: true,
174+
setLinkVertices: false,
159175
nodeSep: 100,
160176
rankSep: 100
161177
});
@@ -190,6 +206,7 @@ ClassView.prototype.loadClass = function (className) {
190206
}
191207
});
192208

209+
this.cacheUMLExplorer.elements.className.textContent = className;
193210
location.hash = "class:" + className;
194211

195212
};
@@ -210,6 +227,7 @@ ClassView.prototype.loadPackage = function (packageName) {
210227
}
211228
});
212229

230+
this.cacheUMLExplorer.elements.className.textContent = packageName;
213231
location.hash = "package:" + packageName;
214232

215233
};
@@ -256,7 +274,7 @@ ClassView.prototype.init = function () {
256274
el: this.container,
257275
width: this.container.offsetWidth,
258276
height: this.container.offsetHeight,
259-
gridSize: 30,
277+
gridSize: 20,
260278
model: this.graph,
261279
origin: {
262280
x: 0,

web/jsLib/joint.shapes.uml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ joint.shapes.uml.Implementation = joint.dia.Link.extend({
177177
joint.shapes.uml.Aggregation = joint.dia.Link.extend({
178178
defaults: {
179179
type: 'uml.Aggregation',
180-
attrs: { '.marker-target': { d: 'M 40 10 L 20 20 L 0 10 L 20 0 z', fill: 'white' }}
180+
attrs: { '.marker-target': { d: 'M 20 10 L 10 15 L 0 10 L 10 5 z', fill: 'white' }}
181181
}
182182
});
183183

0 commit comments

Comments
 (0)