Skip to content

Commit e6cab85

Browse files
links to classes and packages support
1 parent 40f1856 commit e6cab85

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

web/js/CacheUMLExplorer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
2727

2828
CacheUMLExplorer.prototype.init = function () {
2929

30-
var self = this;
30+
var self = this,
31+
hash = location.hash;
3132

3233
this.classTree.showLoader();
3334
this.source.getClassTree(function (err, data) {
3435
if (!err) self.classTree.updateTree(data);
3536
});
3637

38+
if (hash) {
39+
if (hash.indexOf("class:") === 1) {
40+
this.classView.loadClass(hash.substr(7));
41+
} else if (hash.indexOf("package:") === 1) {
42+
this.classView.loadPackage(hash.substr(9));
43+
}
44+
}
45+
3746
};

web/js/ClassView.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ ClassView.prototype.loadClass = function (className) {
179179
}
180180
});
181181

182+
location.hash = "class:" + className;
183+
182184
};
183185

184186
ClassView.prototype.loadPackage = function (packageName) {
@@ -197,6 +199,8 @@ ClassView.prototype.loadPackage = function (packageName) {
197199
}
198200
});
199201

202+
location.hash = "package:" + packageName;
203+
200204
};
201205

202206
ClassView.prototype.updateSizes = function () {

web/jsLib/joint.shapes.uml.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ joint.shapes.uml.Class = joint.shapes.basic.Generic.extend({
9595
_.each(rects, function(rect) {
9696

9797
var lines = _.isArray(rect.text) ? rect.text : [rect.text];
98-
var rectHeight = lines.length * 20 + 20;
98+
var rectHeight = lines.length * 20 + 20;
9999

100100
attrs['.uml-class-' + rect.type + '-text'].text = lines.join('\n');
101101
attrs['.uml-class-' + rect.type + '-rect'].height = rectHeight;
102102
attrs['.uml-class-' + rect.type + '-rect'].transform = 'translate(0,'+ offsetY + ')';
103103

104104
offsetY += rectHeight;
105+
105106
});
106107
}
107108

0 commit comments

Comments
 (0)