2010-12-13 15:07:20 +01:00
|
|
|
/*
|
2011-01-24 00:34:05 +01:00
|
|
|
* Copyright [2011] [wisemapping]
|
2010-12-13 15:07:20 +01:00
|
|
|
*
|
2011-01-24 01:03:12 +01:00
|
|
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
|
|
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
2011-01-24 00:34:05 +01:00
|
|
|
* "powered by wisemapping" text requirement on every single page;
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the license at
|
2010-12-13 15:07:20 +01:00
|
|
|
*
|
2011-01-24 00:34:05 +01:00
|
|
|
* http://www.wisemapping.org/license
|
2010-12-13 15:07:20 +01:00
|
|
|
*
|
2011-01-24 00:34:05 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2010-12-13 15:07:20 +01:00
|
|
|
*/
|
|
|
|
|
2009-06-07 20:59:43 +02:00
|
|
|
mindplot.CentralTopic = function(model)
|
|
|
|
{
|
|
|
|
core.assert(model, "Model can not be null");
|
|
|
|
this.setModel(model);
|
2011-03-17 16:51:40 +01:00
|
|
|
mindplot.CentralTopic.superClass.initialize.call(this);
|
2009-06-07 20:59:43 +02:00
|
|
|
this.__onLoad = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
objects.extend(mindplot.CentralTopic, mindplot.Topic);
|
|
|
|
|
|
|
|
|
2010-12-31 19:11:32 +01:00
|
|
|
mindplot.CentralTopic.prototype.workoutIncomingConnectionPoint = function(sourcePosition)
|
2009-06-07 20:59:43 +02:00
|
|
|
{
|
2010-12-31 19:11:32 +01:00
|
|
|
return this.getPosition();
|
2009-06-07 20:59:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype.getTopicType = function()
|
|
|
|
{
|
|
|
|
return mindplot.NodeModel.CENTRAL_TOPIC_TYPE;
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype.setCursor = function(type)
|
|
|
|
{
|
|
|
|
type = (type == 'move') ? 'default' : type;
|
|
|
|
mindplot.CentralTopic.superClass.setCursor.call(this, type);
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype.isConnectedToCentralTopic = function()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2011-04-12 14:59:03 +02:00
|
|
|
mindplot.CentralTopic.prototype.createChildModel = function(prepositionate)
|
2009-06-07 20:59:43 +02:00
|
|
|
{
|
|
|
|
// Create a new node ...
|
|
|
|
var model = this.getModel();
|
|
|
|
var mindmap = model.getMindmap();
|
|
|
|
var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
|
|
|
|
|
2011-04-12 14:59:03 +02:00
|
|
|
if(prepositionate){
|
2011-07-27 18:44:09 +02:00
|
|
|
if (!$defined(this.___siblingDirection))
|
2011-04-12 14:59:03 +02:00
|
|
|
{
|
|
|
|
this.___siblingDirection = 1;
|
|
|
|
}
|
2009-06-07 20:59:43 +02:00
|
|
|
|
2011-04-19 04:59:13 +02:00
|
|
|
// Position following taking into account this internal flag ...
|
2011-04-12 14:59:03 +02:00
|
|
|
if (this.___siblingDirection == 1)
|
|
|
|
{
|
2009-06-07 20:59:43 +02:00
|
|
|
|
2011-04-19 04:59:13 +02:00
|
|
|
childModel.setPosition(150, 0);
|
2011-04-12 14:59:03 +02:00
|
|
|
} else
|
|
|
|
{
|
2011-04-19 04:59:13 +02:00
|
|
|
childModel.setPosition(-150, 0);
|
2011-04-12 14:59:03 +02:00
|
|
|
}
|
|
|
|
this.___siblingDirection = -this.___siblingDirection;
|
2009-06-07 20:59:43 +02:00
|
|
|
}
|
|
|
|
// Create a new node ...
|
|
|
|
childModel.setOrder(0);
|
|
|
|
|
|
|
|
return childModel;
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype._defaultShapeType = function()
|
|
|
|
{
|
|
|
|
return mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype.updateTopicShape = function()
|
|
|
|
{
|
|
|
|
|
|
|
|
};
|
2011-04-08 16:31:40 +02:00
|
|
|
mindplot.CentralTopic.prototype._updatePositionOnChangeSize = function(oldSize, newSize, updatePosition) {
|
2009-06-07 20:59:43 +02:00
|
|
|
|
|
|
|
// Center main topic ...
|
|
|
|
var zeroPoint = new core.Point(0, 0);
|
|
|
|
this.setPosition(zeroPoint);
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype._defaultText = function()
|
|
|
|
{
|
|
|
|
return "Central Topic";
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype._defaultBackgroundColor = function()
|
|
|
|
{
|
|
|
|
return "#f7f7f7";
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype._defaultBorderColor = function()
|
|
|
|
{
|
|
|
|
return "#023BB9";
|
|
|
|
};
|
|
|
|
|
|
|
|
mindplot.CentralTopic.prototype._defaultFontStyle = function()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
font:"Verdana",
|
|
|
|
size: 10,
|
|
|
|
style:"normal",
|
|
|
|
weight:"bold",
|
|
|
|
color:"#023BB9"
|
|
|
|
};
|
|
|
|
};
|