mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
Extend assert support.
This commit is contained in:
parent
d06275f524
commit
665c070359
@ -59,7 +59,7 @@ objects.extend = function(subClass, baseClass) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$assert = function(assert, message) {
|
$assert = function(assert, message) {
|
||||||
if (!assert) {
|
if (!$defined(assert) || !assert) {
|
||||||
var stack;
|
var stack;
|
||||||
try {
|
try {
|
||||||
null.eval();
|
null.eval();
|
||||||
|
@ -66,7 +66,7 @@ mindplot.BidirectionalArray = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
get :function(index, sign) {
|
get :function(index, sign) {
|
||||||
$assert($defined(index), 'Illegal argument, index must be passed.');
|
$assert(index, 'Illegal argument, index must be passed.');
|
||||||
if ($defined(sign)) {
|
if ($defined(sign)) {
|
||||||
$assert(index >= 0, 'Illegal absIndex value');
|
$assert(index >= 0, 'Illegal absIndex value');
|
||||||
index = index * sign;
|
index = index * sign;
|
||||||
@ -82,14 +82,14 @@ mindplot.BidirectionalArray = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
set : function(index, elem) {
|
set : function(index, elem) {
|
||||||
$assert($defined(index), 'Illegal index value');
|
$assert(index, 'Illegal index value');
|
||||||
|
|
||||||
var array = (index >= 0) ? this._rightElem : this._leftElem;
|
var array = (index >= 0) ? this._rightElem : this._leftElem;
|
||||||
array[Math.abs(index)] = elem;
|
array[Math.abs(index)] = elem;
|
||||||
},
|
},
|
||||||
|
|
||||||
length : function(index) {
|
length : function(index) {
|
||||||
$assert($defined(index), 'Illegal index value');
|
$assert(index, 'Illegal index value');
|
||||||
return (index >= 0) ? this._rightElem.length : this._leftElem.length;
|
return (index >= 0) ? this._rightElem.length : this._leftElem.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ mindplot.BoardEntry = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setUpperLimit : function(value) {
|
setUpperLimit : function(value) {
|
||||||
$assert($defined(value), "upper limit can not be null");
|
$assert(value, "upper limit can not be null");
|
||||||
$assert(!isNaN(value), "illegal value");
|
$assert(!isNaN(value), "illegal value");
|
||||||
this._upperLimit = value;
|
this._upperLimit = value;
|
||||||
},
|
},
|
||||||
@ -56,7 +56,7 @@ mindplot.BoardEntry = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setLowerLimit : function(value) {
|
setLowerLimit : function(value) {
|
||||||
$assert($defined(value), "upper limit can not be null");
|
$assert(value, "upper limit can not be null");
|
||||||
$assert(!isNaN(value), "illegal value");
|
$assert(!isNaN(value), "illegal value");
|
||||||
this._lowerLimit = value;
|
this._lowerLimit = value;
|
||||||
},
|
},
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
mindplot.DragTopic = function(dragShape, draggedNode)
|
mindplot.DragTopic = function(dragShape, draggedNode)
|
||||||
{
|
{
|
||||||
$assert($defined(dragShape), 'Rect can not be null.');
|
$assert(dragShape, 'Rect can not be null.');
|
||||||
$assert($defined(draggedNode), 'draggedNode can not be null.');
|
$assert(draggedNode, 'draggedNode can not be null.');
|
||||||
|
|
||||||
this._elem2d = dragShape;
|
this._elem2d = dragShape;
|
||||||
this._order = null;
|
this._order = null;
|
||||||
@ -68,7 +68,7 @@ mindplot.DragTopic.prototype.disconnect = function(workspace)
|
|||||||
|
|
||||||
mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic)
|
mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic)
|
||||||
{
|
{
|
||||||
$assert($defined(targetTopic), 'parent can not be null');
|
$assert(targetTopic, 'parent can not be null');
|
||||||
|
|
||||||
var result = true;
|
var result = true;
|
||||||
if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed())
|
if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed())
|
||||||
|
@ -245,7 +245,7 @@ mindplot.FixedDistanceBoard = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
lookupEntryByPosition : function(pos) {
|
lookupEntryByPosition : function(pos) {
|
||||||
$assert($defined(pos), 'position can not be null');
|
$assert(pos, 'position can not be null');
|
||||||
|
|
||||||
var entries = this._entries;
|
var entries = this._entries;
|
||||||
var result = null;
|
var result = null;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
mindplot.Icon = new Class({
|
mindplot.Icon = new Class({
|
||||||
initialize:function(url) {
|
initialize:function(url) {
|
||||||
|
$assert(url, 'topic can not be null');
|
||||||
this._image = new web2d.Image();
|
this._image = new web2d.Image();
|
||||||
this._image.setHref(url);
|
this._image.setHref(url);
|
||||||
this._image.setSize(12, 12);
|
this._image.setSize(12, 12);
|
||||||
|
@ -1,64 +1,58 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.IconModel = function(iconType, topic)
|
mindplot.IconModel = new Class({
|
||||||
{
|
initialize:function(iconType, topic) {
|
||||||
$assert(iconType, 'Icon id can not be null');
|
$assert(iconType, 'Icon id can not be null');
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
|
|
||||||
this._iconType = iconType;
|
this._iconType = iconType;
|
||||||
this._id = mindplot.IconModel._nextUUID();
|
this._id = mindplot.IconModel._nextUUID();
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.IconModel.prototype.getId = function()
|
getId : function() {
|
||||||
{
|
|
||||||
return this._id;
|
return this._id;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.IconModel.prototype.getIconType = function()
|
getIconType : function() {
|
||||||
{
|
|
||||||
return this._iconType;
|
return this._iconType;
|
||||||
};
|
},
|
||||||
|
|
||||||
|
|
||||||
mindplot.IconModel.prototype.setIconType = function(iconType)
|
setIconType : function(iconType) {
|
||||||
{
|
|
||||||
this._iconType = iconType;
|
this._iconType = iconType;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.IconModel.prototype.getTopic = function()
|
getTopic : function() {
|
||||||
{
|
|
||||||
return this._topic;
|
return this._topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.IconModel.prototype.isIconModel = function()
|
isIconModel : function() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
};
|
}});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo: This method must be implemented.
|
* @todo: This method must be implemented.
|
||||||
*/
|
*/
|
||||||
mindplot.IconModel._nextUUID = function()
|
mindplot.IconModel._nextUUID = function() {
|
||||||
{
|
if (!$defined(this._uuid)) {
|
||||||
if (!$defined(this._uuid))
|
|
||||||
{
|
|
||||||
this._uuid = 0;
|
this._uuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.ImageIcon = function(iconModel, topic, designer) {
|
|
||||||
|
|
||||||
|
mindplot.ImageIcon = new Class(
|
||||||
|
{
|
||||||
|
Extends:mindplot.Icon,
|
||||||
|
initialize:function(iconModel, topic, designer) {
|
||||||
$assert(iconModel, 'iconModel can not be null');
|
$assert(iconModel, 'iconModel can not be null');
|
||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
$assert(designer, 'designer can not be null');
|
$assert(designer, 'designer can not be null');
|
||||||
@ -28,7 +30,8 @@ mindplot.ImageIcon = function(iconModel, topic, designer) {
|
|||||||
// Build graph image representation ...
|
// Build graph image representation ...
|
||||||
var iconType = iconModel.getIconType();
|
var iconType = iconModel.getIconType();
|
||||||
var imgUrl = this._getImageUrl(iconType);
|
var imgUrl = this._getImageUrl(iconType);
|
||||||
mindplot.Icon.call(this, imgUrl);
|
|
||||||
|
this.parent(imgUrl);
|
||||||
|
|
||||||
//Remove
|
//Remove
|
||||||
var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
|
var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
|
||||||
@ -39,8 +42,7 @@ mindplot.ImageIcon = function(iconModel, topic, designer) {
|
|||||||
removeImage.src = "../images/bin.png";
|
removeImage.src = "../images/bin.png";
|
||||||
removeImage.inject(container);
|
removeImage.inject(container);
|
||||||
|
|
||||||
if (!$defined(designer._viewMode)|| ($defined(designer._viewMode) && !designer._viewMode))
|
if (!$defined(designer._viewMode) || ($defined(designer._viewMode) && !designer._viewMode)) {
|
||||||
{
|
|
||||||
|
|
||||||
removeImage.addEvent('click', function(event) {
|
removeImage.addEvent('click', function(event) {
|
||||||
var actionRunner = designer._actionRunner;
|
var actionRunner = designer._actionRunner;
|
||||||
@ -79,31 +81,23 @@ mindplot.ImageIcon = function(iconModel, topic, designer) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
objects.extend(mindplot.ImageIcon, mindplot.Icon);
|
_getImageUrl : function(iconId) {
|
||||||
|
return "../icons/" + iconId + ".png";
|
||||||
|
},
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.initialize = function() {
|
getModel : function() {
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype._getImageUrl = function(iconId) {
|
|
||||||
return "../icons/"+iconId+".png";
|
|
||||||
};
|
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.getModel = function() {
|
|
||||||
return this._iconModel;
|
return this._iconModel;
|
||||||
};
|
},
|
||||||
|
|
||||||
|
_getNextFamilyIconId : function(iconId) {
|
||||||
mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) {
|
|
||||||
|
|
||||||
var familyIcons = this._getFamilyIcons(iconId);
|
var familyIcons = this._getFamilyIcons(iconId);
|
||||||
$assert(familyIcons != null, "Family Icon not found!");
|
$assert(familyIcons != null, "Family Icon not found!");
|
||||||
|
|
||||||
var result = null;
|
var result = null;
|
||||||
for (var i = 0; i < familyIcons.length && result == null; i++)
|
for (var i = 0; i < familyIcons.length && result == null; i++) {
|
||||||
{
|
|
||||||
if (familyIcons[i] == iconId) {
|
if (familyIcons[i] == iconId) {
|
||||||
var nextIconId;
|
var nextIconId;
|
||||||
//Is last one?
|
//Is last one?
|
||||||
@ -117,15 +111,14 @@ mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype._getFamilyIcons = function(iconId) {
|
_getFamilyIcons : function(iconId) {
|
||||||
$assert(iconId != null, "id must not be null");
|
$assert(iconId != null, "id must not be null");
|
||||||
$assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
|
$assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
|
||||||
|
|
||||||
var result = null;
|
var result = null;
|
||||||
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++)
|
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++) {
|
||||||
{
|
|
||||||
var family = mindplot.ImageIcon.prototype.ICON_FAMILIES[i];
|
var family = mindplot.ImageIcon.prototype.ICON_FAMILIES[i];
|
||||||
var iconFamilyId = iconId.substr(0, iconId.indexOf("_"));
|
var iconFamilyId = iconId.substr(0, iconId.indexOf("_"));
|
||||||
|
|
||||||
@ -135,21 +128,43 @@ mindplot.ImageIcon.prototype._getFamilyIcons = function(iconId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.getId = function()
|
getId : function() {
|
||||||
{
|
|
||||||
return this._iconType;
|
return this._iconType;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.getUiId = function()
|
getUiId : function() {
|
||||||
{
|
|
||||||
return this._uiId;
|
return this._uiId;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.ICON_FAMILIES = [{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},{"id": "tick", "icons" : ["tick_tick","tick_cross"]},{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]}]
|
|
||||||
|
mindplot.ImageIcon.prototype.ICON_FAMILIES = [
|
||||||
|
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},
|
||||||
|
{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},
|
||||||
|
{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},
|
||||||
|
{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},
|
||||||
|
{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},
|
||||||
|
{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},
|
||||||
|
{"id": "tick", "icons" : ["tick_tick","tick_cross"]},
|
||||||
|
{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},
|
||||||
|
{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},
|
||||||
|
{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},
|
||||||
|
{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},
|
||||||
|
{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},
|
||||||
|
{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},
|
||||||
|
{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},
|
||||||
|
{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},
|
||||||
|
{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},
|
||||||
|
{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},
|
||||||
|
{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},
|
||||||
|
{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},
|
||||||
|
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},
|
||||||
|
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},
|
||||||
|
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,3 +17,9 @@ Later
|
|||||||
nodos en vez de borrarlos.
|
nodos en vez de borrarlos.
|
||||||
* Menu contextual para agregar nodos.
|
* Menu contextual para agregar nodos.
|
||||||
* Es necesario manejar para los central topic to main topic correctamente el concepto de height.
|
* Es necesario manejar para los central topic to main topic correctamente el concepto de height.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
From: RelationshipLine
|
||||||
|
- Falta topic...
|
||||||
|
XMLMindmapSerializer_Beta
|
@ -1,25 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.LinkIcon = function(urlModel, topic, designer) {
|
mindplot.LinkIcon = new Class({
|
||||||
var divContainer=designer.getWorkSpace().getScreenManager().getContainer();
|
|
||||||
|
Extends:mindplot.Icon,
|
||||||
|
initialize:function(urlModel, topic, designer) {
|
||||||
|
$assert(urlModel, "urlModel can not be null");
|
||||||
|
$assert(designer, "designer can not be null");
|
||||||
|
$assert(topic, "topic can not be null");
|
||||||
|
|
||||||
|
this.parent(mindplot.LinkIcon.IMAGE_URL);
|
||||||
|
|
||||||
|
var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
|
||||||
var bubbleTip = mindplot.BubbleTip.getInstance(divContainer);
|
var bubbleTip = mindplot.BubbleTip.getInstance(divContainer);
|
||||||
mindplot.Icon.call(this, mindplot.LinkIcon.IMAGE_URL);
|
|
||||||
this._linkModel = urlModel;
|
this._linkModel = urlModel;
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
this._designer = designer;
|
this._designer = designer;
|
||||||
@ -29,12 +38,11 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
var url = urlModel.getUrl();
|
var url = urlModel.getUrl();
|
||||||
this._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url;
|
this._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url;
|
||||||
|
|
||||||
if (url.indexOf('http:') == -1)
|
if (url.indexOf('http:') == -1) {
|
||||||
{
|
|
||||||
url = 'http://' + url;
|
url = 'http://' + url;
|
||||||
}
|
}
|
||||||
this._img.alt = url;
|
this._img.alt = url;
|
||||||
this._url=url;
|
this._url = url;
|
||||||
var openWindow = function() {
|
var openWindow = function() {
|
||||||
var wOpen;
|
var wOpen;
|
||||||
var sOptions;
|
var sOptions;
|
||||||
@ -49,6 +57,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
wOpen.moveTo(0, 0);
|
wOpen.moveTo(0, 0);
|
||||||
wOpen.resizeTo(screen.availWidth, screen.availHeight);
|
wOpen.resizeTo(screen.availWidth, screen.availHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._img.addEvent('click', openWindow.bindWithEvent(this));
|
this._img.addEvent('click', openWindow.bindWithEvent(this));
|
||||||
this._img.inject(imgContainer);
|
this._img.inject(imgContainer);
|
||||||
|
|
||||||
@ -72,9 +81,9 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
attribution.inject(element);
|
attribution.inject(element);
|
||||||
element.inject(container);
|
element.inject(container);
|
||||||
|
|
||||||
if(!$defined(designer._viewMode)|| ($defined(designer._viewMode) && !designer._viewMode)){
|
if (!$defined(designer._viewMode) || ($defined(designer._viewMode) && !designer._viewMode)) {
|
||||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
|
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
|
||||||
var editBtn = new Element('input', {type:'button', 'class':'btn-primary', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer);
|
var editBtn = new Element('input', {type:'button', 'class':'btn-primary', value:'Edit'}).addClass('button').inject(buttonContainer);
|
||||||
var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer);
|
var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer);
|
||||||
|
|
||||||
editBtn.setStyle("margin-right", "3px");
|
editBtn.setStyle("margin-right", "3px");
|
||||||
@ -86,7 +95,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
bubbleTip.forceClose();
|
bubbleTip.forceClose();
|
||||||
}.bindWithEvent(this));
|
}.bindWithEvent(this));
|
||||||
|
|
||||||
var okButtonId = 'okLinkButtonId'
|
var okButtonId = 'okLinkButtonId';
|
||||||
editBtn.addEvent('click', function(event) {
|
editBtn.addEvent('click', function(event) {
|
||||||
var topic = this._topic;
|
var topic = this._topic;
|
||||||
var designer = this._designer;
|
var designer = this._designer;
|
||||||
@ -94,8 +103,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
var okFunction = function(e) {
|
var okFunction = function(e) {
|
||||||
var result = false;
|
var result = false;
|
||||||
var url = urlInput.value;
|
var url = urlInput.value;
|
||||||
if ("" != url.trim())
|
if ("" != url.trim()) {
|
||||||
{
|
|
||||||
link._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url;
|
link._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url;
|
||||||
link._img.alt = url;
|
link._img.alt = url;
|
||||||
link._link.href = url;
|
link._link.href = url;
|
||||||
@ -107,15 +115,14 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
};
|
};
|
||||||
var msg = new Element('div');
|
var msg = new Element('div');
|
||||||
var urlText = new Element('div').inject(msg);
|
var urlText = new Element('div').inject(msg);
|
||||||
urlText.innerHTML = "URL:"
|
urlText.innerHTML = "URL:";
|
||||||
|
|
||||||
var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'});
|
var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'});
|
||||||
var urlInput = new Element('input', {'type': 'text', 'size':30,'value':url});
|
var urlInput = new Element('input', {'type': 'text', 'size':30,'value':url});
|
||||||
urlInput.inject(formElem);
|
urlInput.inject(formElem);
|
||||||
formElem.inject(msg)
|
formElem.inject(msg);
|
||||||
|
|
||||||
formElem.addEvent('submit', function(e)
|
formElem.addEvent('submit', function(e) {
|
||||||
{
|
|
||||||
$(okButtonId).fireEvent('click', e);
|
$(okButtonId).fireEvent('click', e);
|
||||||
e = new Event(e);
|
e = new Event(e);
|
||||||
e.stop();
|
e.stop();
|
||||||
@ -129,7 +136,6 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
buttonContainer.inject(container);
|
buttonContainer.inject(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var linkIcon = this;
|
var linkIcon = this;
|
||||||
image.addEventListener('mouseover', function(event) {
|
image.addEventListener('mouseover', function(event) {
|
||||||
bubbleTip.open(event, container, linkIcon);
|
bubbleTip.open(event, container, linkIcon);
|
||||||
@ -140,21 +146,16 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
|
|||||||
image.addEventListener('mouseout', function(event) {
|
image.addEventListener('mouseout', function(event) {
|
||||||
bubbleTip.close(event);
|
bubbleTip.close(event);
|
||||||
});
|
});
|
||||||
};
|
},
|
||||||
|
|
||||||
objects.extend(mindplot.LinkIcon, mindplot.Icon);
|
getUrl : function() {
|
||||||
|
|
||||||
mindplot.LinkIcon.prototype.initialize = function() {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
mindplot.LinkIcon.prototype.getUrl=function(){
|
|
||||||
return this._url;
|
return this._url;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.LinkIcon.prototype.getModel=function(){
|
getModel : function() {
|
||||||
return this._linkModel;
|
return this._linkModel;
|
||||||
};
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mindplot.LinkIcon.buildDialog = function(designer, okFunction, okButtonId) {
|
mindplot.LinkIcon.buildDialog = function(designer, okFunction, okButtonId) {
|
||||||
var windoo = new Windoo({
|
var windoo = new Windoo({
|
||||||
@ -166,18 +167,17 @@ mindplot.LinkIcon.buildDialog = function(designer, okFunction, okButtonId) {
|
|||||||
height:130
|
height:130
|
||||||
});
|
});
|
||||||
|
|
||||||
var cancel = new Element('input', {'type': 'button', 'class':'btn-primary', 'value': 'Cancel','class':'btn-primary'}).setStyle('margin-right', "5px");
|
var cancel = new Element('input', {'type': 'button', 'class':'btn-primary', 'value': 'Cancel'}).setStyle('margin-right', "5px");
|
||||||
cancel.setStyle('margin-left', "5px");
|
cancel.setStyle('margin-left', "5px");
|
||||||
cancel.addEvent('click', function(event) {
|
cancel.addEvent('click', function(event) {
|
||||||
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||||
windoo.close();
|
windoo.close();
|
||||||
}.bindWithEvent(this));
|
}.bindWithEvent(this));
|
||||||
|
|
||||||
var ok = new Element('input', {'type': 'button', 'class':'btn-primary','value': 'Ok','class':'btn-primary','id':okButtonId}).setStyle('marginRight', 10);
|
var ok = new Element('input', {'type': 'button', 'class':'btn-primary','value': 'Ok','id':okButtonId}).setStyle('marginRight', 10);
|
||||||
ok.addEvent('click', function(event) {
|
ok.addEvent('click', function(event) {
|
||||||
var couldBeUpdated = okFunction.attempt();
|
var couldBeUpdated = okFunction.attempt();
|
||||||
if (couldBeUpdated)
|
if (couldBeUpdated) {
|
||||||
{
|
|
||||||
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||||
windoo.close();
|
windoo.close();
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.LinkModel = function(url, topic)
|
mindplot.LinkModel = new Class({
|
||||||
{
|
initialize : function(url, topic) {
|
||||||
$assert(url, 'link url can not be null');
|
$assert(url, 'url can not be null');
|
||||||
$assert(topic, 'mindmap can not be null');
|
$assert(topic, 'mindmap can not be null');
|
||||||
|
|
||||||
this._url = url;
|
this._url = url;
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.LinkModel.prototype.getUrl = function()
|
getUrl : function() {
|
||||||
{
|
|
||||||
return this._url;
|
return this._url;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.LinkModel.prototype.setUrl = function(url){
|
setUrl : function(url) {
|
||||||
|
$assert(url, 'url can not be null');
|
||||||
this._url = url;
|
this._url = url;
|
||||||
}
|
},
|
||||||
|
|
||||||
mindplot.LinkModel.prototype.getTopic = function()
|
getTopic : function() {
|
||||||
{
|
|
||||||
return this._topic;
|
return this._topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.LinkModel.prototype.isLinkModel = function()
|
isLinkModel : function() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
});
|
@ -89,7 +89,7 @@ mindplot.MainTopicBoard = new Class({
|
|||||||
|
|
||||||
addBranch : function(topic) {
|
addBranch : function(topic) {
|
||||||
var order = topic.getOrder();
|
var order = topic.getOrder();
|
||||||
$assert($defined(order), "Order must be defined");
|
$assert(order, "Order must be defined");
|
||||||
|
|
||||||
// If the entry is not available, I must swap the the entries...
|
// If the entry is not available, I must swap the the entries...
|
||||||
var board = this._getBoard();
|
var board = this._getBoard();
|
||||||
|
@ -41,7 +41,6 @@ mindplot.Mindmap = new Class({
|
|||||||
this._iconType = id;
|
this._iconType = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getVersion : function() {
|
getVersion : function() {
|
||||||
return this._version;
|
return this._version;
|
||||||
},
|
},
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -183,8 +183,8 @@ mindplot.NodeModel = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setPosition : function(x, y) {
|
setPosition : function(x, y) {
|
||||||
$assert($defined(x), "x coordinate must be defined");
|
$assert(x, "x coordinate must be defined");
|
||||||
$assert($defined(y), "y coordinate must be defined");
|
$assert(y, "y coordinate must be defined");
|
||||||
|
|
||||||
if (!$defined(this._position)) {
|
if (!$defined(this._position)) {
|
||||||
this._position = new core.Point();
|
this._position = new core.Point();
|
||||||
@ -198,8 +198,8 @@ mindplot.NodeModel = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setFinalPosition : function(x, y) {
|
setFinalPosition : function(x, y) {
|
||||||
$assert($defined(x), "x coordinate must be defined");
|
$assert(x, "x coordinate must be defined");
|
||||||
$assert($defined(y), "y coordinate must be defined");
|
$assert(y, "y coordinate must be defined");
|
||||||
|
|
||||||
if (!$defined(this._finalPosition)) {
|
if (!$defined(this._finalPosition)) {
|
||||||
this._finalPosition = new core.Point();
|
this._finalPosition = new core.Point();
|
||||||
@ -253,7 +253,7 @@ mindplot.NodeModel = new Class({
|
|||||||
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
||||||
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
||||||
$assert(sourcePosition, 'childPosition can not be null.');
|
$assert(sourcePosition, 'childPosition can not be null.');
|
||||||
$assert($defined(targetTopicHeight), 'childrenWidth can not be null.');
|
$assert(targetTopicHeight, 'childrenWidth can not be null.');
|
||||||
|
|
||||||
// Only can be connected if the node is in the left or rigth.
|
// Only can be connected if the node is in the left or rigth.
|
||||||
var targetModel = this;
|
var targetModel = this;
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.RelationshipLine = function(sourceNode, targetNode, lineType)
|
mindplot.RelationshipLine = new Class({
|
||||||
{
|
Extends: mindplot.ConnectionLine,
|
||||||
mindplot.ConnectionLine.call(this,sourceNode, targetNode, lineType);
|
initialize:function(sourceNode, targetNode, lineType) {
|
||||||
|
this.parent(sourceNode, targetNode, lineType);
|
||||||
|
|
||||||
this._line2d.setIsSrcControlPointCustom(false);
|
this._line2d.setIsSrcControlPointCustom(false);
|
||||||
this._line2d.setIsDestControlPointCustom(false);
|
this._line2d.setIsDestControlPointCustom(false);
|
||||||
this._isOnfocus = false;
|
this._isOnfocus = false;
|
||||||
@ -40,23 +42,15 @@ mindplot.RelationshipLine = function(sourceNode, targetNode, lineType)
|
|||||||
this._endArrow.setStrokeWidth(2);
|
this._endArrow.setStrokeWidth(2);
|
||||||
this._line2d.setStroke(1, 'solid', strokeColor);
|
this._line2d.setStroke(1, 'solid', strokeColor);
|
||||||
|
|
||||||
};
|
},
|
||||||
|
|
||||||
objects.extend(mindplot.RelationshipLine, mindplot.ConnectionLine);
|
setStroke : function(color, style, opacity) {
|
||||||
|
// @Todo: How this is supported in mootools ?
|
||||||
mindplot.RelationshipLine.getStrokeColor = function()
|
mindplot.ConnectionLine.prototype.setStroke.call(this, color, style, opacity);
|
||||||
{
|
|
||||||
return '#9b74e6';
|
|
||||||
};
|
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setStroke = function(color, style, opacity)
|
|
||||||
{
|
|
||||||
mindplot.RelationshipLine.superClass.setStroke.call(this, color, style, opacity);
|
|
||||||
this._startArrow.setStrokeColor(color);
|
this._startArrow.setStrokeColor(color);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.redraw = function()
|
redraw : function() {
|
||||||
{
|
|
||||||
var line2d = this._line2d;
|
var line2d = this._line2d;
|
||||||
var sourceTopic = this._sourceTopic;
|
var sourceTopic = this._sourceTopic;
|
||||||
var sourcePosition = sourceTopic.getPosition();
|
var sourcePosition = sourceTopic.getPosition();
|
||||||
@ -67,21 +61,21 @@ mindplot.RelationshipLine.prototype.redraw = function()
|
|||||||
var sPos,tPos;
|
var sPos,tPos;
|
||||||
this._line2d.setStroke(2);
|
this._line2d.setStroke(2);
|
||||||
var ctrlPoints = this._line2d.getControlPoints();
|
var ctrlPoints = this._line2d.getControlPoints();
|
||||||
if(!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()){
|
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) {
|
||||||
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
|
var defaultPoints = core.Utils.calculateDefaultControlPoints(sourcePosition, targetPosition);
|
||||||
ctrlPoints[0].x=defaultPoints[0].x;
|
ctrlPoints[0].x = defaultPoints[0].x;
|
||||||
ctrlPoints[0].y=defaultPoints[0].y;
|
ctrlPoints[0].y = defaultPoints[0].y;
|
||||||
ctrlPoints[1].x=defaultPoints[1].x;
|
ctrlPoints[1].x = defaultPoints[1].x;
|
||||||
ctrlPoints[1].y=defaultPoints[1].y;
|
ctrlPoints[1].y = defaultPoints[1].y;
|
||||||
}
|
}
|
||||||
var spoint = new core.Point();
|
var spoint = new core.Point();
|
||||||
spoint.x=parseInt(ctrlPoints[0].x)+parseInt(sourcePosition.x);
|
spoint.x = parseInt(ctrlPoints[0].x) + parseInt(sourcePosition.x);
|
||||||
spoint.y=parseInt(ctrlPoints[0].y)+parseInt(sourcePosition.y);
|
spoint.y = parseInt(ctrlPoints[0].y) + parseInt(sourcePosition.y);
|
||||||
var tpoint = new core.Point();
|
var tpoint = new core.Point();
|
||||||
tpoint.x=parseInt(ctrlPoints[1].x)+parseInt(targetPosition.x);
|
tpoint.x = parseInt(ctrlPoints[1].x) + parseInt(targetPosition.x);
|
||||||
tpoint.y=parseInt(ctrlPoints[1].y)+parseInt(targetPosition.y);
|
tpoint.y = parseInt(ctrlPoints[1].y) + parseInt(targetPosition.y);
|
||||||
sPos = core.Utils.calculateRelationShipPointCoordinates(sourceTopic,spoint);
|
sPos = core.Utils.calculateRelationShipPointCoordinates(sourceTopic, spoint);
|
||||||
tPos = core.Utils.calculateRelationShipPointCoordinates(targetTopic,tpoint);
|
tPos = core.Utils.calculateRelationShipPointCoordinates(targetTopic, tpoint);
|
||||||
|
|
||||||
line2d.setFrom(sPos.x, sPos.y);
|
line2d.setFrom(sPos.x, sPos.y);
|
||||||
line2d.setTo(tPos.x, tPos.y);
|
line2d.setTo(tPos.x, tPos.y);
|
||||||
@ -94,15 +88,14 @@ mindplot.RelationshipLine.prototype.redraw = function()
|
|||||||
// Add connector ...
|
// Add connector ...
|
||||||
this._positionateConnector(targetTopic);
|
this._positionateConnector(targetTopic);
|
||||||
|
|
||||||
if(this.isOnFocus()){
|
if (this.isOnFocus()) {
|
||||||
this._refreshSelectedShape();
|
this._refreshSelectedShape();
|
||||||
}
|
}
|
||||||
this._focusShape.moveToBack();
|
this._focusShape.moveToBack();
|
||||||
this._controlPointsController.redraw();
|
this._controlPointsController.redraw();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype._positionateArrows = function()
|
_positionateArrows : function() {
|
||||||
{
|
|
||||||
this._endArrow.setVisibility(this.isVisible() && this._showEndArrow);
|
this._endArrow.setVisibility(this.isVisible() && this._showEndArrow);
|
||||||
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
|
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
|
||||||
|
|
||||||
@ -113,7 +106,7 @@ mindplot.RelationshipLine.prototype._positionateArrows = function()
|
|||||||
this._endArrow.moveToBack();
|
this._endArrow.moveToBack();
|
||||||
this._startArrow.moveToBack();
|
this._startArrow.moveToBack();
|
||||||
|
|
||||||
if(this._line2d.getType() == "CurvedLine"){
|
if (this._line2d.getType() == "CurvedLine") {
|
||||||
var controlPoints = this._line2d.getControlPoints();
|
var controlPoints = this._line2d.getControlPoints();
|
||||||
this._startArrow.setControlPoint(controlPoints[0]);
|
this._startArrow.setControlPoint(controlPoints[0]);
|
||||||
this._endArrow.setControlPoint(controlPoints[1]);
|
this._endArrow.setControlPoint(controlPoints[1]);
|
||||||
@ -121,44 +114,43 @@ mindplot.RelationshipLine.prototype._positionateArrows = function()
|
|||||||
this._startArrow.setControlPoint(this._line2d.getTo());
|
this._startArrow.setControlPoint(this._line2d.getTo());
|
||||||
this._endArrow.setControlPoint(this._line2d.getFrom());
|
this._endArrow.setControlPoint(this._line2d.getFrom());
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.addToWorkspace = function(workspace)
|
addToWorkspace : function(workspace) {
|
||||||
{
|
|
||||||
workspace.appendChild(this._focusShape);
|
workspace.appendChild(this._focusShape);
|
||||||
workspace.appendChild(this._controlPointsController);
|
workspace.appendChild(this._controlPointsController);
|
||||||
this._controlPointControllerListener =this._initializeControlPointController.bindWithEvent(this,workspace);
|
this._controlPointControllerListener = this._initializeControlPointController.bindWithEvent(this, workspace);
|
||||||
this._line2d.addEventListener('click', this._controlPointControllerListener);
|
this._line2d.addEventListener('click', this._controlPointControllerListener);
|
||||||
this._isInWorkspace = true;
|
this._isInWorkspace = true;
|
||||||
|
|
||||||
workspace.appendChild(this._startArrow);
|
workspace.appendChild(this._startArrow);
|
||||||
workspace.appendChild(this._endArrow);
|
workspace.appendChild(this._endArrow);
|
||||||
|
|
||||||
mindplot.RelationshipLine.superClass.addToWorkspace.call(this, workspace);
|
mindplot.ConnectionLine.prototype.addToWorkspace.call(this, workspace);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype._initializeControlPointController = function(event,workspace){
|
_initializeControlPointController : function(event, workspace) {
|
||||||
this.setOnFocus(true);
|
this.setOnFocus(true);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.removeFromWorkspace = function(workspace){
|
removeFromWorkspace : function(workspace) {
|
||||||
workspace.removeChild(this._focusShape);
|
workspace.removeChild(this._focusShape);
|
||||||
workspace.removeChild(this._controlPointsController);
|
workspace.removeChild(this._controlPointsController);
|
||||||
this._line2d.removeEventListener('click',this._controlPointControllerListener);
|
this._line2d.removeEventListener('click', this._controlPointControllerListener);
|
||||||
this._isInWorkspace = false;
|
this._isInWorkspace = false;
|
||||||
workspace.removeChild(this._startArrow);
|
workspace.removeChild(this._startArrow);
|
||||||
workspace.removeChild(this._endArrow);
|
workspace.removeChild(this._endArrow);
|
||||||
|
|
||||||
mindplot.RelationshipLine.superClass.removeFromWorkspace.call(this,workspace);
|
mindplot.ConnectionLine.prototype.removeFromWorkspace.call(this, workspace);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.getType = function(){
|
getType : function() {
|
||||||
return mindplot.RelationshipLine.type;
|
return mindplot.RelationshipLine.type;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setOnFocus = function(focus){
|
setOnFocus : function(focus) {
|
||||||
// Change focus shape
|
// Change focus shape
|
||||||
if(focus){
|
if (focus) {
|
||||||
this._refreshSelectedShape();
|
this._refreshSelectedShape();
|
||||||
this._controlPointsController.setLine(this);
|
this._controlPointsController.setLine(this);
|
||||||
}
|
}
|
||||||
@ -166,9 +158,9 @@ mindplot.RelationshipLine.prototype.setOnFocus = function(focus){
|
|||||||
|
|
||||||
this._controlPointsController.setVisibility(focus);
|
this._controlPointsController.setVisibility(focus);
|
||||||
this._onFocus = focus;
|
this._onFocus = focus;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype._refreshSelectedShape = function () {
|
_refreshSelectedShape : function () {
|
||||||
var sPos = this._line2d.getFrom();
|
var sPos = this._line2d.getFrom();
|
||||||
var tPos = this._line2d.getTo();
|
var tPos = this._line2d.getTo();
|
||||||
var ctrlPoints = this._line2d.getControlPoints();
|
var ctrlPoints = this._line2d.getControlPoints();
|
||||||
@ -182,102 +174,102 @@ mindplot.RelationshipLine.prototype._refreshSelectedShape = function () {
|
|||||||
this._focusShape.updateLine();
|
this._focusShape.updateLine();
|
||||||
//this._focusShape.setSrcControlPoint(ctrlPoints[0]);
|
//this._focusShape.setSrcControlPoint(ctrlPoints[0]);
|
||||||
//this._focusShape.setDestControlPoint(ctrlPoints[1]);
|
//this._focusShape.setDestControlPoint(ctrlPoints[1]);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.addEventListener = function(type, listener){
|
addEventListener : function(type, listener) {
|
||||||
// Translate to web 2d events ...
|
// Translate to web 2d events ...
|
||||||
if (type == 'onfocus')
|
if (type == 'onfocus') {
|
||||||
{
|
|
||||||
type = 'mousedown';
|
type = 'mousedown';
|
||||||
}
|
}
|
||||||
|
|
||||||
var line = this._line2d;
|
var line = this._line2d;
|
||||||
line.addEventListener(type, listener);
|
line.addEventListener(type, listener);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isOnFocus = function()
|
isOnFocus : function() {
|
||||||
{
|
|
||||||
return this._onFocus;
|
return this._onFocus;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isInWorkspace = function(){
|
isInWorkspace : function() {
|
||||||
return this._isInWorkspace;
|
return this._isInWorkspace;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setVisibility = function(value)
|
setVisibility : function(value) {
|
||||||
{
|
mindplot.ConnectionLine.prototype.setVisibility.call(this, value);
|
||||||
mindplot.RelationshipLine.superClass.setVisibility.call(this,value);
|
|
||||||
this._endArrow.setVisibility(this._showEndArrow && value);
|
this._endArrow.setVisibility(this._showEndArrow && value);
|
||||||
this._startArrow.setVisibility(this._showStartArrow && value);
|
this._startArrow.setVisibility(this._showStartArrow && value);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setOpacity = function(opacity){
|
setOpacity : function(opacity) {
|
||||||
mindplot.RelationshipLine.superClass.setOpacity.call(this,opacity);
|
mindplot.ConnectionLine.prototype.setOpacity.call(this, opacity);
|
||||||
if(this._showEndArrow)
|
if (this._showEndArrow)
|
||||||
this._endArrow.setOpacity(opacity);
|
this._endArrow.setOpacity(opacity);
|
||||||
if(this._showStartArrow)
|
if (this._showStartArrow)
|
||||||
this._startArrow.setOpacity(opacity);
|
this._startArrow.setOpacity(opacity);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setShowEndArrow = function(visible){
|
setShowEndArrow : function(visible) {
|
||||||
this._showEndArrow = visible;
|
this._showEndArrow = visible;
|
||||||
if(this._isInWorkspace)
|
if (this._isInWorkspace)
|
||||||
this.redraw();
|
this.redraw();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setShowStartArrow = function(visible){
|
setShowStartArrow : function(visible) {
|
||||||
this._showStartArrow = visible;
|
this._showStartArrow = visible;
|
||||||
if(this._isInWorkspace)
|
if (this._isInWorkspace)
|
||||||
this.redraw();
|
this.redraw();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isShowEndArrow = function(){
|
isShowEndArrow : function() {
|
||||||
return this._showEndArrow;
|
return this._showEndArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isShowStartArrow = function(){
|
isShowStartArrow : function() {
|
||||||
return this._showStartArrow;
|
return this._showStartArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setFrom = function(x,y){
|
setFrom : function(x, y) {
|
||||||
this._line2d.setFrom(x,y);
|
this._line2d.setFrom(x, y);
|
||||||
this._startArrow.setFrom(x,y);
|
this._startArrow.setFrom(x, y);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setTo = function(x,y){
|
setTo : function(x, y) {
|
||||||
this._line2d.setTo(x,y);
|
this._line2d.setTo(x, y);
|
||||||
this._endArrow.setFrom(x,y);
|
this._endArrow.setFrom(x, y);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setSrcControlPoint = function(control){
|
setSrcControlPoint : function(control) {
|
||||||
this._line2d.setSrcControlPoint(control);
|
this._line2d.setSrcControlPoint(control);
|
||||||
this._startArrow.setControlPoint(control);
|
this._startArrow.setControlPoint(control);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setDestControlPoint = function(control){
|
setDestControlPoint : function(control) {
|
||||||
this._line2d.setDestControlPoint(control);
|
this._line2d.setDestControlPoint(control);
|
||||||
this._endArrow.setControlPoint(control);
|
this._endArrow.setControlPoint(control);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.getControlPoints = function(){
|
getControlPoints : function() {
|
||||||
return this._line2d.getControlPoints();
|
return this._line2d.getControlPoints();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isSrcControlPointCustom = function(){
|
isSrcControlPointCustom : function() {
|
||||||
return this._line2d.isSrcControlPointCustom();
|
return this._line2d.isSrcControlPointCustom();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.isDestControlPointCustom = function(){
|
isDestControlPointCustom : function() {
|
||||||
return this._line2d.isDestControlPointCustom();
|
return this._line2d.isDestControlPointCustom();
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setIsSrcControlPointCustom = function(isCustom){
|
setIsSrcControlPointCustom : function(isCustom) {
|
||||||
this._line2d.setIsSrcControlPointCustom(isCustom);
|
this._line2d.setIsSrcControlPointCustom(isCustom);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipLine.prototype.setIsDestControlPointCustom = function(isCustom){
|
setIsDestControlPointCustom : function(isCustom) {
|
||||||
this._line2d.setIsDestControlPointCustom(isCustom);
|
this._line2d.setIsDestControlPointCustom(isCustom);
|
||||||
};
|
}});
|
||||||
|
|
||||||
|
|
||||||
mindplot.RelationshipLine.type = "RelationshipLine";
|
mindplot.RelationshipLine.type = "RelationshipLine";
|
||||||
|
mindplot.RelationshipLine.getStrokeColor = function() {
|
||||||
|
return '#9b74e6';
|
||||||
|
}
|
||||||
|
@ -1,90 +1,88 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.RelationshipModel = function(fromNode, toNode)
|
mindplot.RelationshipModel = new Class({
|
||||||
{
|
initialize:function(fromNode, toNode) {
|
||||||
$assert(fromNode, 'from node type can not be null');
|
$assert(fromNode, 'from node type can not be null');
|
||||||
$assert(toNode, 'to node type can not be null');
|
$assert(toNode, 'to node type can not be null');
|
||||||
|
|
||||||
this._id = mindplot.RelationshipModel._nextUUID();
|
this._id = mindplot.RelationshipModel._nextUUID();
|
||||||
this._fromNode = fromNode;
|
this._fromNode = fromNode;
|
||||||
this._toNode = toNode;
|
this._toNode = toNode;
|
||||||
this._lineType=mindplot.ConnectionLine.SIMPLE_CURVED;
|
this._lineType = mindplot.ConnectionLine.SIMPLE_CURVED;
|
||||||
this._srcCtrlPoint=null;
|
this._srcCtrlPoint = null;
|
||||||
this._destCtrlPoint=null;
|
this._destCtrlPoint = null;
|
||||||
this._endArrow=true;
|
this._endArrow = true;
|
||||||
this._startArrow=false;
|
this._startArrow = false;
|
||||||
this._ctrlPointRelative=false;
|
},
|
||||||
|
|
||||||
};
|
getFromNode : function() {
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getFromNode=function(){
|
|
||||||
return this._fromNode;
|
return this._fromNode;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getToNode=function(){
|
getToNode : function() {
|
||||||
return this._toNode;
|
return this._toNode;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getId=function(){
|
getId : function() {
|
||||||
return this._id;
|
return this._id;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getLineType = function(){
|
getLineType : function() {
|
||||||
return this._lineType;
|
return this._lineType;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.setLineType = function(lineType){
|
setLineType : function(lineType) {
|
||||||
this._lineType = lineType;
|
this._lineType = lineType;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getSrcCtrlPoint= function(){
|
getSrcCtrlPoint : function() {
|
||||||
return this._srcCtrlPoint;
|
return this._srcCtrlPoint;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.setSrcCtrlPoint= function(srcCtrlPoint){
|
setSrcCtrlPoint : function(srcCtrlPoint) {
|
||||||
this._srcCtrlPoint = srcCtrlPoint;
|
this._srcCtrlPoint = srcCtrlPoint;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getDestCtrlPoint= function(){
|
getDestCtrlPoint : function() {
|
||||||
return this._destCtrlPoint;
|
return this._destCtrlPoint;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.setDestCtrlPoint= function(destCtrlPoint){
|
setDestCtrlPoint : function(destCtrlPoint) {
|
||||||
this._destCtrlPoint = destCtrlPoint;
|
this._destCtrlPoint = destCtrlPoint;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getEndArrow= function(){
|
getEndArrow : function() {
|
||||||
return this._endArrow;
|
return this._endArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.setEndArrow= function(endArrow){
|
setEndArrow : function(endArrow) {
|
||||||
this._endArrow = endArrow;
|
this._endArrow = endArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.getStartArrow= function(){
|
getStartArrow : function() {
|
||||||
return this._startArrow;
|
return this._startArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.setStartArrow= function(startArrow){
|
setStartArrow : function(startArrow) {
|
||||||
this._startArrow = startArrow;
|
this._startArrow = startArrow;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.clone = function(model){
|
clone : function(model) {
|
||||||
var result = new mindplot.RelationshipModel(this._fromNode, this._toNode);
|
var result = new mindplot.RelationshipModel(this._fromNode, this._toNode);
|
||||||
result._id = this._id;
|
result._id = this._id;
|
||||||
result._lineType = this._lineType;
|
result._lineType = this._lineType;
|
||||||
@ -93,24 +91,23 @@ mindplot.RelationshipModel.prototype.clone = function(model){
|
|||||||
result._endArrow = this._endArrow;
|
result._endArrow = this._endArrow;
|
||||||
result._startArrow = this._startArrow;
|
result._startArrow = this._startArrow;
|
||||||
return result;
|
return result;
|
||||||
};
|
},
|
||||||
|
|
||||||
|
inspect : function() {
|
||||||
|
return '(fromNode:' + this.getFromNode().getId() + ' , toNode: ' + this.getToNode().getId() + ')';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo: This method must be implemented.
|
* @todo: This method must be implemented.
|
||||||
*/
|
*/
|
||||||
mindplot.RelationshipModel._nextUUID = function()
|
mindplot.RelationshipModel._nextUUID = function() {
|
||||||
{
|
if (!$defined(this._uuid)) {
|
||||||
if (!$defined(this._uuid))
|
|
||||||
{
|
|
||||||
this._uuid = 0;
|
this._uuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._uuid = this._uuid + 1;
|
this._uuid = this._uuid + 1;
|
||||||
return this._uuid;
|
return this._uuid;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
mindplot.RelationshipModel.prototype.inspect = function()
|
|
||||||
{
|
|
||||||
return '(fromNode:' + this.getFromNode().getId() + ' , toNode: ' + this.getToNode().getId() + ')';
|
|
||||||
};
|
|
||||||
|
@ -1,43 +1,42 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.ScreenManager = function(width, height, divElement)
|
mindplot.ScreenManager = new Class({
|
||||||
{
|
initialize:function(width, height, divElement) {
|
||||||
|
$assert(divElement, "can not be null");
|
||||||
this._divContainer = divElement;
|
this._divContainer = divElement;
|
||||||
this._offset = {x:0,y:0};
|
this._offset = {x:0,y:0};
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.setScale = function(scale)
|
setScale : function(scale) {
|
||||||
{
|
$assert(scale, 'Screen scale can not be null');
|
||||||
$assert($defined(scale), 'Screen scale can not be null');
|
|
||||||
this._workspaceScale = scale;
|
this._workspaceScale = scale;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.addEventListener=function(event, listener){
|
addEventListener : function(event, listener) {
|
||||||
$(this._divContainer).addEvent(event, listener);
|
$(this._divContainer).addEvent(event, listener);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.removeEventListener=function(event, listener){
|
removeEventListener : function(event, listener) {
|
||||||
$(this._divContainer).removeEvent(event, listener);
|
$(this._divContainer).removeEvent(event, listener);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.getWorkspaceElementPosition = function(e)
|
getWorkspaceElementPosition : function(e) {
|
||||||
{
|
|
||||||
// Retrive current element position.
|
// Retrive current element position.
|
||||||
var elementPosition = e.getPosition();
|
var elementPosition = e.getPosition();
|
||||||
var x = elementPosition.x;
|
var x = elementPosition.x;
|
||||||
@ -53,17 +52,16 @@ mindplot.ScreenManager.prototype.getWorkspaceElementPosition = function(e)
|
|||||||
|
|
||||||
// Subtract div position.
|
// Subtract div position.
|
||||||
/* var containerElem = this.getContainer();
|
/* var containerElem = this.getContainer();
|
||||||
var containerPosition = core.Utils.workOutDivElementPosition(containerElem);
|
var containerPosition = core.Utils.workOutDivElementPosition(containerElem);
|
||||||
x = x + containerPosition.x;
|
x = x + containerPosition.x;
|
||||||
y = y + containerPosition.y;*/
|
y = y + containerPosition.y;*/
|
||||||
|
|
||||||
// Remove decimal part..
|
// Remove decimal part..
|
||||||
return {x:x,y:y};
|
return {x:x,y:y};
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.getWorkspaceIconPosition = function(e)
|
getWorkspaceIconPosition : function(e) {
|
||||||
{
|
// Retrieve current icon position.
|
||||||
// Retrive current icon position.
|
|
||||||
var image = e.getImage();
|
var image = e.getImage();
|
||||||
var elementPosition = image.getPosition();
|
var elementPosition = image.getPosition();
|
||||||
var imageSize = e.getSize();
|
var imageSize = e.getSize();
|
||||||
@ -71,14 +69,14 @@ mindplot.ScreenManager.prototype.getWorkspaceIconPosition = function(e)
|
|||||||
//Add group offset
|
//Add group offset
|
||||||
var iconGroup = e.getGroup();
|
var iconGroup = e.getGroup();
|
||||||
var group = iconGroup.getNativeElement();
|
var group = iconGroup.getNativeElement();
|
||||||
var coordOrigin=group.getCoordOrigin();
|
var coordOrigin = group.getCoordOrigin();
|
||||||
var groupSize = group.getSize();
|
var groupSize = group.getSize();
|
||||||
var coordSize = group.getCoordSize();
|
var coordSize = group.getCoordSize();
|
||||||
|
|
||||||
var scale={x:coordSize.width/parseInt(groupSize.width), y:coordSize.height/parseInt(groupSize.height)};
|
var scale = {x:coordSize.width / parseInt(groupSize.width), y:coordSize.height / parseInt(groupSize.height)};
|
||||||
|
|
||||||
var x = (elementPosition.x - coordOrigin.x-(parseInt(imageSize.width)/2))/scale.x;
|
var x = (elementPosition.x - coordOrigin.x - (parseInt(imageSize.width) / 2)) / scale.x;
|
||||||
var y = (elementPosition.y - coordOrigin.y-(parseInt(imageSize.height)/2))/scale.y;
|
var y = (elementPosition.y - coordOrigin.y - (parseInt(imageSize.height) / 2)) / scale.y;
|
||||||
|
|
||||||
//Retrieve iconGroup Position
|
//Retrieve iconGroup Position
|
||||||
var groupPosition = iconGroup.getPosition();
|
var groupPosition = iconGroup.getPosition();
|
||||||
@ -88,15 +86,14 @@ mindplot.ScreenManager.prototype.getWorkspaceIconPosition = function(e)
|
|||||||
//Retrieve topic Position
|
//Retrieve topic Position
|
||||||
var topic = iconGroup.getTopic();
|
var topic = iconGroup.getTopic();
|
||||||
var topicPosition = this.getWorkspaceElementPosition(topic);
|
var topicPosition = this.getWorkspaceElementPosition(topic);
|
||||||
topicPosition.x = topicPosition.x - (parseInt(topic.getSize().width)/2);
|
topicPosition.x = topicPosition.x - (parseInt(topic.getSize().width) / 2);
|
||||||
|
|
||||||
|
|
||||||
// Remove decimal part..
|
// Remove decimal part..
|
||||||
return {x:x+topicPosition.x,y:y+topicPosition.y};
|
return {x:x + topicPosition.x,y:y + topicPosition.y};
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.getWorkspaceMousePosition = function(e)
|
getWorkspaceMousePosition : function(e) {
|
||||||
{
|
|
||||||
// Retrive current mouse position.
|
// Retrive current mouse position.
|
||||||
var mousePosition = this._getMousePosition(e);
|
var mousePosition = this._getMousePosition(e);
|
||||||
var x = mousePosition.x;
|
var x = mousePosition.x;
|
||||||
@ -118,23 +115,20 @@ mindplot.ScreenManager.prototype.getWorkspaceMousePosition = function(e)
|
|||||||
|
|
||||||
// Remove decimal part..
|
// Remove decimal part..
|
||||||
return new core.Point(x, y);
|
return new core.Point(x, y);
|
||||||
};
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.howtocreate.co.uk/tutorials/javascript/eventinfo
|
* http://www.howtocreate.co.uk/tutorials/javascript/eventinfo
|
||||||
*/
|
*/
|
||||||
mindplot.ScreenManager.prototype._getMousePosition = function(event)
|
_getMousePosition : function(event) {
|
||||||
{
|
|
||||||
return core.Utils.getMousePosition(event);
|
return core.Utils.getMousePosition(event);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.getContainer = function()
|
getContainer : function() {
|
||||||
{
|
|
||||||
return this._divContainer;
|
return this._divContainer;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.ScreenManager.prototype.setOffset = function(x, y)
|
setOffset : function(x, y) {
|
||||||
{
|
|
||||||
this._offset.x = x;
|
this._offset.x = x;
|
||||||
this._offset.y = y;
|
this._offset.y = y;
|
||||||
};
|
}});
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.SingleCommandDispatcher = new Class({
|
mindplot.SingleCommandDispatcher = new Class(
|
||||||
|
{
|
||||||
Extends:mindplot.BaseCommandDispatcher,
|
Extends:mindplot.BaseCommandDispatcher,
|
||||||
initialize: function()
|
initialize: function() {
|
||||||
{
|
|
||||||
|
|
||||||
},
|
},
|
||||||
addIconToTopic: function() {
|
addIconToTopic: function() {
|
||||||
|
@ -17,13 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.TextEditor = new Class({
|
mindplot.TextEditor = new Class({
|
||||||
initialize:function(designer,actionRunner)
|
initialize:function(designer, actionRunner) {
|
||||||
{
|
|
||||||
this._designer = designer;
|
this._designer = designer;
|
||||||
this._screenManager = designer.getWorkSpace().getScreenManager();
|
this._screenManager = designer.getWorkSpace().getScreenManager();
|
||||||
this._container = this._screenManager.getContainer();
|
this._container = this._screenManager.getContainer();
|
||||||
this._actionRunner = actionRunner;
|
this._actionRunner = actionRunner;
|
||||||
this._isVisible=false;
|
this._isVisible = false;
|
||||||
|
|
||||||
//Create editor ui
|
//Create editor ui
|
||||||
this._createUI();
|
this._createUI();
|
||||||
@ -31,7 +30,8 @@ mindplot.TextEditor = new Class({
|
|||||||
this._addListeners();
|
this._addListeners();
|
||||||
|
|
||||||
},
|
},
|
||||||
_createUI:function(){
|
|
||||||
|
_createUI:function() {
|
||||||
this._size = {width:500, height:100};
|
this._size = {width:500, height:100};
|
||||||
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: 0, left:0, width:"500px", height:"100px"});
|
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: 0, left:0, width:"500px", height:"100px"});
|
||||||
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).inject(this._myOverlay);
|
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).inject(this._myOverlay);
|
||||||
@ -40,21 +40,19 @@ mindplot.TextEditor = new Class({
|
|||||||
this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').inject(spanContainer);
|
this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').inject(spanContainer);
|
||||||
this._myOverlay.inject(this._container);
|
this._myOverlay.inject(this._container);
|
||||||
},
|
},
|
||||||
_addListeners:function(){
|
|
||||||
|
_addListeners:function() {
|
||||||
var elem = this;
|
var elem = this;
|
||||||
this.applyChanges=true;
|
this.applyChanges = true;
|
||||||
this.inputText.onkeyup = function (evt) {
|
this.inputText.onkeyup = function (evt) {
|
||||||
var event = new Event(evt);
|
var event = new Event(evt);
|
||||||
var key = event.key;
|
var key = event.key;
|
||||||
switch(key)
|
switch (key) {
|
||||||
{
|
|
||||||
case 'esc':
|
case 'esc':
|
||||||
elem.applyChanges=false;
|
elem.applyChanges = false;
|
||||||
case 'enter':
|
case 'enter':
|
||||||
var executor = function(editor)
|
var executor = function(editor) {
|
||||||
{
|
return function() {
|
||||||
return function()
|
|
||||||
{
|
|
||||||
elem.lostFocus(true);
|
elem.lostFocus(true);
|
||||||
$(document.documentElement).fireEvent('focus');
|
$(document.documentElement).fireEvent('focus');
|
||||||
};
|
};
|
||||||
@ -63,13 +61,12 @@ mindplot.TextEditor = new Class({
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var span =$('spanText');
|
var span = $('spanText');
|
||||||
var input = $('inputText');
|
var input = $('inputText');
|
||||||
span.innerHTML = input.value;
|
span.innerHTML = input.value;
|
||||||
var size = input.value.length + 1;
|
var size = input.value.length + 1;
|
||||||
input.size= size;
|
input.size = size;
|
||||||
if (span.offsetWidth > (parseInt(elem._myOverlay.style.width) - 100))
|
if (span.offsetWidth > (parseInt(elem._myOverlay.style.width) - 100)) {
|
||||||
{
|
|
||||||
elem._myOverlay.style.width = (span.offsetWidth + 100) + "px";
|
elem._myOverlay.style.width = (span.offsetWidth + 100) + "px";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -84,18 +81,16 @@ mindplot.TextEditor = new Class({
|
|||||||
var elem = this;
|
var elem = this;
|
||||||
var onComplete = function() {
|
var onComplete = function() {
|
||||||
this._myOverlay.setStyle('display', "none");
|
this._myOverlay.setStyle('display', "none");
|
||||||
this._isVisible=false;
|
this._isVisible = false;
|
||||||
this.inputText.setStyle('opacity', 1);
|
this.inputText.setStyle('opacity', 1);
|
||||||
|
|
||||||
this.setPosition(0, 0);
|
this.setPosition(0, 0);
|
||||||
if (elem._currentNode != null)
|
if (elem._currentNode != null) {
|
||||||
{
|
|
||||||
this._currentNode.getTextShape().setVisibility(true);
|
this._currentNode.getTextShape().setVisibility(true);
|
||||||
if(this.applyChanges)
|
if (this.applyChanges) {
|
||||||
{
|
|
||||||
this._updateNode();
|
this._updateNode();
|
||||||
}
|
}
|
||||||
this.applyChanges=true;
|
this.applyChanges = true;
|
||||||
this._currentNode = null;
|
this._currentNode = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,76 +99,69 @@ mindplot.TextEditor = new Class({
|
|||||||
this.fx = new Fx.Tween(this.inputText, {property: 'opacity', duration: 10});
|
this.fx = new Fx.Tween(this.inputText, {property: 'opacity', duration: 10});
|
||||||
this.fx.addEvent('onComplete', onComplete.bind(this));
|
this.fx.addEvent('onComplete', onComplete.bind(this));
|
||||||
},
|
},
|
||||||
lostFocusEvent : function ()
|
|
||||||
{
|
lostFocusEvent : function () {
|
||||||
this.fx.options.duration = 10;
|
this.fx.options.duration = 10;
|
||||||
this.fx.start(1, 0);
|
this.fx.start(1, 0);
|
||||||
//myAnim.animate();
|
//myAnim.animate();
|
||||||
},
|
},
|
||||||
isVisible : function ()
|
|
||||||
{
|
isVisible : function () {
|
||||||
return this._isVisible;
|
return this._isVisible;
|
||||||
},
|
},
|
||||||
getFocusEvent: function (node)
|
|
||||||
{
|
getFocusEvent: function (node) {
|
||||||
//console.log('focus event');
|
//console.log('focus event');
|
||||||
if (this.isVisible())
|
if (this.isVisible()) {
|
||||||
{
|
|
||||||
this.getFocusEvent.delay(10, this);
|
this.getFocusEvent.delay(10, this);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//console.log('calling init');
|
//console.log('calling init');
|
||||||
this.init(node);
|
this.init(node);
|
||||||
}
|
}
|
||||||
//console.log('focus event done');
|
//console.log('focus event done');
|
||||||
},
|
},
|
||||||
setInitialText : function (text)
|
|
||||||
{
|
|
||||||
this.initialText=text;
|
|
||||||
},
|
|
||||||
_updateNode : function ()
|
|
||||||
{
|
|
||||||
|
|
||||||
if ($defined(this._currentNode) && this._currentNode.getText() != this.getText())
|
setInitialText : function (text) {
|
||||||
{
|
this.initialText = text;
|
||||||
|
},
|
||||||
|
|
||||||
|
_updateNode : function () {
|
||||||
|
|
||||||
|
if ($defined(this._currentNode) && this._currentNode.getText() != this.getText()) {
|
||||||
var text = this.getText();
|
var text = this.getText();
|
||||||
var topicId = this._currentNode.getId();
|
var topicId = this._currentNode.getId();
|
||||||
|
|
||||||
var commandFunc = function(topic,value)
|
var commandFunc = function(topic, value) {
|
||||||
{
|
|
||||||
var result = topic.getText();
|
var result = topic.getText();
|
||||||
topic.setText(value);
|
topic.setText(value);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc,text,[topicId]);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, text, [topicId]);
|
||||||
this._actionRunner.execute(command);
|
this._actionRunner.execute(command);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
listenEventOnNode : function(topic, eventName, stopPropagation)
|
|
||||||
{
|
listenEventOnNode : function(topic, eventName, stopPropagation) {
|
||||||
var elem = this;
|
var elem = this;
|
||||||
topic.addEventListener(eventName, function (event) {
|
topic.addEventListener(eventName, function (event) {
|
||||||
if(elem._designer.getWorkSpace().isWorkspaceEventsEnabled()){
|
if (elem._designer.getWorkSpace().isWorkspaceEventsEnabled()) {
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOutEvent,[topic ]);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOutEvent, [topic ]);
|
||||||
elem.lostFocus();
|
elem.lostFocus();
|
||||||
elem.getFocusEvent.attempt(topic, elem);
|
elem.getFocusEvent.attempt(topic, elem);
|
||||||
|
|
||||||
if (stopPropagation)
|
if (stopPropagation) {
|
||||||
{
|
if ($defined(event.stopPropagation)) {
|
||||||
if ($defined(event.stopPropagation))
|
|
||||||
{
|
|
||||||
event.stopPropagation(true);
|
event.stopPropagation(true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
event.cancelBubble = true;
|
event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init : function (nodeGraph)
|
|
||||||
{
|
init : function (nodeGraph) {
|
||||||
//console.log('init method');
|
//console.log('init method');
|
||||||
nodeGraph.getTextShape().setVisibility(false);
|
nodeGraph.getTextShape().setVisibility(false);
|
||||||
this._currentNode = nodeGraph;
|
this._currentNode = nodeGraph;
|
||||||
@ -181,12 +169,11 @@ mindplot.TextEditor = new Class({
|
|||||||
//set Editor Style
|
//set Editor Style
|
||||||
var nodeText = nodeGraph.getTextShape();
|
var nodeText = nodeGraph.getTextShape();
|
||||||
var text;
|
var text;
|
||||||
var selectText=true;
|
var selectText = true;
|
||||||
if(this.initialText && this.initialText!="")
|
if (this.initialText && this.initialText != "") {
|
||||||
{
|
|
||||||
text = this.initialText;
|
text = this.initialText;
|
||||||
this.initialText=null;
|
this.initialText = null;
|
||||||
selectText=false;
|
selectText = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
text = nodeText.getText();
|
text = nodeText.getText();
|
||||||
@ -202,10 +189,8 @@ mindplot.TextEditor = new Class({
|
|||||||
|
|
||||||
//set editor's initial size
|
//set editor's initial size
|
||||||
var editor = this;
|
var editor = this;
|
||||||
var executor = function(editor)
|
var executor = function(editor) {
|
||||||
{
|
return function() {
|
||||||
return function()
|
|
||||||
{
|
|
||||||
//console.log('setting editor in init thread');
|
//console.log('setting editor in init thread');
|
||||||
var scale = web2d.peer.utils.TransformUtil.workoutScale(editor._currentNode.getTextShape()._peer);
|
var scale = web2d.peer.utils.TransformUtil.workoutScale(editor._currentNode.getTextShape()._peer);
|
||||||
var elemSize = editor._currentNode.getSize();
|
var elemSize = editor._currentNode.getSize();
|
||||||
@ -216,17 +201,15 @@ mindplot.TextEditor = new Class({
|
|||||||
var textHeight = editor._currentNode.getTextShape().getHeight();
|
var textHeight = editor._currentNode.getTextShape().getHeight();
|
||||||
var iconGroup = editor._currentNode.getIconGroup();
|
var iconGroup = editor._currentNode.getIconGroup();
|
||||||
var iconGroupSize;
|
var iconGroupSize;
|
||||||
if($chk(iconGroup))
|
if ($chk(iconGroup)) {
|
||||||
{
|
|
||||||
iconGroupSize = editor._currentNode.getIconGroup().getSize();
|
iconGroupSize = editor._currentNode.getIconGroup().getSize();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
iconGroupSize = {width:0, height:0};
|
iconGroupSize = {width:0, height:0};
|
||||||
}
|
}
|
||||||
var position = {x:0,y:0};
|
var position = {x:0,y:0};
|
||||||
position.x = pos.x - ((textWidth * scale.width) / 2) + (((iconGroupSize.width) * scale.width)/2);
|
position.x = pos.x - ((textWidth * scale.width) / 2) + (((iconGroupSize.width) * scale.width) / 2);
|
||||||
var fixError =1;
|
var fixError = 1;
|
||||||
position.y = pos.y - ((textHeight * scale.height) / 2) - fixError;
|
position.y = pos.y - ((textHeight * scale.height) / 2) - fixError;
|
||||||
|
|
||||||
editor.setEditorSize(elemSize.width, elemSize.height, scale);
|
editor.setEditorSize(elemSize.width, elemSize.height, scale);
|
||||||
@ -240,24 +223,20 @@ mindplot.TextEditor = new Class({
|
|||||||
setTimeout(executor(this), 10);
|
setTimeout(executor(this), 10);
|
||||||
//console.log('init done');
|
//console.log('init done');
|
||||||
},
|
},
|
||||||
setStyle : function (fontStyle)
|
|
||||||
{
|
setStyle : function (fontStyle) {
|
||||||
var inputField = $("inputText");
|
var inputField = $("inputText");
|
||||||
var spanField = $("spanText");
|
var spanField = $("spanText");
|
||||||
if (!$defined(fontStyle.font))
|
if (!$defined(fontStyle.font)) {
|
||||||
{
|
|
||||||
fontStyle.font = "Arial";
|
fontStyle.font = "Arial";
|
||||||
}
|
}
|
||||||
if (!$defined(fontStyle.style))
|
if (!$defined(fontStyle.style)) {
|
||||||
{
|
|
||||||
fontStyle.style = "normal";
|
fontStyle.style = "normal";
|
||||||
}
|
}
|
||||||
if (!$defined(fontStyle.weight))
|
if (!$defined(fontStyle.weight)) {
|
||||||
{
|
|
||||||
fontStyle.weight = "normal";
|
fontStyle.weight = "normal";
|
||||||
}
|
}
|
||||||
if (!$defined(fontStyle.size))
|
if (!$defined(fontStyle.size)) {
|
||||||
{
|
|
||||||
fontStyle.size = 12;
|
fontStyle.size = 12;
|
||||||
}
|
}
|
||||||
inputField.style.fontSize = fontStyle.size + "px";
|
inputField.style.fontSize = fontStyle.size + "px";
|
||||||
@ -270,8 +249,8 @@ mindplot.TextEditor = new Class({
|
|||||||
spanField.style.fontWeight = fontStyle.weight;
|
spanField.style.fontWeight = fontStyle.weight;
|
||||||
spanField.style.fontSize = fontStyle.size + "px";
|
spanField.style.fontSize = fontStyle.size + "px";
|
||||||
},
|
},
|
||||||
setText : function(text)
|
|
||||||
{
|
setText : function(text) {
|
||||||
var inputField = $("inputText");
|
var inputField = $("inputText");
|
||||||
inputField.size = text.length + 1;
|
inputField.size = text.length + 1;
|
||||||
//this._myOverlay.cfg.setProperty("width", (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px");
|
//this._myOverlay.cfg.setProperty("width", (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px");
|
||||||
@ -280,12 +259,12 @@ mindplot.TextEditor = new Class({
|
|||||||
spanField.innerHTML = text;
|
spanField.innerHTML = text;
|
||||||
inputField.value = text;
|
inputField.value = text;
|
||||||
},
|
},
|
||||||
getText : function()
|
|
||||||
{
|
getText : function() {
|
||||||
return $('inputText').value;
|
return $('inputText').value;
|
||||||
},
|
},
|
||||||
setEditorSize : function (width, height, scale)
|
|
||||||
{
|
setEditorSize : function (width, height, scale) {
|
||||||
//var scale = web2d.peer.utils.TransformUtil.workoutScale(this._currentNode.getTextShape()._peer);
|
//var scale = web2d.peer.utils.TransformUtil.workoutScale(this._currentNode.getTextShape()._peer);
|
||||||
this._size = {width:width * scale.width, height:height * scale.height};
|
this._size = {width:width * scale.width, height:height * scale.height};
|
||||||
//this._myOverlay.cfg.setProperty("width",this._size.width*2+"px");
|
//this._myOverlay.cfg.setProperty("width",this._size.width*2+"px");
|
||||||
@ -293,17 +272,17 @@ mindplot.TextEditor = new Class({
|
|||||||
//this._myOverlay.cfg.setProperty("height",this._size.height+"px");
|
//this._myOverlay.cfg.setProperty("height",this._size.height+"px");
|
||||||
this._myOverlay.style.height = this._size.height + "px";
|
this._myOverlay.style.height = this._size.height + "px";
|
||||||
},
|
},
|
||||||
getSize : function ()
|
|
||||||
{
|
getSize : function () {
|
||||||
return {width:$("spanText").offsetWidth,height:$("spanText").offsetHeight};
|
return {width:$("spanText").offsetWidth,height:$("spanText").offsetHeight};
|
||||||
},
|
},
|
||||||
setPosition : function (x, y, scale)
|
|
||||||
{
|
setPosition : function (x, y, scale) {
|
||||||
$(this._myOverlay).setStyles({top : y + "px", left: x + "px"});
|
$(this._myOverlay).setStyles({top : y + "px", left: x + "px"});
|
||||||
//this._myOverlay.style.left = x + "px";
|
//this._myOverlay.style.left = x + "px";
|
||||||
},
|
},
|
||||||
showTextEditor : function(selectText)
|
|
||||||
{
|
showTextEditor : function(selectText) {
|
||||||
//this._myOverlay.show();
|
//this._myOverlay.show();
|
||||||
//var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut);
|
//var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut);
|
||||||
//$('inputText').style.opacity='1';
|
//$('inputText').style.opacity='1';
|
||||||
@ -311,7 +290,7 @@ mindplot.TextEditor = new Class({
|
|||||||
//myAnim.onComplete.subscribe(function(){
|
//myAnim.onComplete.subscribe(function(){
|
||||||
//elem._myOverlay.show();
|
//elem._myOverlay.show();
|
||||||
elem._myOverlay.setStyle('display', "block");
|
elem._myOverlay.setStyle('display', "block");
|
||||||
this._isVisible=true;
|
this._isVisible = true;
|
||||||
//elem.cfg.setProperty("visible", false);
|
//elem.cfg.setProperty("visible", false);
|
||||||
//elem._myOverlay.cfg.setProperty("xy", [0, 0]);
|
//elem._myOverlay.cfg.setProperty("xy", [0, 0]);
|
||||||
//elem._myOverlay.cfg.setProperty("visible", true);
|
//elem._myOverlay.cfg.setProperty("visible", true);
|
||||||
@ -322,31 +301,25 @@ mindplot.TextEditor = new Class({
|
|||||||
{
|
{
|
||||||
var range = $('inputText').createTextRange();
|
var range = $('inputText').createTextRange();
|
||||||
var pos = $('inputText').value.length;
|
var pos = $('inputText').value.length;
|
||||||
if(selectText)
|
if (selectText) {
|
||||||
{
|
|
||||||
range.select();
|
range.select();
|
||||||
range.move("character", pos);
|
range.move("character", pos);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
range.move("character", pos);
|
range.move("character", pos);
|
||||||
range.select();
|
range.select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(selectText)
|
else if (selectText) {
|
||||||
{
|
|
||||||
$('inputText').setSelectionRange(0, $('inputText').value.length);
|
$('inputText').setSelectionRange(0, $('inputText').value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
var executor = function(editor)
|
var executor = function(editor) {
|
||||||
{
|
return function() {
|
||||||
return function()
|
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
$('inputText').focus();
|
$('inputText').focus();
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -356,35 +329,30 @@ mindplot.TextEditor = new Class({
|
|||||||
//myAnim.animate();
|
//myAnim.animate();
|
||||||
|
|
||||||
},
|
},
|
||||||
lostFocus : function(bothBrowsers)
|
|
||||||
{
|
lostFocus : function(bothBrowsers) {
|
||||||
if (this.isVisible())
|
if (this.isVisible()) {
|
||||||
{
|
|
||||||
//the editor is opened in another node. lets Finish it.
|
//the editor is opened in another node. lets Finish it.
|
||||||
var fireOnThis = $('inputText');
|
var fireOnThis = $('inputText');
|
||||||
fireOnThis.fireEvent('blur');
|
fireOnThis.fireEvent('blur');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clickEvent : function(event){
|
clickEvent : function(event) {
|
||||||
if(this.isVisible()){
|
if (this.isVisible()) {
|
||||||
if ($defined(event.stopPropagation))
|
if ($defined(event.stopPropagation)) {
|
||||||
{
|
|
||||||
event.stopPropagation(true);
|
event.stopPropagation(true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
event.cancelBubble = true;
|
event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
mouseDownEvent : function(event){
|
mouseDownEvent : function(event) {
|
||||||
if(this.isVisible()){
|
if (this.isVisible()) {
|
||||||
if ($defined(event.stopPropagation))
|
if ($defined(event.stopPropagation)) {
|
||||||
{
|
|
||||||
event.stopPropagation(true);
|
event.stopPropagation(true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
event.cancelBubble = true;
|
event.cancelBubble = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.TextEditorFactory={};
|
mindplot.TextEditorFactory = {};
|
||||||
|
|
||||||
mindplot.TextEditorFactory.getTextEditorFromName = function(name){
|
mindplot.TextEditorFactory.getTextEditorFromName = function(name) {
|
||||||
var editorClass = null;
|
var editorClass = null;
|
||||||
if(name == "RichTextEditor"){
|
if (name == "RichTextEditor") {
|
||||||
editorClass = mindplot.RichTextEditor;
|
editorClass = mindplot.RichTextEditor;
|
||||||
}else {
|
} else {
|
||||||
editorClass = mindplot.TextEditor;
|
editorClass = mindplot.TextEditor;
|
||||||
}
|
}
|
||||||
return editorClass;
|
return editorClass;
|
||||||
|
@ -1,27 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.Tip = function(divContainer){
|
mindplot.Tip = new Class({
|
||||||
this.initialize(divContainer);
|
initialize:function(divContainer) {
|
||||||
};
|
this.options = {
|
||||||
|
|
||||||
mindplot.Tip.prototype.initialize=function(divContainer){
|
|
||||||
this.options={
|
|
||||||
panel:null,
|
panel:null,
|
||||||
container:null,
|
container:null,
|
||||||
divContainer:divContainer,
|
divContainer:divContainer,
|
||||||
@ -33,82 +30,86 @@ mindplot.Tip.prototype.initialize=function(divContainer){
|
|||||||
form:null
|
form:null
|
||||||
};
|
};
|
||||||
this.buildTip();
|
this.buildTip();
|
||||||
this._isMouseOver=false;
|
this._isMouseOver = false;
|
||||||
this._open=false;
|
this._open = false;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.buildTip=function(){
|
buildTip : function() {
|
||||||
var opts = this.options;
|
var opts = this.options;
|
||||||
var panel = new Element('div').addClass('bubbleContainer');
|
var panel = new Element('div').addClass('bubbleContainer');
|
||||||
if($chk(opts.height))
|
if ($chk(opts.height))
|
||||||
panel.setStyle('height', opts.height);
|
panel.setStyle('height', opts.height);
|
||||||
if($chk(opts.width))
|
if ($chk(opts.width))
|
||||||
panel.setStyle('width', opts.width);
|
panel.setStyle('width', opts.width);
|
||||||
if(!$chk(opts.divContainer))
|
if (!$chk(opts.divContainer)) {
|
||||||
{
|
opts.divContainer = document.body;
|
||||||
opts.divContainer=document.body;
|
|
||||||
}
|
}
|
||||||
panel.injectTop(opts.divContainer);
|
panel.injectTop(opts.divContainer);
|
||||||
opts.panel = $(panel);
|
opts.panel = $(panel);
|
||||||
opts.panel.setStyle('opacity',0);
|
opts.panel.setStyle('opacity', 0);
|
||||||
opts.panel.addEvent('mouseover',function(){this._isMouseOver=true;}.bind(this));
|
opts.panel.addEvent('mouseover', function() {
|
||||||
opts.panel.addEvent('mouseleave',function(event){this.close(event);}.bindWithEvent(this));//this.close.bindWithEvent(this)
|
this._isMouseOver = true;
|
||||||
|
}.bind(this));
|
||||||
|
opts.panel.addEvent('mouseleave', function(event) {
|
||||||
|
this.close(event);
|
||||||
|
}.bindWithEvent(this));//this.close.bindWithEvent(this)
|
||||||
|
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.click= function(event, el) {
|
click : function(event, el) {
|
||||||
return this.open(event, el);
|
return this.open(event, el);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.open= function(event, content, source){
|
open : function(event, content, source) {
|
||||||
this._isMouseOver=true;
|
this._isMouseOver = true;
|
||||||
this._evt = new Event(event);
|
this._evt = new Event(event);
|
||||||
this.doOpen.delay(500, this,[content,source]);
|
this.doOpen.delay(500, this, [content,source]);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.doOpen= function(content, source){
|
doOpen : function(content, source) {
|
||||||
if($chk(this._isMouseOver) &&!$chk(this._open) && !$chk(this._opening))
|
if ($chk(this._isMouseOver) && !$chk(this._open) && !$chk(this._opening)) {
|
||||||
{
|
this._opening = true;
|
||||||
this._opening=true;
|
|
||||||
var container = new Element('div');
|
var container = new Element('div');
|
||||||
$(content).inject(container);
|
$(content).inject(container);
|
||||||
this.options.content=content;
|
this.options.content = content;
|
||||||
this.options.container=container;
|
this.options.container = container;
|
||||||
$(this.options.container).inject(this.options.panel);
|
$(this.options.container).inject(this.options.panel);
|
||||||
this.init(this._evt,source);
|
this.init(this._evt, source);
|
||||||
$(this.options.panel).effect('opacity',{duration:500, onComplete:function(){this._open=true; this._opening = false;}.bind(this)}).start(0,100);
|
$(this.options.panel).effect('opacity', {duration:500, onComplete:function() {
|
||||||
|
this._open = true;
|
||||||
|
this._opening = false;
|
||||||
|
}.bind(this)}).start(0, 100);
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.updatePosition=function(event){
|
updatePosition : function(event) {
|
||||||
this._evt = new Event(event);
|
this._evt = new Event(event);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.close=function(event){
|
close : function(event) {
|
||||||
this._isMouseOver=false;
|
this._isMouseOver = false;
|
||||||
this.doClose.delay(50,this,new Event(event));
|
this.doClose.delay(50, this, new Event(event));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.doClose=function(event){
|
doClose : function(event) {
|
||||||
|
|
||||||
if(!$chk(this._isMouseOver) && $chk(this._opening))
|
if (!$chk(this._isMouseOver) && $chk(this._opening))
|
||||||
this.doClose.delay(500,this,this._evt);
|
this.doClose.delay(500, this, this._evt);
|
||||||
|
|
||||||
if(!$chk(this._isMouseOver) && $chk(this._open))
|
if (!$chk(this._isMouseOver) && $chk(this._open)) {
|
||||||
{
|
|
||||||
this.forceClose();
|
this.forceClose();
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.forceClose=function(){
|
forceClose : function() {
|
||||||
this.options.panel.effect('opacity',{duration:100, onComplete:function(){
|
this.options.panel.effect('opacity', {duration:100, onComplete:function() {
|
||||||
this._open=false;
|
this._open = false;
|
||||||
$(this.options.panel).setStyles({left:0,top:0});
|
$(this.options.panel).setStyles({left:0,top:0});
|
||||||
$(this.options.container).dispose();
|
$(this.options.container).dispose();
|
||||||
}.bind(this)}).start(100,0);
|
}.bind(this)}).start(100, 0);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.init=function(event,source){
|
init : function(event, source) {
|
||||||
var opts = this.options;
|
var opts = this.options;
|
||||||
var coordinates = $(opts.panel).getCoordinates();
|
var coordinates = $(opts.panel).getCoordinates();
|
||||||
var width = coordinates.width; //not total width, but close enough
|
var width = coordinates.width; //not total width, but close enough
|
||||||
@ -124,21 +125,21 @@ mindplot.Tip.prototype.init=function(event,source){
|
|||||||
this.buildTip();
|
this.buildTip();
|
||||||
$(this.options.container).inject(this.options.panel);
|
$(this.options.container).inject(this.options.panel);
|
||||||
this.moveTopic(offset, $(opts.panel).getCoordinates().height);
|
this.moveTopic(offset, $(opts.panel).getCoordinates().height);
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.Tip.prototype.moveTopic=function(offset, panelHeight){
|
moveTopic : function(offset, panelHeight) {
|
||||||
var opts = this.options;
|
var opts = this.options;
|
||||||
var width = $(opts.panel).getCoordinates().width;
|
var width = $(opts.panel).getCoordinates().width;
|
||||||
$(opts.panel).setStyles({left:offset.x - (width/2), top:offset.y - (panelHeight*2) + 35});
|
$(opts.panel).setStyles({left:offset.x - (width / 2), top:offset.y - (panelHeight * 2) + 35});
|
||||||
};
|
}
|
||||||
|
|
||||||
mindplot.Tip.getInstance = function(divContainer)
|
});
|
||||||
{
|
|
||||||
|
mindplot.Tip.getInstance = function(divContainer) {
|
||||||
var result = mindplot.Tip.instance;
|
var result = mindplot.Tip.instance;
|
||||||
if(!$defined(result))
|
if (!$defined(result)) {
|
||||||
{
|
|
||||||
mindplot.Tip.instance = new mindplot.Tip(divContainer);
|
mindplot.Tip.instance = new mindplot.Tip(divContainer);
|
||||||
result = mindplot.Tip.instance;
|
result = mindplot.Tip.instance;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
}
|
@ -103,7 +103,7 @@ mindplot.VariableDistanceBoard = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
lookupEntryByPosition:function(pos) {
|
lookupEntryByPosition:function(pos) {
|
||||||
$assert($defined(pos), 'position can not be null');
|
$assert(pos, 'position can not be null');
|
||||||
var entries = this._entries;
|
var entries = this._entries;
|
||||||
var zeroEntry = entries.get(0);
|
var zeroEntry = entries.get(0);
|
||||||
if (zeroEntry.isCoordinateIn(pos.y)) {
|
if (zeroEntry.isCoordinateIn(pos.y)) {
|
||||||
@ -210,4 +210,4 @@ mindplot.VariableDistanceBoard = new Class({
|
|||||||
return this._entries.inspect();
|
return this._entries.inspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
@ -150,8 +150,7 @@ mindplot.Workspace = new Class({
|
|||||||
var screenManager = this._screenManager;
|
var screenManager = this._screenManager;
|
||||||
this._dragging = true;
|
this._dragging = true;
|
||||||
var mWorkspace = this;
|
var mWorkspace = this;
|
||||||
var mouseDownListener = function(event)
|
var mouseDownListener = function(event) {
|
||||||
{
|
|
||||||
if (!$defined(workspace.mouseMoveListener)) {
|
if (!$defined(workspace.mouseMoveListener)) {
|
||||||
if (mWorkspace.isWorkspaceEventsEnabled()) {
|
if (mWorkspace.isWorkspaceEventsEnabled()) {
|
||||||
mWorkspace.enableWorkspaceEvents(false);
|
mWorkspace.enableWorkspaceEvents(false);
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.XMLMindmapSerializerFactory = {};
|
mindplot.XMLMindmapSerializerFactory = {};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap = function(mindmap){
|
mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap = function(mindmap) {
|
||||||
return mindplot.XMLMindmapSerializerFactory.getSerializer(mindmap.getVersion());
|
return mindplot.XMLMindmapSerializerFactory.getSerializer(mindmap.getVersion());
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument = function(domDocument){
|
mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument = function(domDocument) {
|
||||||
var rootElem = domDocument.documentElement;
|
var rootElem = domDocument.documentElement;
|
||||||
return mindplot.XMLMindmapSerializerFactory.getSerializer(rootElem.getAttribute("version"))
|
return mindplot.XMLMindmapSerializerFactory.getSerializer(rootElem.getAttribute("version"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializer = function(version){
|
mindplot.XMLMindmapSerializerFactory.getSerializer = function(version) {
|
||||||
if(!$defined(version)){
|
if (!$defined(version)) {
|
||||||
version = mindplot.ModelCodeName.BETA;
|
version = mindplot.ModelCodeName.BETA;
|
||||||
}
|
}
|
||||||
var codeNames = mindplot.XMLMindmapSerializerFactory._codeNames;
|
var codeNames = mindplot.XMLMindmapSerializerFactory._codeNames;
|
||||||
var found = false;
|
var found = false;
|
||||||
var serializer = null;
|
var serializer = null;
|
||||||
for(var i=0; i<codeNames.length; i++){
|
for (var i = 0; i < codeNames.length; i++) {
|
||||||
if(!found){
|
if (!found) {
|
||||||
found = codeNames[i].codeName==version;
|
found = codeNames[i].codeName == version;
|
||||||
if(found)
|
if (found)
|
||||||
serializer = new (codeNames[i].serializer)();
|
serializer = new (codeNames[i].serializer)();
|
||||||
} else{
|
} else {
|
||||||
var migrator = codeNames[i].migrator;
|
var migrator = codeNames[i].migrator;
|
||||||
serializer = new migrator(serializer);
|
serializer = new migrator(serializer);
|
||||||
}
|
}
|
||||||
@ -49,10 +49,11 @@ mindplot.XMLMindmapSerializerFactory.getSerializer = function(version){
|
|||||||
};
|
};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory._codeNames =
|
mindplot.XMLMindmapSerializerFactory._codeNames =
|
||||||
[{
|
[
|
||||||
|
{
|
||||||
codeName:mindplot.ModelCodeName.BETA,
|
codeName:mindplot.ModelCodeName.BETA,
|
||||||
serializer: mindplot.XMLMindmapSerializer_Beta,
|
serializer: mindplot.XMLMindmapSerializer_Beta,
|
||||||
migrator:function(){//todo:error
|
migrator:function() {//todo:error
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -60,4 +61,4 @@ mindplot.XMLMindmapSerializerFactory._codeNames =
|
|||||||
serializer:mindplot.XMLMindmapSerializer_Pela,
|
serializer:mindplot.XMLMindmapSerializer_Pela,
|
||||||
migrator:mindplot.Beta2PelaMigrator
|
migrator:mindplot.Beta2PelaMigrator
|
||||||
}
|
}
|
||||||
];
|
];
|
@ -1,26 +1,22 @@
|
|||||||
/* Copyright [2011] [wisemapping]
|
/* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.XMLMindmapSerializer_Beta = function()
|
mindplot.XMLMindmapSerializer_Beta = new Class({
|
||||||
{
|
|
||||||
|
|
||||||
};
|
toXML : function(mindmap) {
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype.toXML = function(mindmap)
|
|
||||||
{
|
|
||||||
$assert(mindmap, "Can not save a null mindmap");
|
$assert(mindmap, "Can not save a null mindmap");
|
||||||
|
|
||||||
var document = core.Utils.createDocument();
|
var document = core.Utils.createDocument();
|
||||||
@ -28,41 +24,34 @@ mindplot.XMLMindmapSerializer_Beta.prototype.toXML = function(mindmap)
|
|||||||
// Store map attributes ...
|
// Store map attributes ...
|
||||||
var mapElem = document.createElement("map");
|
var mapElem = document.createElement("map");
|
||||||
var name = mindmap.getId();
|
var name = mindmap.getId();
|
||||||
if ($defined(name))
|
if ($defined(name)) {
|
||||||
{
|
|
||||||
mapElem.setAttribute('name', name);
|
mapElem.setAttribute('name', name);
|
||||||
}
|
}
|
||||||
document.appendChild(mapElem);
|
document.appendChild(mapElem);
|
||||||
|
|
||||||
// Create branches ...
|
// Create branches ...
|
||||||
var topics = mindmap.getBranches();
|
var topics = mindmap.getBranches();
|
||||||
for (var i = 0; i < topics.length; i++)
|
for (var i = 0; i < topics.length; i++) {
|
||||||
{
|
|
||||||
var topic = topics[i];
|
var topic = topics[i];
|
||||||
var topicDom = this._topicToXML(document, topic);
|
var topicDom = this._topicToXML(document, topic);
|
||||||
mapElem.appendChild(topicDom);
|
mapElem.appendChild(topicDom);
|
||||||
}
|
}
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, topic)
|
_topicToXML : function(document, topic) {
|
||||||
{
|
|
||||||
var parentTopic = document.createElement("topic");
|
var parentTopic = document.createElement("topic");
|
||||||
|
|
||||||
// Set topic attributes...
|
// Set topic attributes...
|
||||||
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
{
|
|
||||||
parentTopic.setAttribute("central", true);
|
parentTopic.setAttribute("central", true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
var parent = topic.getParent();
|
var parent = topic.getParent();
|
||||||
if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
{
|
|
||||||
var pos = topic.getPosition();
|
var pos = topic.getPosition();
|
||||||
parentTopic.setAttribute("position", pos.x + ',' + pos.y);
|
parentTopic.setAttribute("position", pos.x + ',' + pos.y);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
var order = topic.getOrder();
|
var order = topic.getOrder();
|
||||||
parentTopic.setAttribute("order", order);
|
parentTopic.setAttribute("order", order);
|
||||||
}
|
}
|
||||||
@ -78,9 +67,8 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
parentTopic.setAttribute('shape', shape);
|
parentTopic.setAttribute('shape', shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(topic.areChildrenShrinked())
|
if (topic.areChildrenShrinked()) {
|
||||||
{
|
parentTopic.setAttribute('shrink', true);
|
||||||
parentTopic.setAttribute('shrink',true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Font properties ...
|
// Font properties ...
|
||||||
@ -102,8 +90,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
font += (fontStyle ? fontStyle : '') + ';';
|
font += (fontStyle ? fontStyle : '') + ';';
|
||||||
|
|
||||||
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|
||||||
|| $defined(fontWeight )|| $defined(fontStyle))
|
|| $defined(fontWeight) || $defined(fontStyle)) {
|
||||||
{
|
|
||||||
parentTopic.setAttribute('fontStyle', font);
|
parentTopic.setAttribute('fontStyle', font);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +106,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//ICONS
|
//ICONS
|
||||||
var icons = topic.getIcons();
|
var icons = topic.getIcons();
|
||||||
for (var i = 0; i < icons.length; i++)
|
for (var i = 0; i < icons.length; i++) {
|
||||||
{
|
|
||||||
var icon = icons[i];
|
var icon = icons[i];
|
||||||
var iconDom = this._iconToXML(document, icon);
|
var iconDom = this._iconToXML(document, icon);
|
||||||
parentTopic.appendChild(iconDom);
|
parentTopic.appendChild(iconDom);
|
||||||
@ -128,16 +114,14 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//LINKS
|
//LINKS
|
||||||
var links = topic.getLinks();
|
var links = topic.getLinks();
|
||||||
for (var i = 0; i < links.length; i++)
|
for (var i = 0; i < links.length; i++) {
|
||||||
{
|
|
||||||
var link = links[i];
|
var link = links[i];
|
||||||
var linkDom = this._linkToXML(document, link);
|
var linkDom = this._linkToXML(document, link);
|
||||||
parentTopic.appendChild(linkDom);
|
parentTopic.appendChild(linkDom);
|
||||||
}
|
}
|
||||||
|
|
||||||
var notes = topic.getNotes();
|
var notes = topic.getNotes();
|
||||||
for (var i = 0; i < notes.length; i++)
|
for (var i = 0; i < notes.length; i++) {
|
||||||
{
|
|
||||||
var note = notes[i];
|
var note = notes[i];
|
||||||
var noteDom = this._noteToXML(document, note);
|
var noteDom = this._noteToXML(document, note);
|
||||||
parentTopic.appendChild(noteDom);
|
parentTopic.appendChild(noteDom);
|
||||||
@ -145,8 +129,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//CHILDREN TOPICS
|
//CHILDREN TOPICS
|
||||||
var childTopics = topic.getChildren();
|
var childTopics = topic.getChildren();
|
||||||
for (var i = 0; i < childTopics.length; i++)
|
for (var i = 0; i < childTopics.length; i++) {
|
||||||
{
|
|
||||||
var childTopic = childTopics[i];
|
var childTopic = childTopics[i];
|
||||||
var childDom = this._topicToXML(document, childTopic);
|
var childDom = this._topicToXML(document, childTopic);
|
||||||
parentTopic.appendChild(childDom);
|
parentTopic.appendChild(childDom);
|
||||||
@ -154,31 +137,27 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
|
|||||||
}
|
}
|
||||||
|
|
||||||
return parentTopic;
|
return parentTopic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._iconToXML = function(document, icon)
|
_iconToXML : function(document, icon) {
|
||||||
{
|
|
||||||
var iconDom = document.createElement("icon");
|
var iconDom = document.createElement("icon");
|
||||||
iconDom.setAttribute('id', icon.getIconType());
|
iconDom.setAttribute('id', icon.getIconType());
|
||||||
return iconDom;
|
return iconDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._linkToXML = function(document, link)
|
_linkToXML : function(document, link) {
|
||||||
{
|
|
||||||
var linkDom = document.createElement("link");
|
var linkDom = document.createElement("link");
|
||||||
linkDom.setAttribute('url', link.getUrl());
|
linkDom.setAttribute('url', link.getUrl());
|
||||||
return linkDom;
|
return linkDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._noteToXML = function(document, note)
|
_noteToXML : function(document, note) {
|
||||||
{
|
|
||||||
var noteDom = document.createElement("note");
|
var noteDom = document.createElement("note");
|
||||||
noteDom.setAttribute('text', note.getText());
|
noteDom.setAttribute('text', note.getText());
|
||||||
return noteDom;
|
return noteDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype.loadFromDom = function(dom)
|
loadFromDom : function(dom) {
|
||||||
{
|
|
||||||
$assert(dom, "Dom can not be null");
|
$assert(dom, "Dom can not be null");
|
||||||
var rootElem = dom.documentElement;
|
var rootElem = dom.documentElement;
|
||||||
|
|
||||||
@ -189,20 +168,17 @@ mindplot.XMLMindmapSerializer_Beta.prototype.loadFromDom = function(dom)
|
|||||||
var mindmap = new mindplot.Mindmap();
|
var mindmap = new mindplot.Mindmap();
|
||||||
|
|
||||||
var children = rootElem.childNodes;
|
var children = rootElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++)
|
for (var i = 0; i < children.length; i++) {
|
||||||
{
|
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == 1)
|
if (child.nodeType == 1) {
|
||||||
{
|
|
||||||
var topic = this._deserializeNode(child, mindmap);
|
var topic = this._deserializeNode(child, mindmap);
|
||||||
mindmap.addBranch(topic);
|
mindmap.addBranch(topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mindmap;
|
return mindmap;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem, mindmap)
|
_deserializeNode : function(domElem, mindmap) {
|
||||||
{
|
|
||||||
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
|
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
|
||||||
var topic = mindmap.createNode(type);
|
var topic = mindmap.createNode(type);
|
||||||
|
|
||||||
@ -223,8 +199,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isShrink = domElem.getAttribute('shrink');
|
var isShrink = domElem.getAttribute('shrink');
|
||||||
if($defined(isShrink))
|
if ($defined(isShrink)) {
|
||||||
{
|
|
||||||
topic.setChildrenShrinked(isShrink);
|
topic.setChildrenShrinked(isShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,28 +207,23 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
|
|||||||
if ($defined(fontStyle)) {
|
if ($defined(fontStyle)) {
|
||||||
var font = fontStyle.split(';');
|
var font = fontStyle.split(';');
|
||||||
|
|
||||||
if (font[0])
|
if (font[0]) {
|
||||||
{
|
|
||||||
topic.setFontFamily(font[0]);
|
topic.setFontFamily(font[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[1])
|
if (font[1]) {
|
||||||
{
|
|
||||||
topic.setFontSize(font[1]);
|
topic.setFontSize(font[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[2])
|
if (font[2]) {
|
||||||
{
|
|
||||||
topic.setFontColor(font[2]);
|
topic.setFontColor(font[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[3])
|
if (font[3]) {
|
||||||
{
|
|
||||||
topic.setFontWeight(font[3]);
|
topic.setFontWeight(font[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[4])
|
if (font[4]) {
|
||||||
{
|
|
||||||
topic.setFontStyle(font[4]);
|
topic.setFontStyle(font[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,44 +246,39 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
|
|||||||
|
|
||||||
//Creating icons and children nodes
|
//Creating icons and children nodes
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++)
|
for (var i = 0; i < children.length; i++) {
|
||||||
{
|
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == 1)
|
if (child.nodeType == 1) {
|
||||||
{
|
|
||||||
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
|
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
|
||||||
if (child.tagName == "topic") {
|
if (child.tagName == "topic") {
|
||||||
var childTopic = this._deserializeNode(child, mindmap);
|
var childTopic = this._deserializeNode(child, mindmap);
|
||||||
childTopic.connectTo(topic);
|
childTopic.connectTo(topic);
|
||||||
} else if(child.tagName == "icon") {
|
} else if (child.tagName == "icon") {
|
||||||
var icon = this._deserializeIcon(child, topic);
|
var icon = this._deserializeIcon(child, topic);
|
||||||
topic.addIcon(icon);
|
topic.addIcon(icon);
|
||||||
} else if(child.tagName == "link") {
|
} else if (child.tagName == "link") {
|
||||||
var link = this._deserializeLink(child, topic);
|
var link = this._deserializeLink(child, topic);
|
||||||
topic.addLink(link);
|
topic.addLink(link);
|
||||||
} else if(child.tagName == "note") {
|
} else if (child.tagName == "note") {
|
||||||
var note = this._deserializeNote(child, topic);
|
var note = this._deserializeNote(child, topic);
|
||||||
topic.addNote(note);
|
topic.addNote(note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
|
||||||
return topic;
|
return topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._deserializeIcon = function(domElem, topic)
|
_deserializeIcon : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createIcon(domElem.getAttribute("id"));
|
return topic.createIcon(domElem.getAttribute("id"));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._deserializeLink = function(domElem, topic)
|
_deserializeLink : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createLink(domElem.getAttribute("url"));
|
return topic.createLink(domElem.getAttribute("url"));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNote = function(domElem, topic)
|
_deserializeNote : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createNote(domElem.getAttribute("text"));
|
return topic.createNote(domElem.getAttribute("text"));
|
||||||
};
|
}});
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE = 'map';
|
mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE = 'map';
|
@ -1,28 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela = function()
|
mindplot.XMLMindmapSerializer_Pela = new Class({
|
||||||
{
|
|
||||||
|
|
||||||
};
|
toXML : function(mindmap) {
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
|
|
||||||
{
|
|
||||||
$assert(mindmap, "Can not save a null mindmap");
|
$assert(mindmap, "Can not save a null mindmap");
|
||||||
|
|
||||||
var document = core.Utils.createDocument();
|
var document = core.Utils.createDocument();
|
||||||
@ -30,13 +26,11 @@ mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
|
|||||||
// Store map attributes ...
|
// Store map attributes ...
|
||||||
var mapElem = document.createElement("map");
|
var mapElem = document.createElement("map");
|
||||||
var name = mindmap.getId();
|
var name = mindmap.getId();
|
||||||
if ($defined(name))
|
if ($defined(name)) {
|
||||||
{
|
|
||||||
mapElem.setAttribute('name', name);
|
mapElem.setAttribute('name', name);
|
||||||
}
|
}
|
||||||
var version = mindmap.getVersion();
|
var version = mindmap.getVersion();
|
||||||
if ($defined(version))
|
if ($defined(version)) {
|
||||||
{
|
|
||||||
mapElem.setAttribute('version', version);
|
mapElem.setAttribute('version', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +38,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
|
|||||||
|
|
||||||
// Create branches ...
|
// Create branches ...
|
||||||
var topics = mindmap.getBranches();
|
var topics = mindmap.getBranches();
|
||||||
for (var i = 0; i < topics.length; i++)
|
for (var i = 0; i < topics.length; i++) {
|
||||||
{
|
|
||||||
var topic = topics[i];
|
var topic = topics[i];
|
||||||
var topicDom = this._topicToXML(document, topic);
|
var topicDom = this._topicToXML(document, topic);
|
||||||
mapElem.appendChild(topicDom);
|
mapElem.appendChild(topicDom);
|
||||||
@ -53,28 +46,25 @@ mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
|
|||||||
|
|
||||||
// Create Relationships
|
// Create Relationships
|
||||||
var relationships = mindmap.getRelationships();
|
var relationships = mindmap.getRelationships();
|
||||||
if(relationships.length>0){
|
if (relationships.length > 0) {
|
||||||
// var relationshipDom=document.createElement("relationships");
|
// var relationshipDom=document.createElement("relationships");
|
||||||
// mapElem.appendChild(relationshipDom);
|
// mapElem.appendChild(relationshipDom);
|
||||||
for (var j = 0; j<relationships.length; j++){
|
for (var j = 0; j < relationships.length; j++) {
|
||||||
var relationDom = this._relationshipToXML(document, relationships[j]);
|
var relationDom = this._relationshipToXML(document, relationships[j]);
|
||||||
mapElem.appendChild(relationDom);
|
mapElem.appendChild(relationDom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, topic)
|
_topicToXML : function(document, topic) {
|
||||||
{
|
|
||||||
var parentTopic = document.createElement("topic");
|
var parentTopic = document.createElement("topic");
|
||||||
|
|
||||||
// Set topic attributes...
|
// Set topic attributes...
|
||||||
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
{
|
|
||||||
parentTopic.setAttribute("central", true);
|
parentTopic.setAttribute("central", true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
var parent = topic.getParent();
|
var parent = topic.getParent();
|
||||||
// if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
// if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
|
||||||
// {
|
// {
|
||||||
@ -97,14 +87,13 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
parentTopic.setAttribute('shape', shape);
|
parentTopic.setAttribute('shape', shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(topic.areChildrenShrinked())
|
if (topic.areChildrenShrinked()) {
|
||||||
{
|
parentTopic.setAttribute('shrink', true);
|
||||||
parentTopic.setAttribute('shrink',true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Font properties ...
|
// Font properties ...
|
||||||
var id = topic.getId();
|
var id = topic.getId();
|
||||||
parentTopic.setAttribute('id',id);
|
parentTopic.setAttribute('id', id);
|
||||||
|
|
||||||
var font = "";
|
var font = "";
|
||||||
|
|
||||||
@ -124,8 +113,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
font += (fontStyle ? fontStyle : '') + ';';
|
font += (fontStyle ? fontStyle : '') + ';';
|
||||||
|
|
||||||
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|
||||||
|| $defined(fontWeight) || $defined(fontStyle))
|
|| $defined(fontWeight) || $defined(fontStyle)) {
|
||||||
{
|
|
||||||
parentTopic.setAttribute('fontStyle', font);
|
parentTopic.setAttribute('fontStyle', font);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +129,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//ICONS
|
//ICONS
|
||||||
var icons = topic.getIcons();
|
var icons = topic.getIcons();
|
||||||
for (var i = 0; i < icons.length; i++)
|
for (var i = 0; i < icons.length; i++) {
|
||||||
{
|
|
||||||
var icon = icons[i];
|
var icon = icons[i];
|
||||||
var iconDom = this._iconToXML(document, icon);
|
var iconDom = this._iconToXML(document, icon);
|
||||||
parentTopic.appendChild(iconDom);
|
parentTopic.appendChild(iconDom);
|
||||||
@ -150,16 +137,14 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//LINKS
|
//LINKS
|
||||||
var links = topic.getLinks();
|
var links = topic.getLinks();
|
||||||
for (var i = 0; i < links.length; i++)
|
for (var i = 0; i < links.length; i++) {
|
||||||
{
|
|
||||||
var link = links[i];
|
var link = links[i];
|
||||||
var linkDom = this._linkToXML(document, link);
|
var linkDom = this._linkToXML(document, link);
|
||||||
parentTopic.appendChild(linkDom);
|
parentTopic.appendChild(linkDom);
|
||||||
}
|
}
|
||||||
|
|
||||||
var notes = topic.getNotes();
|
var notes = topic.getNotes();
|
||||||
for (var i = 0; i < notes.length; i++)
|
for (var i = 0; i < notes.length; i++) {
|
||||||
{
|
|
||||||
var note = notes[i];
|
var note = notes[i];
|
||||||
var noteDom = this._noteToXML(document, note);
|
var noteDom = this._noteToXML(document, note);
|
||||||
parentTopic.appendChild(noteDom);
|
parentTopic.appendChild(noteDom);
|
||||||
@ -167,8 +152,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
|
|
||||||
//CHILDREN TOPICS
|
//CHILDREN TOPICS
|
||||||
var childTopics = topic.getChildren();
|
var childTopics = topic.getChildren();
|
||||||
for (var i = 0; i < childTopics.length; i++)
|
for (var i = 0; i < childTopics.length; i++) {
|
||||||
{
|
|
||||||
var childTopic = childTopics[i];
|
var childTopic = childTopics[i];
|
||||||
var childDom = this._topicToXML(document, childTopic);
|
var childDom = this._topicToXML(document, childTopic);
|
||||||
parentTopic.appendChild(childDom);
|
parentTopic.appendChild(childDom);
|
||||||
@ -176,52 +160,48 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
|
|||||||
}
|
}
|
||||||
|
|
||||||
return parentTopic;
|
return parentTopic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._iconToXML = function(document, icon)
|
_iconToXML : function(document, icon) {
|
||||||
{
|
|
||||||
var iconDom = document.createElement("icon");
|
var iconDom = document.createElement("icon");
|
||||||
iconDom.setAttribute('id', icon.getIconType());
|
iconDom.setAttribute('id', icon.getIconType());
|
||||||
return iconDom;
|
return iconDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._linkToXML = function(document, link)
|
_linkToXML : function(document, link) {
|
||||||
{
|
|
||||||
var linkDom = document.createElement("link");
|
var linkDom = document.createElement("link");
|
||||||
linkDom.setAttribute('url', link.getUrl());
|
linkDom.setAttribute('url', link.getUrl());
|
||||||
return linkDom;
|
return linkDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._noteToXML = function(document, note)
|
_noteToXML : function(document, note) {
|
||||||
{
|
|
||||||
var noteDom = document.createElement("note");
|
var noteDom = document.createElement("note");
|
||||||
noteDom.setAttribute('text', note.getText());
|
noteDom.setAttribute('text', note.getText());
|
||||||
return noteDom;
|
return noteDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._relationshipToXML = function(document,relationship){
|
_relationshipToXML : function(document, relationship) {
|
||||||
var relationDom = document.createElement("relationship");
|
var relationDom = document.createElement("relationship");
|
||||||
relationDom.setAttribute("srcTopicId",relationship.getFromNode());
|
relationDom.setAttribute("srcTopicId", relationship.getFromNode());
|
||||||
relationDom.setAttribute("destTopicId",relationship.getToNode());
|
relationDom.setAttribute("destTopicId", relationship.getToNode());
|
||||||
var lineType = relationship.getLineType();
|
var lineType = relationship.getLineType();
|
||||||
relationDom.setAttribute("lineType",lineType);
|
relationDom.setAttribute("lineType", lineType);
|
||||||
if(lineType==mindplot.ConnectionLine.CURVED || lineType==mindplot.ConnectionLine.SIMPLE_CURVED){
|
if (lineType == mindplot.ConnectionLine.CURVED || lineType == mindplot.ConnectionLine.SIMPLE_CURVED) {
|
||||||
if($defined(relationship.getSrcCtrlPoint())){
|
if ($defined(relationship.getSrcCtrlPoint())) {
|
||||||
var srcPoint = relationship.getSrcCtrlPoint();
|
var srcPoint = relationship.getSrcCtrlPoint();
|
||||||
relationDom.setAttribute("srcCtrlPoint",srcPoint.x+","+srcPoint.y);
|
relationDom.setAttribute("srcCtrlPoint", srcPoint.x + "," + srcPoint.y);
|
||||||
}
|
}
|
||||||
if($defined(relationship.getDestCtrlPoint())){
|
if ($defined(relationship.getDestCtrlPoint())) {
|
||||||
var destPoint = relationship.getDestCtrlPoint();
|
var destPoint = relationship.getDestCtrlPoint();
|
||||||
relationDom.setAttribute("destCtrlPoint",destPoint.x+","+destPoint.y);
|
relationDom.setAttribute("destCtrlPoint", destPoint.x + "," + destPoint.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
relationDom.setAttribute("endArrow",relationship.getEndArrow());
|
relationDom.setAttribute("endArrow", relationship.getEndArrow());
|
||||||
relationDom.setAttribute("startArrow",relationship.getStartArrow());
|
relationDom.setAttribute("startArrow", relationship.getStartArrow());
|
||||||
return relationDom;
|
return relationDom;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype.loadFromDom = function(dom)
|
loadFromDom : function(dom) {
|
||||||
{
|
|
||||||
$assert(dom, "Dom can not be null");
|
$assert(dom, "Dom can not be null");
|
||||||
var rootElem = dom.documentElement;
|
var rootElem = dom.documentElement;
|
||||||
|
|
||||||
@ -236,41 +216,38 @@ mindplot.XMLMindmapSerializer_Pela.prototype.loadFromDom = function(dom)
|
|||||||
mindmap.setVersion(version);
|
mindmap.setVersion(version);
|
||||||
|
|
||||||
var children = rootElem.childNodes;
|
var children = rootElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++)
|
for (var i = 0; i < children.length; i++) {
|
||||||
{
|
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == 1)
|
if (child.nodeType == 1) {
|
||||||
{
|
switch (child.tagName) {
|
||||||
switch(child.tagName){
|
|
||||||
case "topic":
|
case "topic":
|
||||||
var topic = this._deserializeNode(child, mindmap);
|
var topic = this._deserializeNode(child, mindmap);
|
||||||
mindmap.addBranch(topic);
|
mindmap.addBranch(topic);
|
||||||
break;
|
break;
|
||||||
case "relationship":
|
case "relationship":
|
||||||
var relationship = this._deserializeRelationship(child,mindmap);
|
var relationship = this._deserializeRelationship(child, mindmap);
|
||||||
if(relationship!=null)
|
if (relationship != null)
|
||||||
mindmap.addRelationship(relationship);
|
mindmap.addRelationship(relationship);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._idsMap=null;
|
this._idsMap = null;
|
||||||
return mindmap;
|
return mindmap;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem, mindmap)
|
_deserializeNode : function(domElem, mindmap) {
|
||||||
{
|
|
||||||
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
|
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
|
||||||
// Load attributes...
|
// Load attributes...
|
||||||
var id = domElem.getAttribute('id');
|
var id = domElem.getAttribute('id');
|
||||||
if($defined(id)) {
|
if ($defined(id)) {
|
||||||
id=parseInt(id);
|
id = parseInt(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._idsMap.has(id)){
|
if (this._idsMap.has(id)) {
|
||||||
id=null;
|
id = null;
|
||||||
}else{
|
} else {
|
||||||
this._idsMap.set(id,domElem);
|
this._idsMap.set(id, domElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
var topic = mindmap.createNode(type, id);
|
var topic = mindmap.createNode(type, id);
|
||||||
@ -291,8 +268,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isShrink = domElem.getAttribute('shrink');
|
var isShrink = domElem.getAttribute('shrink');
|
||||||
if($defined(isShrink))
|
if ($defined(isShrink)) {
|
||||||
{
|
|
||||||
topic.setChildrenShrinked(isShrink);
|
topic.setChildrenShrinked(isShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,28 +276,23 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
|
|||||||
if ($defined(fontStyle)) {
|
if ($defined(fontStyle)) {
|
||||||
var font = fontStyle.split(';');
|
var font = fontStyle.split(';');
|
||||||
|
|
||||||
if (font[0])
|
if (font[0]) {
|
||||||
{
|
|
||||||
topic.setFontFamily(font[0]);
|
topic.setFontFamily(font[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[1])
|
if (font[1]) {
|
||||||
{
|
|
||||||
topic.setFontSize(font[1]);
|
topic.setFontSize(font[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[2])
|
if (font[2]) {
|
||||||
{
|
|
||||||
topic.setFontColor(font[2]);
|
topic.setFontColor(font[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[3])
|
if (font[3]) {
|
||||||
{
|
|
||||||
topic.setFontWeight(font[3]);
|
topic.setFontWeight(font[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font[4])
|
if (font[4]) {
|
||||||
{
|
|
||||||
topic.setFontStyle(font[4]);
|
topic.setFontStyle(font[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,22 +316,20 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
|
|||||||
|
|
||||||
//Creating icons and children nodes
|
//Creating icons and children nodes
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++)
|
for (var i = 0; i < children.length; i++) {
|
||||||
{
|
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == 1)
|
if (child.nodeType == 1) {
|
||||||
{
|
|
||||||
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
|
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
|
||||||
if (child.tagName == "topic") {
|
if (child.tagName == "topic") {
|
||||||
var childTopic = this._deserializeNode(child, mindmap);
|
var childTopic = this._deserializeNode(child, mindmap);
|
||||||
childTopic.connectTo(topic);
|
childTopic.connectTo(topic);
|
||||||
} else if(child.tagName == "icon") {
|
} else if (child.tagName == "icon") {
|
||||||
var icon = this._deserializeIcon(child, topic);
|
var icon = this._deserializeIcon(child, topic);
|
||||||
topic.addIcon(icon);
|
topic.addIcon(icon);
|
||||||
} else if(child.tagName == "link") {
|
} else if (child.tagName == "link") {
|
||||||
var link = this._deserializeLink(child, topic);
|
var link = this._deserializeLink(child, topic);
|
||||||
topic.addLink(link);
|
topic.addLink(link);
|
||||||
} else if(child.tagName == "note") {
|
} else if (child.tagName == "note") {
|
||||||
var note = this._deserializeNote(child, topic);
|
var note = this._deserializeNote(child, topic);
|
||||||
topic.addNote(note);
|
topic.addNote(note);
|
||||||
}
|
}
|
||||||
@ -368,25 +337,21 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
return topic;
|
return topic;
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._deserializeIcon = function(domElem, topic)
|
_deserializeIcon : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createIcon(domElem.getAttribute("id"));
|
return topic.createIcon(domElem.getAttribute("id"));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._deserializeLink = function(domElem, topic)
|
_deserializeLink : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createLink(domElem.getAttribute("url"));
|
return topic.createLink(domElem.getAttribute("url"));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNote = function(domElem, topic)
|
_deserializeNote : function(domElem, topic) {
|
||||||
{
|
|
||||||
return topic.createNote(domElem.getAttribute("text"));
|
return topic.createNote(domElem.getAttribute("text"));
|
||||||
};
|
},
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.prototype._deserializeRelationship = function(domElement, mindmap)
|
_deserializeRelationship : function(domElement, mindmap) {
|
||||||
{
|
|
||||||
var srcId = domElement.getAttribute("srcTopicId");
|
var srcId = domElement.getAttribute("srcTopicId");
|
||||||
var destId = domElement.getAttribute("destTopicId");
|
var destId = domElement.getAttribute("destTopicId");
|
||||||
var lineType = domElement.getAttribute("lineType");
|
var lineType = domElement.getAttribute("lineType");
|
||||||
@ -395,20 +360,21 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeRelationship = function
|
|||||||
var endArrow = domElement.getAttribute("endArrow");
|
var endArrow = domElement.getAttribute("endArrow");
|
||||||
var startArrow = domElement.getAttribute("startArrow");
|
var startArrow = domElement.getAttribute("startArrow");
|
||||||
//If for some reason a relationship lines has source and dest nodes the same, don't import it.
|
//If for some reason a relationship lines has source and dest nodes the same, don't import it.
|
||||||
if(srcId==destId){
|
if (srcId == destId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var model = mindmap.createRelationship(srcId, destId);
|
var model = mindmap.createRelationship(srcId, destId);
|
||||||
model.setLineType(lineType);
|
model.setLineType(lineType);
|
||||||
if($defined(srcCtrlPoint) && srcCtrlPoint!=""){
|
if ($defined(srcCtrlPoint) && srcCtrlPoint != "") {
|
||||||
model.setSrcCtrlPoint(core.Point.fromString(srcCtrlPoint));
|
model.setSrcCtrlPoint(core.Point.fromString(srcCtrlPoint));
|
||||||
}
|
}
|
||||||
if($defined(destCtrlPoint) && destCtrlPoint!=""){
|
if ($defined(destCtrlPoint) && destCtrlPoint != "") {
|
||||||
model.setDestCtrlPoint(core.Point.fromString(destCtrlPoint));
|
model.setDestCtrlPoint(core.Point.fromString(destCtrlPoint));
|
||||||
}
|
}
|
||||||
model.setEndArrow(endArrow=="true");
|
model.setEndArrow(endArrow == "true");
|
||||||
model.setStartArrow(startArrow=="true");
|
model.setStartArrow(startArrow == "true");
|
||||||
return model;
|
return model;
|
||||||
};
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE = 'map';
|
mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE = 'map';
|
@ -39,7 +39,7 @@ mindplot.util.Shape =
|
|||||||
{
|
{
|
||||||
$assert(rectCenterPoint, 'rectCenterPoint can not be null');
|
$assert(rectCenterPoint, 'rectCenterPoint can not be null');
|
||||||
$assert(rectSize, 'rectSize can not be null');
|
$assert(rectSize, 'rectSize can not be null');
|
||||||
$assert($defined(isAtRight), 'isRight can not be null');
|
$assert(isAtRight, 'isRight can not be null');
|
||||||
|
|
||||||
// Node is placed at the right ?
|
// Node is placed at the right ?
|
||||||
var result = new core.Point();
|
var result = new core.Point();
|
||||||
|
Loading…
Reference in New Issue
Block a user