2011-03-17 15:51:40 +00:00
|
|
|
mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayoutManager.extend({
|
|
|
|
options:{
|
|
|
|
|
|
|
|
},
|
|
|
|
initialize:function(designer, options){
|
|
|
|
this.parent(designer, options);
|
|
|
|
this._dragTopicPositioner = new mindplot.DragTopicPositioner(this);
|
|
|
|
// Init dragger manager.
|
|
|
|
var workSpace = this.getDesigner().getWorkSpace();
|
|
|
|
this._dragger = this._buildDragManager(workSpace);
|
|
|
|
|
|
|
|
// Add shapes to speed up the loading process ...
|
|
|
|
mindplot.DragTopic.initialize(workSpace);
|
|
|
|
},
|
|
|
|
_nodeResizeEvent:function(node){
|
2011-03-30 09:40:39 +01:00
|
|
|
if(this._isCentralTopic(node)){
|
|
|
|
var size = node.getSize();
|
|
|
|
if(!this._isCentralTopic(node))
|
2011-04-08 15:31:40 +01:00
|
|
|
this.getTopicBoardForTopic(node).updateChildrenPosition(node,size.height/2, []);
|
2011-03-30 09:40:39 +01:00
|
|
|
}
|
2011-03-17 15:51:40 +00:00
|
|
|
},
|
|
|
|
_NodeRepositionateEvent:function(node){
|
|
|
|
this.getTopicBoardForTopic(node).repositionate();
|
|
|
|
},
|
|
|
|
getDragTopicPositioner : function()
|
|
|
|
{
|
|
|
|
return this._dragTopicPositioner;
|
|
|
|
},
|
|
|
|
_buildDragManager: function(workspace)
|
|
|
|
{
|
|
|
|
// Init dragger manager.
|
|
|
|
var dragger = new mindplot.DragManager(workspace);
|
|
|
|
var topics = this.getDesigner()._getTopics();
|
|
|
|
|
|
|
|
var dragTopicPositioner = this.getDragTopicPositioner();
|
|
|
|
|
|
|
|
dragger.addEventListener('startdragging', function(event, node)
|
|
|
|
{
|
|
|
|
// Enable all mouse events.
|
|
|
|
for (var i = 0; i < topics.length; i++)
|
|
|
|
{
|
|
|
|
topics[i].setMouseEventsEnabled(false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dragger.addEventListener('dragging', function(event, dragTopic)
|
|
|
|
{
|
|
|
|
// Update the state and connections of the topic ...
|
|
|
|
dragTopicPositioner.positionateDragTopic(dragTopic);
|
|
|
|
});
|
|
|
|
|
|
|
|
dragger.addEventListener('enddragging', function(event, dragTopic)
|
|
|
|
{
|
|
|
|
// Enable all mouse events.
|
|
|
|
for (var i = 0; i < topics.length; i++)
|
|
|
|
{
|
|
|
|
topics[i].setMouseEventsEnabled(true);
|
|
|
|
}
|
|
|
|
// Topic must be positioned in the real board postion.
|
|
|
|
if (dragTopic._isInTheWorkspace)
|
|
|
|
{
|
|
|
|
var draggedTopic = dragTopic.getDraggedTopic();
|
|
|
|
|
|
|
|
// Hide topic during draw ...
|
|
|
|
draggedTopic.setBranchVisibility(false);
|
|
|
|
var parentNode = draggedTopic.getParent();
|
|
|
|
dragTopic.updateDraggedTopic(workspace);
|
|
|
|
|
|
|
|
|
|
|
|
// Make all node visible ...
|
|
|
|
draggedTopic.setVisibility(true);
|
|
|
|
if (parentNode != null)
|
|
|
|
{
|
|
|
|
parentNode.setBranchVisibility(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return dragger;
|
|
|
|
},
|
|
|
|
registerListenersOnNode : function(topic)
|
|
|
|
{
|
|
|
|
// Register node listeners ...
|
|
|
|
var designer = this.getDesigner();
|
|
|
|
topic.addEventListener('onfocus', function(event)
|
|
|
|
{
|
|
|
|
designer.onObjectFocusEvent.attempt([topic, event], designer);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add drag behaviour ...
|
|
|
|
if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
|
|
|
{
|
|
|
|
|
|
|
|
// Central Topic doesn't support to be dragged
|
|
|
|
var dragger = this._dragger;
|
|
|
|
dragger.add(topic);
|
|
|
|
}
|
|
|
|
|
2011-03-29 17:06:59 +01:00
|
|
|
// Register editor events ...
|
|
|
|
if (!this.getDesigner()._viewMode)
|
2011-03-17 15:51:40 +00:00
|
|
|
{
|
2011-03-29 17:06:59 +01:00
|
|
|
this.getDesigner()._editor.listenEventOnNode(topic, 'dblclick', true);
|
|
|
|
}
|
2011-03-17 15:51:40 +00:00
|
|
|
|
|
|
|
},
|
2011-03-24 18:00:51 +00:00
|
|
|
_createMainTopicBoard:function(node){
|
|
|
|
return new mindplot.MainTopicBoard(node, this);
|
2011-03-17 15:51:40 +00:00
|
|
|
},
|
2011-03-24 18:00:51 +00:00
|
|
|
_createCentralTopicBoard:function(node){
|
|
|
|
return new mindplot.CentralTopicBoard(node,this);
|
2011-03-17 16:28:19 +00:00
|
|
|
},
|
2011-03-24 18:00:51 +00:00
|
|
|
getClassName:function(){
|
2011-03-17 16:28:19 +00:00
|
|
|
return mindplot.layoutManagers.OriginalLayoutManager.NAME;
|
2011-03-17 15:51:40 +00:00
|
|
|
}
|
2011-03-17 16:28:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
mindplot.layoutManagers.OriginalLayoutManager.NAME ="OriginalLayoutManager";
|