correct view initisalization for java
authorymh <ymh.work@gmail.com>
Sat, 19 Sep 2015 13:38:56 +0200
changeset 537 88703fb5aaaf
parent 536 a18716c2c4c0
child 538 19c3d95d2f3b
correct view initisalization for java
client/js/renderer/scene.js
server/java/renkan-web/src/main/webapp/static/js/corenkan.js
--- a/client/js/renderer/scene.js	Fri Sep 18 17:26:11 2015 +0200
+++ b/client/js/renderer/scene.js	Sat Sep 19 13:38:56 2015 +0200
@@ -292,7 +292,7 @@
         var _thRedraw = _.throttle(function() {
             _this.redraw();
         },50);
-           
+
         this.addRepresentations("Node", this.renkan.project.get("nodes"));
         this.addRepresentations("Edge", this.renkan.project.get("edges"));
         this.renkan.project.on("change:title", function() {
@@ -376,10 +376,11 @@
                 el.text(_title);
             }
         });
-        
+
         //register router events
+        console.log("Register view parameters");
         this.renkan.router.on("router", function(_params){
-            _this.parameters(_params);
+            _this.setViewparameters(_params);
         });
 
         if (_renkan.options.size_bug_fix) {
@@ -686,7 +687,7 @@
             var RendererType = requtils.getRenderer()[_type];
             var _repr = new RendererType(this, _model);
             this.representations.push(_repr);
-            return _repr;                
+            return _repr;
         },
         addRepresentations: function(_type, _collection) {
             var _this = this;
@@ -1201,7 +1202,7 @@
           filesaver(blob,fileNameToSaveAs);
 
         },
-        parameters: function(_params){
+        setViewparameters: function(_params){
             this.removeRepresentationsOfType("View");
             if ($.isEmptyObject(_params)){
                 this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view)));
@@ -1231,7 +1232,7 @@
                 } else{
                     this.view = this.addRepresentation("View", null);
                     this.view.params = params;
-                    this.view.init();                    
+                    this.view.init();
                 }
             }
             if (!this.view){
@@ -1241,7 +1242,7 @@
             //other parameters must go after because most of them depends on a view that must be initialize before
             this.unhighlightAll();
             if (typeof _params.idNode !== 'undefined'){
-                this.highlightModel(this.renkan.project.get("nodes").get(_params.idNode));                 
+                this.highlightModel(this.renkan.project.get("nodes").get(_params.idNode));
             }
         },
         validViewIndex: function(index){
@@ -1251,7 +1252,7 @@
             if (_index < 0){
                 validIndex = this.renkan.project.get("views").length + _index;
             } else {
-                validIndex = _index; 
+                validIndex = _index;
             }
             if (typeof this.renkan.project.get("views").at(_index) === 'undefined'){
                 validIndex = 0;
--- a/server/java/renkan-web/src/main/webapp/static/js/corenkan.js	Fri Sep 18 17:26:11 2015 +0200
+++ b/server/java/renkan-web/src/main/webapp/static/js/corenkan.js	Sat Sep 19 13:38:56 2015 +0200
@@ -39,6 +39,10 @@
                 that.setObjects();
             });
 
+            that.project.set({
+                loadingStatus : true
+            });
+
             sess.onStatusChange = function(status) {
                 console.log("STATUS : ", status);
                 that.onInternalStatusChange(status);
@@ -120,7 +124,9 @@
         console.log("State response", obj);
         obj._id = obj.id;
         this.renkan.dataloader.load(obj);
-        this.renkan.renderer.autoScale();
+        this.project.set({
+            loadingStatus :false
+        });
     };
 
     proto.onInternalStatusChange = function(status) {
@@ -193,7 +199,7 @@
     };
 
     /**
-     * Called when an abject is changed
+     * Called when an object is changed
      *
      */
     proto.objectChange = function(event, model, collection, options) {