adding collaborative node text edition

This commit is contained in:
Pablol
2011-08-07 21:13:20 -03:00
parent 18dfd82c1d
commit ff8cf207ca
5 changed files with 52 additions and 4 deletions

View File

@@ -23,6 +23,9 @@ mindplot.collaboration.CollaborationManager = new Class({
},
buildWiseModel: function(){
return this._collaborativeFramework.buildWiseModel();
},
getCollaborativeFramework:function(){
return this._collaborativeFramework;
}
});

View File

@@ -7,6 +7,7 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
model = this._buildInitialCollaborativeModel();
}
this._model = model;
this._actionDispatcher = null;
},
getModel: function(){
return this._model;
@@ -31,6 +32,22 @@ mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
mindmap.addBranch(centralTopic);
return mindmap;
},
addMindmap:function(model){}
addMindmap:function(model){},
getTopic:function(id){
var branches = this.getModel().getBranches();
for(var i = 0; i<branches.length; i++){
if(branches[i].getId()==id){
return branches[i];
}
}
return null;
},
getActionDispatcher:function(){
if(this._actionDispatcher == null){
var context = mindplot.ActionDispatcher.getInstance()._commandContext;
this._actionDispatcher = new mindplot.LocalActionDispatcher(context);
}
return this._actionDispatcher;
}
});

View File

@@ -29,7 +29,17 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
this.parent(type, mindmap, id);
if(!$defined(this._brixModel)){
this._brixModel = this._createBrixModel();
}else{
var text = this._brixModel.get("text");
this.setText(text, false);
}
this._addBrixListeners();
},
_addBrixListeners:function(){
this._brixModel.addListener("valueChanged", this._valuechangeListener.bindWithEvent(this));
},
_valuechangeListener:function(event){
this._brixFramework.getActionDispatcher().changeTextOnTopic(this.getId(),event.getNewValue());
},
_createBrixModel:function(){
var model = this._brixFramework.getBrixModel().create("Map");
@@ -100,9 +110,12 @@ mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
return this._type;
},
setText : function(text) {
setText : function(text,updateModel, callback) {
this.parent(text);
this._brixModel.set("text",text);
if($defined(updateModel) && updateModel){
this._brixModel.addListener("valueChanged",callback);
this._brixModel.put("text",text);
}
},
getText : function() {