Format some .js.

This commit is contained in:
Paulo Gustavo Veiga 2015-04-12 00:23:24 -03:00
parent 113a93f48a
commit 9caa90db63
31 changed files with 531 additions and 479 deletions

View File

@ -229,6 +229,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* connected, added to the drag manager, with events registered - complying type & read mode * connected, added to the drag manager, with events registered - complying type & read mode
*/ */
_buildNodeGraph: function (model, readOnly) { _buildNodeGraph: function (model, readOnly) {
// Create node graph ... // Create node graph ...
var topic = mindplot.NodeGraph.create(model, {readOnly: readOnly}); var topic = mindplot.NodeGraph.create(model, {readOnly: readOnly});
this.getModel().addTopic(topic); this.getModel().addTopic(topic);

View File

@ -211,5 +211,5 @@ mindplot.DragTopic.__getDragPivot = function () {
mindplot.DragTopic._dragPivot = result; mindplot.DragTopic._dragPivot = result;
} }
return result; return result;
} };

View File

@ -17,20 +17,20 @@
*/ */
mindplot.EditorProperties = new Class({ mindplot.EditorProperties = new Class({
initialize:function() { initialize: function () {
this._zoom = 0; this._zoom = 0;
this._position = 0; this._position = 0;
}, },
setZoom : function(zoom) { setZoom: function (zoom) {
this._zoom = zoom; this._zoom = zoom;
}, },
getZoom : function() { getZoom: function () {
return this._zoom; return this._zoom;
}, },
asProperties : function() { asProperties: function () {
return "zoom=" + this._zoom + "\n"; return "zoom=" + this._zoom + "\n";
} }
}); });

View File

@ -2,13 +2,13 @@ mindplot.Events = new Class({
$events: {}, $events: {},
_removeOn: function(string){ _removeOn: function (string) {
return string.replace(/^on([A-Z])/, function(full, first){ return string.replace(/^on([A-Z])/, function (full, first) {
return first.toLowerCase(); return first.toLowerCase();
}); });
}, },
addEvent: function(type, fn, internal){ addEvent: function (type, fn, internal) {
type = this._removeOn(type); type = this._removeOn(type);
this.$events[type] = (this.$events[type] || []).include(fn); this.$events[type] = (this.$events[type] || []).include(fn);
@ -16,23 +16,23 @@ mindplot.Events = new Class({
return this; return this;
}, },
fireEvent: function(type, args, delay){ fireEvent: function (type, args, delay) {
type = this._removeOn(type); type = this._removeOn(type);
var events = this.$events[type]; var events = this.$events[type];
if (!events) return this; if (!events) return this;
args = Array.from(args); args = Array.from(args);
_.each(events, function(fn){ _.each(events, function (fn) {
if (delay) fn.delay(delay, this, args); if (delay) fn.delay(delay, this, args);
else fn.apply(this, args); else fn.apply(this, args);
}, this); }, this);
return this; return this;
}, },
removeEvent: function(type, fn){ removeEvent: function (type, fn) {
type = this._removeOn(type); type = this._removeOn(type);
var events = this.$events[type]; var events = this.$events[type];
if (events && !fn.internal){ if (events && !fn.internal) {
var index = events.indexOf(fn); var index = events.indexOf(fn);
if (index != -1) events.splice(index, 1); if (index != -1) events.splice(index, 1);
} }
return this; return this;

View File

@ -17,38 +17,38 @@
*/ */
mindplot.Icon = new Class({ mindplot.Icon = new Class({
initialize:function(url) { initialize: function (url) {
$assert(url, 'topic can not be null'); $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(mindplot.Icon.SIZE, mindplot.Icon.SIZE); this._image.setSize(mindplot.Icon.SIZE, mindplot.Icon.SIZE);
}, },
getImage : function() { getImage: function () {
return this._image; return this._image;
}, },
setGroup : function(group) { setGroup: function (group) {
this._group = group; this._group = group;
}, },
getGroup : function() { getGroup: function () {
return this._group; return this._group;
}, },
getSize : function() { getSize: function () {
return this._image.getSize(); return this._image.getSize();
}, },
getPosition : function() { getPosition: function () {
return this._image.getPosition(); return this._image.getPosition();
}, },
addEvent : function(type, fnc) { addEvent: function (type, fnc) {
this._image.addEvent(type, fnc); this._image.addEvent(type, fnc);
}, },
remove : function() { remove: function () {
throw "Unsupported operation"; throw "Unsupported operation";
} }
}); });

View File

@ -24,12 +24,19 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
* @throws will throw an error if topicId is null or undefined * @throws will throw an error if topicId is null or undefined
* @throws will throw an error if iconSize is null or undefined * @throws will throw an error if iconSize is null or undefined
*/ */
initialize:function (topicId, iconSize) { initialize: function (topicId, iconSize) {
$assert($defined(topicId), "topicId can not be null"); $assert($defined(topicId), "topicId can not be null");
$assert($defined(iconSize), "iconSize can not be null"); $assert($defined(iconSize), "iconSize can not be null");
this._icons = []; this._icons = [];
this._group = new web2d.Group({width:0, height:iconSize, x:0, y:0, coordSizeWidth:0, coordSizeHeight:100}); this._group = new web2d.Group({
width: 0,
height: iconSize,
x: 0,
y: 0,
coordSizeWidth: 0,
coordSizeHeight: 100
});
this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId); this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId);
this.seIconSize(iconSize, iconSize); this.seIconSize(iconSize, iconSize);
@ -38,28 +45,28 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
}, },
/** */ /** */
setPosition:function (x, y) { setPosition: function (x, y) {
this._group.setPosition(x, y); this._group.setPosition(x, y);
}, },
/** */ /** */
getPosition:function () { getPosition: function () {
return this._group.getPosition(); return this._group.getPosition();
}, },
/** */ /** */
getNativeElement:function () { getNativeElement: function () {
return this._group; return this._group;
}, },
/** */ /** */
getSize:function () { getSize: function () {
return this._group.getSize(); return this._group.getSize();
}, },
/** */ /** */
seIconSize:function (width, height) { seIconSize: function (width, height) {
this._iconSize = {width:width, height:height}; this._iconSize = {width: width, height: height};
this._resize(this._icons.length); this._resize(this._icons.length);
}, },
@ -68,7 +75,7 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
* @param {Boolean} remove * @param {Boolean} remove
* @throws will throw an error if icon is not defined * @throws will throw an error if icon is not defined
*/ */
addIcon:function (icon, remove) { addIcon: function (icon, remove) {
$defined(icon, "icon is not defined"); $defined(icon, "icon is not defined");
icon.setGroup(this); icon.setGroup(this);
@ -87,7 +94,7 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
} }
}, },
_findIconFromModel:function (iconModel) { _findIconFromModel: function (iconModel) {
var result = null; var result = null;
_.each(this._icons, function (icon) { _.each(this._icons, function (icon) {
var elModel = icon.getModel(); var elModel = icon.getModel();
@ -104,14 +111,14 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
}, },
/** */ /** */
removeIconByModel:function (featureModel) { removeIconByModel: function (featureModel) {
$assert(featureModel, "featureModel can not be null"); $assert(featureModel, "featureModel can not be null");
var icon = this._findIconFromModel(featureModel); var icon = this._findIconFromModel(featureModel);
this._removeIcon(icon); this._removeIcon(icon);
}, },
_removeIcon:function (icon) { _removeIcon: function (icon) {
$assert(icon, "icon can not be null"); $assert(icon, "icon can not be null");
this._removeTip.close(0); this._removeTip.close(0);
@ -127,11 +134,11 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
}, },
/** */ /** */
moveToFront:function () { moveToFront: function () {
this._group.moveToFront(); this._group.moveToFront();
}, },
_registerListeners:function () { _registerListeners: function () {
this._group.addEvent('click', function (event) { this._group.addEvent('click', function (event) {
// Avoid node creation ... // Avoid node creation ...
event.stopPropagation(); event.stopPropagation();
@ -144,14 +151,14 @@ mindplot.IconGroup = new Class(/**@lends IconGroup */{
}); });
}, },
_resize:function (iconsLength) { _resize: function (iconsLength) {
this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height); this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height);
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
this._group.setCoordSize(iconsLength * iconSize, iconSize); this._group.setCoordSize(iconsLength * iconSize, iconSize);
}, },
_positionIcon:function (icon, order) { _positionIcon: function (icon, order) {
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING); icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING);
@ -171,7 +178,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
* @constructs * @constructs
* @param container * @param container
*/ */
initialize:function (container) { initialize: function (container) {
$assert(container, "group can not be null"); $assert(container, "group can not be null");
this._fadeElem = container; this._fadeElem = container;
}, },
@ -182,7 +189,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
* @param icon * @param icon
* @throws will throw an error if icon is null or undefined * @throws will throw an error if icon is null or undefined
*/ */
show:function (topicId, icon) { show: function (topicId, icon) {
$assert(icon, 'icon can not be null'); $assert(icon, 'icon can not be null');
// Nothing to do ... // Nothing to do ...
@ -224,14 +231,14 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
}, },
/** */ /** */
hide:function () { hide: function () {
this.close(200); this.close(200);
}, },
/** /**
* @param delay * @param delay
*/ */
close:function (delay) { close: function (delay) {
// This is not ok, trying to close the same dialog twice ? // This is not ok, trying to close the same dialog twice ?
if (this._closeTimeoutId) { if (this._closeTimeoutId) {
@ -257,43 +264,43 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
} }
}, },
_buildWeb2d:function () { _buildWeb2d: function () {
var result = new web2d.Group({ var result = new web2d.Group({
width:10, width: 10,
height:10, height: 10,
x:0, x: 0,
y:0, y: 0,
coordSizeWidth:10, coordSizeWidth: 10,
coordSizeHeight:10 coordSizeHeight: 10
}); });
var outerRect = new web2d.Rect(0, { var outerRect = new web2d.Rect(0, {
x:0, x: 0,
y:0, y: 0,
width:10, width: 10,
height:10, height: 10,
stroke:'0', stroke: '0',
fillColor:'black' fillColor: 'black'
}); });
result.append(outerRect); result.append(outerRect);
outerRect.setCursor('pointer'); outerRect.setCursor('pointer');
var innerRect = new web2d.Rect(0, { var innerRect = new web2d.Rect(0, {
x:1, x: 1,
y:1, y: 1,
width:8, width: 8,
height:8, height: 8,
stroke:'1 solid white', stroke: '1 solid white',
fillColor:'gray' fillColor: 'gray'
}); });
result.append(innerRect); result.append(innerRect);
var line = new web2d.Line({stroke:'1 solid white'}); var line = new web2d.Line({stroke: '1 solid white'});
line.setFrom(1, 1); line.setFrom(1, 1);
line.setTo(9, 9); line.setTo(9, 9);
result.append(line); result.append(line);
var line2 = new web2d.Line({stroke:'1 solid white'}); var line2 = new web2d.Line({stroke: '1 solid white'});
line2.setFrom(1, 9); line2.setFrom(1, 9);
line2.setTo(9, 1); line2.setTo(9, 1);
result.append(line2); result.append(line2);
@ -314,7 +321,7 @@ mindplot.IconGroup.RemoveTip = new Class(/** @lends IconGroup.RemoveTip */{
* @param topicId * @param topicId
* @param icon * @param icon
*/ */
decorate:function (topicId, icon) { decorate: function (topicId, icon) {
var me = this; var me = this;

View File

@ -17,8 +17,8 @@
*/ */
mindplot.ImageIcon = new Class({ mindplot.ImageIcon = new Class({
Extends:mindplot.Icon, Extends: mindplot.Icon,
initialize:function (topic, iconModel, readOnly) { initialize: function (topic, iconModel, readOnly) {
$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');
@ -49,15 +49,15 @@ mindplot.ImageIcon = new Class({
} }
}, },
_getImageUrl:function (iconId) { _getImageUrl: function (iconId) {
return "icons/" + iconId + ".png"; return "icons/" + iconId + ".png";
}, },
getModel:function () { getModel: function () {
return this._featureModel; return this._featureModel;
}, },
_getNextFamilyIconId:function (iconId) { _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!");
@ -78,7 +78,7 @@ mindplot.ImageIcon = new Class({
return result; return result;
}, },
_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 '_')");
@ -95,7 +95,7 @@ mindplot.ImageIcon = new Class({
return result; return result;
}, },
remove:function () { remove: function () {
var actionDispatcher = mindplot.ActionDispatcher.getInstance(); var actionDispatcher = mindplot.ActionDispatcher.getInstance();
var featureId = this._featureModel.getId(); var featureId = this._featureModel.getId();
var topicId = this._topicId; var topicId = this._topicId;
@ -104,30 +104,60 @@ mindplot.ImageIcon = new Class({
}); });
mindplot.ImageIcon.prototype.ICON_FAMILIES = [ mindplot.ImageIcon.prototype.ICON_FAMILIES = [
{"id":"face", "icons":["face_plain", "face_sad", "face_crying", "face_smile", "face_surprise", "face_wink"]}, {"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": "funy", "icons": ["funy_angel", "funy_devilish", "funy_glasses", "funy_grin", "funy_kiss", "funy_monkey"]},
{"id":"conn", "icons":["conn_connect", "conn_disconnect"]}, {"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": "sport",
{"id":"thumb", "icons":["thumb_thumb_up", "thumb_thumb_down"]}, "icons": ["sport_basketball", "sport_football", "sport_golf", "sport_raquet", "sport_shuttlecock", "sport_soccer", "sport_tennis"]
{"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": "bulb", "icons": ["bulb_light_on", "bulb_light_off"]},
{"id":"money", "icons":["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]}, {"id": "thumb", "icons": ["thumb_thumb_up", "thumb_thumb_down"]},
{"id":"time", "icons":["time_calendar", "time_clock", "time_hourglass"]}, {"id": "tick", "icons": ["tick_tick", "tick_cross"]},
{"id":"number", "icons":["number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9"]}, {
{"id":"chart", "icons":["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]}, "id": "onoff",
{"id":"sign", "icons":["sign_warning", "sign_info", "sign_stop", "sign_help", "sign_cancel"]}, "icons": ["onoff_clock", "onoff_clock_red", "onoff_add", "onoff_delete", "onoff_status_offline", "onoff_status_online"]
{"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": "money",
{"id":"arrowc", "icons":["arrowc_rotate_anticlockwise", "arrowc_rotate_clockwise", "arrowc_turn_left", "arrowc_turn_right"]}, "icons": ["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]
{"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": "time", "icons": ["time_calendar", "time_clock", "time_hourglass"]},
{"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": "number",
{"id":"tag", "icons":["tag_blue", "tag_green", "tag_orange", "tag_red", "tag_pink", "tag_yellow"]}, "icons": ["number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9"]
{"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"]}, },
{"id":"weather", "icons":["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]}, {"id": "chart", "icons": ["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]},
{"id":"task", "icons":["task_0", "task_25", "task_50", "task_75", "task_100"]} {"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"]
},
{
"id": "weather",
"icons": ["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]
},
{"id": "task", "icons": ["task_0", "task_25", "task_50", "task_75", "task_100"]}
]; ];

View File

@ -18,14 +18,14 @@
mindplot.Keyboard = new Class({ mindplot.Keyboard = new Class({
initialize:function () { initialize: function () {
}, },
addShortcut: function(shortcuts, callback) { addShortcut: function (shortcuts, callback) {
if (!$.isArray(shortcuts)) { if (!$.isArray(shortcuts)) {
shortcuts = [shortcuts]; shortcuts = [shortcuts];
} }
_.each(shortcuts, function(shortcut) { _.each(shortcuts, function (shortcut) {
$(document).bind('keydown', shortcut, callback); $(document).bind('keydown', shortcut, callback);
}); });
} }

View File

@ -18,8 +18,8 @@
mindplot.LinkIcon = new Class({ mindplot.LinkIcon = new Class({
Extends:mindplot.Icon, Extends: mindplot.Icon,
initialize:function (topic, linkModel, readOnly) { initialize: function (topic, linkModel, readOnly) {
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
$assert(linkModel, 'linkModel can not be null'); $assert(linkModel, 'linkModel can not be null');
@ -31,7 +31,7 @@ mindplot.LinkIcon = new Class({
this._registerEvents(); this._registerEvents();
}, },
_registerEvents:function () { _registerEvents: function () {
this._image.setCursor('pointer'); this._image.setCursor('pointer');
this._tip = new mindplot.widget.LinkIconTooltip(this); this._tip = new mindplot.widget.LinkIconTooltip(this);
@ -44,8 +44,8 @@ mindplot.LinkIcon = new Class({
event.stopPropagation(); event.stopPropagation();
}); });
//FIXME: we shouldn't have timeout of that.. //FIXME: we shouldn't have timeout of that..
this.addEvent("mouseleave", function(event) { this.addEvent("mouseleave", function (event) {
window.setTimeout(function() { window.setTimeout(function () {
if (!$("#linkPopover:hover").length) { if (!$("#linkPopover:hover").length) {
me._tip.hide(); me._tip.hide();
} }
@ -54,12 +54,12 @@ mindplot.LinkIcon = new Class({
}); });
} }
$(this.getImage()._peer._native).mouseenter(function() { $(this.getImage()._peer._native).mouseenter(function () {
me._tip.show(); me._tip.show();
}) })
}, },
getModel:function () { getModel: function () {
return this._linksModel; return this._linksModel;
} }
}); });

View File

@ -17,31 +17,31 @@
*/ */
mindplot.LocalStorageManager = new Class({ mindplot.LocalStorageManager = new Class({
Extends:mindplot.PersistenceManager, Extends: mindplot.PersistenceManager,
initialize:function (documentUrl,forceLoad) { initialize: function (documentUrl, forceLoad) {
this.parent(); this.parent();
this.documentUrl = documentUrl; this.documentUrl = documentUrl;
this.forceLoad = forceLoad; this.forceLoad = forceLoad;
}, },
saveMapXml:function (mapId, mapXml, pref, saveHistory, events) { saveMapXml: function (mapId, mapXml, pref, saveHistory, events) {
localStorage.setItem(mapId + "-xml", mapXml); localStorage.setItem(mapId + "-xml", mapXml);
}, },
discardChanges:function (mapId) { discardChanges: function (mapId) {
localStorage.removeItem(mapId + "-xml"); localStorage.removeItem(mapId + "-xml");
}, },
loadMapDom:function (mapId) { loadMapDom: function (mapId) {
var xml = localStorage.getItem(mapId + "-xml"); var xml = localStorage.getItem(mapId + "-xml");
if (xml == null || this.forceLoad) { if (xml == null || this.forceLoad) {
$.ajax({ $.ajax({
url: this.documentUrl.replace("{id}", mapId), url: this.documentUrl.replace("{id}", mapId),
headers:{"Content-Type":"text/plain","Accept":"application/xml"}, headers: {"Content-Type": "text/plain", "Accept": "application/xml"},
type:'get', type: 'get',
dataType: "text", dataType: "text",
async: false, async: false,
success:function (response) { success: function (response) {
xml = response; xml = response;
} }
}); });
@ -54,7 +54,7 @@ mindplot.LocalStorageManager = new Class({
return jQuery.parseXML(xml); return jQuery.parseXML(xml);
}, },
unlockMap:function (mindmap) { unlockMap: function (mindmap) {
// Ignore, no implementation required ... // Ignore, no implementation required ...
} }
} }

View File

@ -17,20 +17,20 @@
*/ */
mindplot.MainTopic = new Class(/** @lends MainTopic */{ mindplot.MainTopic = new Class(/** @lends MainTopic */{
Extends:mindplot.Topic, Extends: mindplot.Topic,
/** /**
* @extends mindplot.Topic * @extends mindplot.Topic
* @constructs * @constructs
* @param model * @param model
* @param options * @param options
*/ */
initialize:function (model, options) { initialize: function (model, options) {
this.parent(model, options); this.parent(model, options);
}, },
INNER_RECT_ATTRIBUTES:{stroke:'0.5 solid #009900'}, INNER_RECT_ATTRIBUTES: {stroke: '0.5 solid #009900'},
_buildDragShape:function () { _buildDragShape: function () {
var innerShape = this._buildShape(this.INNER_RECT_ATTRIBUTES, this.getShapeType()); var innerShape = this._buildShape(this.INNER_RECT_ATTRIBUTES, this.getShapeType());
var size = this.getSize(); var size = this.getSize();
innerShape.setSize(size.width, size.height); innerShape.setSize(size.width, size.height);
@ -46,7 +46,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
innerShape.setAttribute("fillColor", bgColor); innerShape.setAttribute("fillColor", bgColor);
// Create group ... // Create group ...
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100}; var groupAttributes = {width: 100, height: 100, coordSizeWidth: 100, coordSizeHeight: 100};
var group = new web2d.Group(groupAttributes); var group = new web2d.Group(groupAttributes);
group.append(innerShape); group.append(innerShape);
@ -62,7 +62,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
}, },
/** */ /** */
updateTopicShape:function (targetTopic, workspace) { updateTopicShape: function (targetTopic, workspace) {
// Change figure based on the connected topic ... // Change figure based on the connected topic ...
var model = this.getModel(); var model = this.getModel();
var shapeType = model.getShapeType(); var shapeType = model.getShapeType();
@ -76,7 +76,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
}, },
/** */ /** */
disconnect:function (workspace) { disconnect: function (workspace) {
this.parent(workspace); this.parent(workspace);
var size = this.getSize(); var size = this.getSize();
@ -91,7 +91,7 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
innerShape.setVisibility(true); innerShape.setVisibility(true);
}, },
_updatePositionOnChangeSize:function (oldSize, newSize) { _updatePositionOnChangeSize: function (oldSize, newSize) {
var xOffset = Math.round((newSize.width - oldSize.width) / 2); var xOffset = Math.round((newSize.width - oldSize.width) / 2);
var pos = this.getPosition(); var pos = this.getPosition();
@ -106,12 +106,12 @@ mindplot.MainTopic = new Class(/** @lends MainTopic */{
}, },
/** */ /** */
workoutIncomingConnectionPoint:function (sourcePosition) { workoutIncomingConnectionPoint: function (sourcePosition) {
return mindplot.util.Shape.workoutIncomingConnectionPoint(this, sourcePosition); return mindplot.util.Shape.workoutIncomingConnectionPoint(this, sourcePosition);
}, },
/** */ /** */
workoutOutgoingConnectionPoint:function (targetPosition) { workoutOutgoingConnectionPoint: function (targetPosition) {
$assert(targetPosition, 'targetPoint can not be null'); $assert(targetPosition, 'targetPoint can not be null');
var pos = this.getPosition(); var pos = this.getPosition();
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos); var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);

View File

@ -17,8 +17,8 @@
*/ */
mindplot.Messages = new Class({ mindplot.Messages = new Class({
Static:{ Static: {
init:function (locale) { init: function (locale) {
locale = $defined(locale) ? locale : 'en'; locale = $defined(locale) ? locale : 'en';
var bundle = mindplot.Messages.BUNDLES[locale]; var bundle = mindplot.Messages.BUNDLES[locale];
if (bundle == null && locale.indexOf("_") != -1) { if (bundle == null && locale.indexOf("_") != -1) {

View File

@ -18,37 +18,37 @@
mindplot.MultilineTextEditor = new Class({ mindplot.MultilineTextEditor = new Class({
Extends: mindplot.Events, Extends: mindplot.Events,
initialize:function () { initialize: function () {
this._topic = null; this._topic = null;
this._timeoutId = -1; this._timeoutId = -1;
}, },
_buildEditor:function () { _buildEditor: function () {
var result = $('<div></div>') var result = $('<div></div>')
.attr('id', 'textContainer') .attr('id', 'textContainer')
.css({ .css({
display:"none", display: "none",
zIndex:"8", zIndex: "8",
overflow:"hidden", overflow: "hidden",
border:"0 none" border: "0 none"
}); });
var textareaElem = $('<textarea tabindex="-1" value="" wrap="off" ></textarea>') var textareaElem = $('<textarea tabindex="-1" value="" wrap="off" ></textarea>')
.css({ .css({
border:"1px gray dashed", border: "1px gray dashed",
background:"rgba(98, 135, 167, .3)", background: "rgba(98, 135, 167, .3)",
outline:'0 none', outline: '0 none',
resize:'none', resize: 'none',
overflow:"hidden" overflow: "hidden"
}); });
result.append(textareaElem); result.append(textareaElem);
return result; return result;
}, },
_registerEvents:function (containerElem) { _registerEvents: function (containerElem) {
var textareaElem = this._getTextareaElem(); var textareaElem = this._getTextareaElem();
var me = this; var me = this;
textareaElem.on('keydown', function (event) { textareaElem.on('keydown', function (event) {
@ -125,7 +125,7 @@ mindplot.MultilineTextEditor = new Class({
}); });
}, },
_adjustEditorSize:function () { _adjustEditorSize: function () {
if (this.isVisible()) { if (this.isVisible()) {
var textElem = this._getTextareaElem(); var textElem = this._getTextareaElem();
@ -141,17 +141,17 @@ mindplot.MultilineTextEditor = new Class({
textElem.attr('rows', lines.length); textElem.attr('rows', lines.length);
this._containerElem.css({ this._containerElem.css({
width:(maxLineLength + 3) + 'em', width: (maxLineLength + 3) + 'em',
height:textElem.height() height: textElem.height()
}); });
} }
}, },
isVisible:function () { isVisible: function () {
return $defined(this._containerElem) && this._containerElem.css('display') == 'block'; return $defined(this._containerElem) && this._containerElem.css('display') == 'block';
}, },
_updateModel:function () { _updateModel: function () {
if (this._topic.getText() != this._getText()) { if (this._topic.getText() != this._getText()) {
var text = this._getText(); var text = this._getText();
@ -180,7 +180,7 @@ mindplot.MultilineTextEditor = new Class({
} }
}, },
_showEditor:function (defaultText) { _showEditor: function (defaultText) {
var topic = this._topic; var topic = this._topic;
@ -218,7 +218,7 @@ mindplot.MultilineTextEditor = new Class({
this._timeoutId = displayFunc.delay(10); this._timeoutId = displayFunc.delay(10);
}, },
_setStyle:function (fontStyle) { _setStyle: function (fontStyle) {
var inputField = this._getTextareaElem(); var inputField = this._getTextareaElem();
if (!$defined(fontStyle.font)) { if (!$defined(fontStyle.font)) {
fontStyle.font = "Arial"; fontStyle.font = "Arial";
@ -233,56 +233,56 @@ mindplot.MultilineTextEditor = new Class({
fontStyle.size = 12; fontStyle.size = 12;
} }
var style = { var style = {
fontSize:fontStyle.size + "px", fontSize: fontStyle.size + "px",
fontFamily:fontStyle.font, fontFamily: fontStyle.font,
fontStyle:fontStyle.style, fontStyle: fontStyle.style,
fontWeight:fontStyle.weight, fontWeight: fontStyle.weight,
color:fontStyle.color color: fontStyle.color
}; };
inputField.css(style); inputField.css(style);
this._containerElem.css(style); this._containerElem.css(style);
}, },
_setText:function (text) { _setText: function (text) {
var textareaElem = this._getTextareaElem(); var textareaElem = this._getTextareaElem();
textareaElem.val(text); textareaElem.val(text);
this._adjustEditorSize(); this._adjustEditorSize();
}, },
_getText:function () { _getText: function () {
return this._getTextareaElem().val(); return this._getTextareaElem().val();
}, },
_getTextareaElem:function () { _getTextareaElem: function () {
return this._containerElem.find('textarea'); return this._containerElem.find('textarea');
}, },
_positionCursor:function (textareaElem, selectText) { _positionCursor: function (textareaElem, selectText) {
textareaElem.focus(); textareaElem.focus();
var lenght = textareaElem.val().length; var lengh = textareaElem.val().length;
if (selectText) { if (selectText) {
// Mark text as selected ... // Mark text as selected ...
if (textareaElem.createTextRange) { if (textareaElem.createTextRange) {
var rang = textareaElem.createTextRange(); var rang = textareaElem.createTextRange();
rang.select(); rang.select();
rang.move("character", lenght); rang.move("character", lengh);
} }
else { else {
textareaElem[0].setSelectionRange(0, lenght); textareaElem[0].setSelectionRange(0, lengh);
} }
} else { } else {
// Move the cursor to the last character .. // Move the cursor to the last character ..
if (textareaElem.createTextRange) { if (textareaElem.createTextRange) {
var range = textareaElem.createTextRange(); var range = textareaElem.createTextRange();
range.move("character", lenght); range.move("character", lengh);
} else { } else {
if (Browser.ie11) { if (Browser.ie11) {
textareaElem[0].selectionStart = lenght; textareaElem[0].selectionStart = lengh;
textareaElem[0].selectionEnd = lenght; textareaElem[0].selectionEnd = lengh;
} else { } else {
textareaElem.selectionStart = lenght; textareaElem.selectionStart = lengh;
textareaElem.selectionEnd = lenght; textareaElem.selectionEnd = lengh;
} }
textareaElem.focus(); textareaElem.focus();
} }
@ -290,7 +290,7 @@ mindplot.MultilineTextEditor = new Class({
}, },
close:function (update) { close: function (update) {
if (this.isVisible() && this._topic) { if (this.isVisible() && this._topic) {
// Update changes ... // Update changes ...
clearTimeout(this._timeoutId); clearTimeout(this._timeoutId);

View File

@ -23,117 +23,117 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
* @param {Object<Number, String, Boolean>} options * @param {Object<Number, String, Boolean>} options
* @throws will throw an error if nodeModel is null or undefined * @throws will throw an error if nodeModel is null or undefined
*/ */
initialize:function(nodeModel, options) { initialize: function (nodeModel, options) {
$assert(nodeModel, "model can not be null"); $assert(nodeModel, "model can not be null");
this._options = options; this._options = options;
this._mouseEvents = true; this._mouseEvents = true;
this.setModel(nodeModel); this.setModel(nodeModel);
this._onFocus = false; this._onFocus = false;
this._size = {width:50,height:20}; this._size = {width: 50, height: 20};
}, },
/** @return true if option is set to read-only */ /** @return true if option is set to read-only */
isReadOnly : function(){ isReadOnly: function () {
return this._options.readOnly; return this._options.readOnly;
}, },
/** @return model type */ /** @return model type */
getType : function() { getType: function () {
var model = this.getModel(); var model = this.getModel();
return model.getType(); return model.getType();
}, },
/** /**
* @param {String} id * @param {String} id
* @throws will throw an error if the topic id is not a number * @throws will throw an error if the topic id is not a number
*/ */
setId : function(id) { setId: function (id) {
$assert(typeof topic.getId() == "number", "id is not a number:" + id); $assert(typeof topic.getId() == "number", "id is not a number:" + id);
this.getModel().setId(id); this.getModel().setId(id);
}, },
_set2DElement : function(elem2d) { _set2DElement: function (elem2d) {
this._elem2d = elem2d; this._elem2d = elem2d;
}, },
/** /**
* @return 2D element * @return 2D element
* @throws will throw an error if the element is null or undefined within node graph * @throws will throw an error if the element is null or undefined within node graph
*/ */
get2DElement : function() { get2DElement: function () {
$assert(this._elem2d, 'NodeGraph has not been initialized properly'); $assert(this._elem2d, 'NodeGraph has not been initialized properly');
return this._elem2d; return this._elem2d;
}, },
/** @abstract */ /** @abstract */
setPosition : function(point, fireEvent) { setPosition: function (point, fireEvent) {
throw "Unsupported operation"; throw "Unsupported operation";
}, },
/** */ /** */
addEvent : function(type, listener) { addEvent: function (type, listener) {
var elem = this.get2DElement(); var elem = this.get2DElement();
elem.addEvent(type, listener); elem.addEvent(type, listener);
}, },
/** */ /** */
removeEvent : function(type, listener) { removeEvent: function (type, listener) {
var elem = this.get2DElement(); var elem = this.get2DElement();
elem.removeEvent(type, listener); elem.removeEvent(type, listener);
}, },
/** */ /** */
fireEvent: function(type, event) { fireEvent: function (type, event) {
var elem = this.get2DElement(); var elem = this.get2DElement();
elem.trigger(type, event); elem.trigger(type, event);
}, },
/** */ /** */
setMouseEventsEnabled : function(isEnabled) { setMouseEventsEnabled: function (isEnabled) {
this._mouseEvents = isEnabled; this._mouseEvents = isEnabled;
}, },
/** */ /** */
isMouseEventsEnabled : function() { isMouseEventsEnabled: function () {
return this._mouseEvents; return this._mouseEvents;
}, },
/** @return {Object<Number>} size*/ /** @return {Object<Number>} size*/
getSize : function() { getSize: function () {
return this._size; return this._size;
}, },
/** @param {Object<Number>} size*/ /** @param {Object<Number>} size*/
setSize : function(size) { setSize: function (size) {
this._size.width = parseInt(size.width); this._size.width = parseInt(size.width);
this._size.height = parseInt(size.height); this._size.height = parseInt(size.height);
}, },
/** /**
* @return {mindplot.model.NodeModel} the node model * @return {mindplot.model.NodeModel} the node model
*/ */
getModel:function() { getModel: function () {
$assert(this._model, 'Model has not been initialized yet'); $assert(this._model, 'Model has not been initialized yet');
return this._model; return this._model;
}, },
/** /**
* @param {mindplot.NodeModel} model the node model * @param {mindplot.NodeModel} model the node model
* @throws will throw an error if model is null or undefined * @throws will throw an error if model is null or undefined
*/ */
setModel : function(model) { setModel: function (model) {
$assert(model, 'Model can not be null'); $assert(model, 'Model can not be null');
this._model = model; this._model = model;
}, },
/** */ /** */
getId : function() { getId: function () {
return this._model.getId(); return this._model.getId();
}, },
/** */ /** */
setOnFocus : function(focus) { setOnFocus: function (focus) {
if (this._onFocus != focus) { if (this._onFocus != focus) {
this._onFocus = focus; this._onFocus = focus;
@ -152,34 +152,34 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
this.closeEditors(); this.closeEditors();
// Fire event ... // Fire event ...
this.fireEvent(focus ? 'ontfocus' : 'ontblur',this); this.fireEvent(focus ? 'ontfocus' : 'ontblur', this);
} }
}, },
/** @return {Boolean} true if the node graph is on focus */ /** @return {Boolean} true if the node graph is on focus */
isOnFocus : function() { isOnFocus: function () {
return this._onFocus; return this._onFocus;
}, },
/** */ /** */
dispose : function(workspace) { dispose: function (workspace) {
this.setOnFocus(false); this.setOnFocus(false);
workspace.removeChild(this); workspace.removeChild(this);
}, },
/** */ /** */
createDragNode : function(layoutManager) { createDragNode: function (layoutManager) {
var dragShape = this._buildDragShape(); var dragShape = this._buildDragShape();
return new mindplot.DragTopic(dragShape, this, layoutManager); return new mindplot.DragTopic(dragShape, this, layoutManager);
}, },
_buildDragShape : function() { _buildDragShape: function () {
$assert(false, '_buildDragShape must be implemented by all nodes.'); $assert(false, '_buildDragShape must be implemented by all nodes.');
}, },
/** */ /** */
getPosition : function() { getPosition: function () {
var model = this.getModel(); var model = this.getModel();
return model.getPosition(); return model.getPosition();
} }
@ -192,11 +192,11 @@ mindplot.NodeGraph = new Class(/** @lends NodeGraph */{
* @param {Object} options * @param {Object} options
* @throws will throw an error if nodeModel is null or undefined * @throws will throw an error if nodeModel is null or undefined
* @throws will throw an error if the nodeModel's type is null or undefined * @throws will throw an error if the nodeModel's type is null or undefined
* @throws will throw an error if the node type cannot be recognized as either central or main * @throws will throw an error if the node type cannot be recognized as either central or main
* topic type * topic type
* @return {mindplot.CentralTopic|mindplot.MainTopic} the new topic * @return {mindplot.CentralTopic|mindplot.MainTopic} the new topic
*/ */
mindplot.NodeGraph.create = function(nodeModel, options) { mindplot.NodeGraph.create = function (nodeModel, options) {
$assert(nodeModel, 'Model can not be null'); $assert(nodeModel, 'Model can not be null');
var type = nodeModel.getType(); var type = nodeModel.getType();
@ -205,8 +205,7 @@ mindplot.NodeGraph.create = function(nodeModel, options) {
var result; var result;
if (type == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) { if (type == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
result = new mindplot.CentralTopic(nodeModel, options); result = new mindplot.CentralTopic(nodeModel, options);
} else } else if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
result = new mindplot.MainTopic(nodeModel, options); result = new mindplot.MainTopic(nodeModel, options);
} else { } else {
$assert(false, "unsupported node type:" + type); $assert(false, "unsupported node type:" + type);

View File

@ -17,8 +17,8 @@
*/ */
mindplot.NoteIcon = new Class({ mindplot.NoteIcon = new Class({
Extends:mindplot.Icon, Extends: mindplot.Icon,
initialize:function (topic, noteModel, readOnly) { initialize: function (topic, noteModel, readOnly) {
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
this.parent(mindplot.NoteIcon.IMAGE_URL); this.parent(mindplot.NoteIcon.IMAGE_URL);
@ -29,7 +29,7 @@ mindplot.NoteIcon = new Class({
this._registerEvents(); this._registerEvents();
}, },
_registerEvents:function () { _registerEvents: function () {
this._image.setCursor('pointer'); this._image.setCursor('pointer');
var me = this; var me = this;
@ -44,27 +44,27 @@ mindplot.NoteIcon = new Class({
title: $msg('NOTE'), title: $msg('NOTE'),
container: 'body', container: 'body',
// Content can also be a function of the target element! // Content can also be a function of the target element!
content: function() { content: function () {
return me._buildTooltipContent(); return me._buildTooltipContent();
}, },
html:true, html: true,
placement:'bottom', placement: 'bottom',
destroyOnExit: true destroyOnExit: true
}); });
}, },
_buildTooltipContent: function() { _buildTooltipContent: function () {
if ($("body").find("#textPopoverNote").length == 1) { if ($("body").find("#textPopoverNote").length == 1) {
var text = $("body").find("#textPopoverNote"); var text = $("body").find("#textPopoverNote");
text.text(this._linksModel.getText()); text.text(this._linksModel.getText());
} else { } else {
var result = $('<div id="textPopoverNote"></div>').css({padding:'5px'}); var result = $('<div id="textPopoverNote"></div>').css({padding: '5px'});
var text = $('<div></div>').text(this._linksModel.getText()) var text = $('<div></div>').text(this._linksModel.getText())
.css({ .css({
'white-space':'pre-wrap', 'white-space': 'pre-wrap',
'word-wrap':'break-word' 'word-wrap': 'break-word'
} }
); );
result.append(text); result.append(text);
@ -72,7 +72,7 @@ mindplot.NoteIcon = new Class({
} }
}, },
getModel:function () { getModel: function () {
return this._linksModel; return this._linksModel;
} }
}); });

View File

@ -1,8 +1,8 @@
Options = new Class({ Options = new Class({
setOptions: function(){ setOptions: function () {
var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
if (this.addEvent) for (var option in options){ if (this.addEvent) for (var option in options) {
if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
this.addEvent(option, options[option]); this.addEvent(option, options[option]);
delete options[option]; delete options[option];

View File

@ -17,8 +17,8 @@
*/ */
mindplot.PersistenceManager = new Class({ mindplot.PersistenceManager = new Class({
Static:{ Static: {
loadFromDom:function (mapId, mapDom) { loadFromDom: function (mapId, mapDom) {
$assert(mapId, "mapId can not be null"); $assert(mapId, "mapId can not be null");
$assert(mapDom, "mapDom can not be null"); $assert(mapDom, "mapDom can not be null");
@ -27,11 +27,11 @@ mindplot.PersistenceManager = new Class({
} }
}, },
initialize:function () { initialize: function () {
}, },
save:function (mindmap, editorProperties, saveHistory, events, sync) { save: function (mindmap, editorProperties, saveHistory, events, sync) {
$assert(mindmap, "mindmap can not be null"); $assert(mindmap, "mindmap can not be null");
$assert(editorProperties, "editorProperties can not be null"); $assert(editorProperties, "editorProperties can not be null");
@ -51,25 +51,25 @@ mindplot.PersistenceManager = new Class({
} }
}, },
load:function (mapId) { load: function (mapId) {
$assert(mapId, "mapId can not be null"); $assert(mapId, "mapId can not be null");
var domDocument = this.loadMapDom(mapId); var domDocument = this.loadMapDom(mapId);
return mindplot.PersistenceManager.loadFromDom(mapId, domDocument); return mindplot.PersistenceManager.loadFromDom(mapId, domDocument);
}, },
discardChanges:function (mapId) { discardChanges: function (mapId) {
throw new Error("Method must be implemented"); throw new Error("Method must be implemented");
}, },
loadMapDom:function (mapId) { loadMapDom: function (mapId) {
throw new Error("Method must be implemented"); throw new Error("Method must be implemented");
}, },
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) { saveMapXml: function (mapId, mapXml, pref, saveHistory, events, sync) {
throw new Error("Method must be implemented"); throw new Error("Method must be implemented");
}, },
unlockMap:function (mindmap) { unlockMap: function (mindmap) {
throw new Error("Method must be implemented"); throw new Error("Method must be implemented");
} }
}); });

View File

@ -16,14 +16,14 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.Relationship = new Class({ mindplot.Relationship = new Class({
Extends:mindplot.ConnectionLine, Extends: mindplot.ConnectionLine,
Static:{ Static: {
getStrokeColor:function () { getStrokeColor: function () {
return '#9b74e6'; return '#9b74e6';
}, },
type:"Relationship" type: "Relationship"
}, },
initialize:function (sourceNode, targetNode, model) { initialize: function (sourceNode, targetNode, model) {
$assert(sourceNode, "sourceNode can not be null"); $assert(sourceNode, "sourceNode can not be null");
$assert(targetNode, "targetNode can not be null"); $assert(targetNode, "targetNode can not be null");
@ -71,12 +71,12 @@ mindplot.Relationship = new Class({
} }
}, },
setStroke:function (color, style, opacity) { setStroke: function (color, style, opacity) {
this.parent(color, style, opacity); this.parent(color, style, opacity);
this._startArrow.setStrokeColor(color); this._startArrow.setStrokeColor(color);
}, },
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();
@ -128,7 +128,7 @@ mindplot.Relationship = new Class({
this._controlPointsController.redraw(); this._controlPointsController.redraw();
}, },
_positionArrows:function () { _positionArrows: function () {
var tpos = this._line2d.getTo(); var tpos = this._line2d.getTo();
var spos = this._line2d.getFrom(); var spos = this._line2d.getFrom();
@ -159,7 +159,7 @@ mindplot.Relationship = new Class({
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow); this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
}, },
addToWorkspace:function (workspace) { addToWorkspace: function (workspace) {
workspace.append(this._focusShape); workspace.append(this._focusShape);
workspace.append(this._controlPointsController); workspace.append(this._controlPointsController);
@ -177,11 +177,11 @@ mindplot.Relationship = new Class({
}, },
_initializeControlPointController:function () { _initializeControlPointController: function () {
this.setOnFocus(true); this.setOnFocus(true);
}, },
removeFromWorkspace:function (workspace) { removeFromWorkspace: function (workspace) {
workspace.removeChild(this._focusShape); workspace.removeChild(this._focusShape);
workspace.removeChild(this._controlPointsController); workspace.removeChild(this._controlPointsController);
this._line2d.removeEvent('click', this._controlPointControllerListener); this._line2d.removeEvent('click', this._controlPointControllerListener);
@ -193,11 +193,11 @@ mindplot.Relationship = new Class({
this.parent(workspace); this.parent(workspace);
}, },
getType:function () { getType: function () {
return mindplot.Relationship.type; return mindplot.Relationship.type;
}, },
setOnFocus:function (focus) { setOnFocus: function (focus) {
// Change focus shape // Change focus shape
if (this.isOnFocus() != focus) { if (this.isOnFocus() != focus) {
if (focus) { if (focus) {
@ -212,7 +212,7 @@ mindplot.Relationship = new Class({
} }
}, },
_refreshShape:function () { _refreshShape: 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();
@ -226,7 +226,7 @@ mindplot.Relationship = new Class({
this._focusShape.updateLine(); this._focusShape.updateLine();
}, },
addEvent:function (type, listener) { addEvent: function (type, listener) {
// Translate to web 2d events ... // Translate to web 2d events ...
if (type == 'onfocus') { if (type == 'onfocus') {
type = 'mousedown'; type = 'mousedown';
@ -236,22 +236,22 @@ mindplot.Relationship = new Class({
line.addEvent(type, listener); line.addEvent(type, listener);
}, },
isOnFocus:function () { isOnFocus: function () {
return this._onFocus; return this._onFocus;
}, },
isInWorkspace:function () { isInWorkspace: function () {
return this._isInWorkspace; return this._isInWorkspace;
}, },
setVisibility:function (value) { setVisibility: function (value) {
this.parent(value); this.parent(value);
if (this._showEndArrow) if (this._showEndArrow)
this._endArrow.setVisibility(this._showEndArrow); this._endArrow.setVisibility(this._showEndArrow);
this._startArrow.setVisibility(this._showStartArrow && value); this._startArrow.setVisibility(this._showStartArrow && value);
}, },
setOpacity:function (opacity) { setOpacity: function (opacity) {
this.parent(opacity); this.parent(opacity);
if (this._showEndArrow) if (this._showEndArrow)
this._endArrow.setOpacity(opacity); this._endArrow.setOpacity(opacity);
@ -259,19 +259,19 @@ mindplot.Relationship = new Class({
this._startArrow.setOpacity(opacity); this._startArrow.setOpacity(opacity);
}, },
setShowEndArrow:function (visible) { setShowEndArrow: function (visible) {
this._showEndArrow = visible; this._showEndArrow = visible;
if (this._isInWorkspace) if (this._isInWorkspace)
this.redraw(); this.redraw();
}, },
setShowStartArrow:function (visible) { setShowStartArrow: function (visible) {
this._showStartArrow = visible; this._showStartArrow = visible;
if (this._isInWorkspace) if (this._isInWorkspace)
this.redraw(); this.redraw();
}, },
setFrom:function (x, y) { setFrom: function (x, y) {
$assert($defined(x), "x must be defined"); $assert($defined(x), "x must be defined");
$assert($defined(y), "y must be defined"); $assert($defined(y), "y must be defined");
@ -279,7 +279,7 @@ mindplot.Relationship = new Class({
this._startArrow.setFrom(x, y); this._startArrow.setFrom(x, y);
}, },
setTo:function (x, y) { setTo: function (x, y) {
$assert($defined(x), "x must be defined"); $assert($defined(x), "x must be defined");
$assert($defined(y), "y must be defined"); $assert($defined(y), "y must be defined");
@ -288,42 +288,42 @@ mindplot.Relationship = new Class({
this._endArrow.setFrom(x, y); this._endArrow.setFrom(x, y);
}, },
setSrcControlPoint:function (control) { setSrcControlPoint: function (control) {
this._line2d.setSrcControlPoint(control); this._line2d.setSrcControlPoint(control);
this._startArrow.setControlPoint(control); this._startArrow.setControlPoint(control);
}, },
setDestControlPoint:function (control) { setDestControlPoint: function (control) {
this._line2d.setDestControlPoint(control); this._line2d.setDestControlPoint(control);
if (this._showEndArrow) if (this._showEndArrow)
this._endArrow.setControlPoint(control); this._endArrow.setControlPoint(control);
}, },
getControlPoints:function () { getControlPoints: function () {
return this._line2d.getControlPoints(); return this._line2d.getControlPoints();
}, },
isSrcControlPointCustom:function () { isSrcControlPointCustom: function () {
return this._line2d.isSrcControlPointCustom(); return this._line2d.isSrcControlPointCustom();
}, },
isDestControlPointCustom:function () { isDestControlPointCustom: function () {
return this._line2d.isDestControlPointCustom(); return this._line2d.isDestControlPointCustom();
}, },
setIsSrcControlPointCustom:function (isCustom) { setIsSrcControlPointCustom: function (isCustom) {
this._line2d.setIsSrcControlPointCustom(isCustom); this._line2d.setIsSrcControlPointCustom(isCustom);
}, },
setIsDestControlPointCustom:function (isCustom) { setIsDestControlPointCustom: function (isCustom) {
this._line2d.setIsDestControlPointCustom(isCustom); this._line2d.setIsDestControlPointCustom(isCustom);
}, },
getId:function () { getId: function () {
return this._model.getId(); return this._model.getId();
}, },
fireEvent:function (type, event) { fireEvent: function (type, event) {
var elem = this._line2d; var elem = this._line2d;
elem.trigger(type, event); elem.trigger(type, event);
} }

View File

@ -17,7 +17,7 @@
*/ */
mindplot.RelationshipPivot = new Class({ mindplot.RelationshipPivot = new Class({
initialize:function (workspace, designer) { initialize: function (workspace, designer) {
$assert(workspace, "workspace can not be null"); $assert(workspace, "workspace can not be null");
$assert(designer, "designer can not be null"); $assert(designer, "designer can not be null");
this._workspace = workspace; this._workspace = workspace;
@ -30,7 +30,7 @@ mindplot.RelationshipPivot = new Class({
}, },
start:function (sourceTopic, targetPos) { start: function (sourceTopic, targetPos) {
$assert(sourceTopic, "sourceTopic can not be null"); $assert(sourceTopic, "sourceTopic can not be null");
$assert(targetPos, "targetPos can not be null"); $assert(targetPos, "targetPos can not be null");
@ -73,7 +73,7 @@ mindplot.RelationshipPivot = new Class({
}, },
dispose:function () { dispose: function () {
var workspace = this._workspace; var workspace = this._workspace;
if (this._isActive()) { if (this._isActive()) {
@ -97,7 +97,7 @@ mindplot.RelationshipPivot = new Class({
} }
}, },
_mouseMove:function (event) { _mouseMove: function (event) {
var screen = this._workspace.getScreenManager(); var screen = this._workspace.getScreenManager();
var pos = screen.getWorkspaceMousePosition(event); var pos = screen.getWorkspaceMousePosition(event);
@ -119,14 +119,14 @@ mindplot.RelationshipPivot = new Class({
return false; return false;
}, },
_cleanOnMouseClick:function (event) { _cleanOnMouseClick: function (event) {
// The user clicks on a desktop on in other element that is not a node. // The user clicks on a desktop on in other element that is not a node.
this.dispose(); this.dispose();
event.stopPropagation(); event.stopPropagation();
}, },
_calculateFromPosition:function (toPosition) { _calculateFromPosition: function (toPosition) {
// Calculate origin position ... // Calculate origin position ...
var sourcePosition = this._sourceTopic.getPosition(); var sourcePosition = this._sourceTopic.getPosition();
@ -138,10 +138,10 @@ mindplot.RelationshipPivot = new Class({
var spoint = new core.Point(); var spoint = new core.Point();
spoint.x = parseInt(controlPoint[0].x) + parseInt(sourcePosition.x); spoint.x = parseInt(controlPoint[0].x) + parseInt(sourcePosition.x);
spoint.y = parseInt(controlPoint[0].y) + parseInt(sourcePosition.y); spoint.y = parseInt(controlPoint[0].y) + parseInt(sourcePosition.y);
return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint); return mindplot.util.Shape.calculateRelationShipPointCoordinates(this._sourceTopic, spoint);
}, },
_connectOnFocus:function (event, targetTopic) { _connectOnFocus: function (event, targetTopic) {
var sourceTopic = this._sourceTopic; var sourceTopic = this._sourceTopic;
var mindmap = this._designer.getMindmap(); var mindmap = this._designer.getMindmap();
@ -153,7 +153,7 @@ mindplot.RelationshipPivot = new Class({
this.dispose(); this.dispose();
}, },
_isActive:function () { _isActive: function () {
return this._pivot != null; return this._pivot != null;
} }
}); });

View File

@ -17,8 +17,8 @@
*/ */
mindplot.RESTPersistenceManager = new Class({ mindplot.RESTPersistenceManager = new Class({
Extends:mindplot.PersistenceManager, Extends: mindplot.PersistenceManager,
initialize:function (options) { initialize: function (options) {
this.parent(); this.parent();
$assert(options.documentUrl, "documentUrl can not be null"); $assert(options.documentUrl, "documentUrl can not be null");
$assert(options.revertUrl, "revertUrl can not be null"); $assert(options.revertUrl, "revertUrl can not be null");
@ -33,12 +33,12 @@ mindplot.RESTPersistenceManager = new Class({
this.session = options.session; this.session = options.session;
}, },
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) { saveMapXml: function (mapId, mapXml, pref, saveHistory, events, sync) {
var data = { var data = {
id:mapId, id: mapId,
xml:mapXml, xml: mapXml,
properties:pref properties: pref
}; };
var persistence = this; var persistence = this;
@ -57,11 +57,11 @@ mindplot.RESTPersistenceManager = new Class({
$.ajax({ $.ajax({
url: this.documentUrl.replace("{id}", mapId) + "?" + query, url: this.documentUrl.replace("{id}", mapId) + "?" + query,
type:'put', type: 'put',
dataType:"json", dataType: "json",
data: JSON.stringify(data), data: JSON.stringify(data),
contentType:"application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
async:!sync, async: !sync,
success: function (data, textStatus, jqXHRresponseText) { success: function (data, textStatus, jqXHRresponseText) {
persistence.timestamp = data; persistence.timestamp = data;
@ -77,10 +77,10 @@ mindplot.RESTPersistenceManager = new Class({
} }
persistence.onSave = false; persistence.onSave = false;
}, },
fail:function (xhr, textStatus) { fail: function (xhr, textStatus) {
var responseText = xhr.responseText; var responseText = xhr.responseText;
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')}; var userMsg = {severity: "SEVERE", message: $msg('SAVE_COULD_NOT_BE_COMPLETED')};
var contentType = xhr.getResponseHeader("Content-Type"); var contentType = xhr.getResponseHeader("Content-Type");
if (contentType != null && contentType.indexOf("application/json") != -1) { if (contentType != null && contentType.indexOf("application/json") != -1) {
@ -95,7 +95,7 @@ mindplot.RESTPersistenceManager = new Class({
} else { } else {
if (this.status == 405) { if (this.status == 405) {
userMsg = {severity:"SEVERE", message:$msg('SESSION_EXPIRED')}; userMsg = {severity: "SEVERE", message: $msg('SESSION_EXPIRED')};
} }
} }
events.onError(userMsg); events.onError(userMsg);
@ -105,27 +105,27 @@ mindplot.RESTPersistenceManager = new Class({
} }
}, },
discardChanges:function (mapId) { discardChanges: function (mapId) {
$.ajax({ $.ajax({
url:this.revertUrl.replace("{id}", mapId), url: this.revertUrl.replace("{id}", mapId),
async:false, async: false,
method:'post', method: 'post',
headers:{"Content-Type":"application/json; charset=utf-8", "Accept":"application/json"} headers: {"Content-Type": "application/json; charset=utf-8", "Accept": "application/json"}
}); });
}, },
unlockMap:function (mindmap) { unlockMap: function (mindmap) {
var mapId = mindmap.getId(); var mapId = mindmap.getId();
$.ajax({ $.ajax({
url:this.lockUrl.replace("{id}", mapId), url: this.lockUrl.replace("{id}", mapId),
async:false, async: false,
method:'put', method: 'put',
headers:{"Content-Type":"text/plain"}, headers: {"Content-Type": "text/plain"},
data: "false" data: "false"
}); });
}, },
_buildError:function (jsonSeverResponse) { _buildError: function (jsonSeverResponse) {
var message = jsonSeverResponse ? jsonSeverResponse.globalErrors[0] : null; var message = jsonSeverResponse ? jsonSeverResponse.globalErrors[0] : null;
var severity = jsonSeverResponse ? jsonSeverResponse.globalSeverity : null; var severity = jsonSeverResponse ? jsonSeverResponse.globalSeverity : null;
@ -136,18 +136,18 @@ mindplot.RESTPersistenceManager = new Class({
if (!severity) { if (!severity) {
severity = "INFO"; severity = "INFO";
} }
return {severity:severity, message:message}; return {severity: severity, message: message};
}, },
loadMapDom:function (mapId) { loadMapDom: function (mapId) {
// Let's try to open one from the local directory ... // Let's try to open one from the local directory ...
var xml; var xml;
$.ajax({ $.ajax({
url:this.documentUrl.replace("{id}", mapId) + "/xml", url: this.documentUrl.replace("{id}", mapId) + "/xml",
method:'get', method: 'get',
async:false, async: false,
headers:{"Content-Type":"text/plain","Accept":"application/xml"}, headers: {"Content-Type": "text/plain", "Accept": "application/xml"},
success:function (responseText) { success: function (responseText) {
xml = responseText; xml = responseText;
} }
}); });

View File

@ -17,47 +17,47 @@
*/ */
mindplot.ScreenManager = new Class({ mindplot.ScreenManager = new Class({
initialize:function(divElement) { initialize: function (divElement) {
$assert(divElement, "can not be null"); $assert(divElement, "can not be null");
this._divContainer = divElement; this._divContainer = divElement;
this._padding = {x:0,y:0}; this._padding = {x: 0, y: 0};
// Ignore default click event propagation. Prevent 'click' event on drag. // Ignore default click event propagation. Prevent 'click' event on drag.
this._clickEvents = []; this._clickEvents = [];
this._divContainer.bind('click', function(event) { this._divContainer.bind('click', function (event) {
event.stopPropagation() event.stopPropagation()
}); });
this._divContainer.bind('dblclick', function(event) { this._divContainer.bind('dblclick', function (event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
}); });
}, },
setScale : function(scale) { setScale: function (scale) {
$assert(scale, 'Screen scale can not be null'); $assert(scale, 'Screen scale can not be null');
this._scale = scale; this._scale = scale;
}, },
addEvent : function(event, listener) { addEvent: function (event, listener) {
if (event == 'click') if (event == 'click')
this._clickEvents.push(listener); this._clickEvents.push(listener);
else else
this._divContainer.bind(event, listener); this._divContainer.bind(event, listener);
}, },
removeEvent : function(event, listener) { removeEvent: function (event, listener) {
if (event == 'click') { if (event == 'click') {
this._clickEvents.remove(listener); this._clickEvents.remove(listener);
} }
else{ else {
this._divContainer.unbind(event, listener); this._divContainer.unbind(event, listener);
} }
}, },
fireEvent : function(type, event) { fireEvent: function (type, event) {
if (type == 'click') { if (type == 'click') {
_.each(this._clickEvents, function(listener) { _.each(this._clickEvents, function (listener) {
listener(type, event); listener(type, event);
}); });
} }
@ -66,7 +66,7 @@ mindplot.ScreenManager = new Class({
} }
}, },
_getElementPosition : function(elem) { _getElementPosition: function (elem) {
// Retrieve current element position. // Retrieve current element position.
var elementPosition = elem.getPosition(); var elementPosition = elem.getPosition();
var x = elementPosition.x; var x = elementPosition.x;
@ -81,10 +81,10 @@ mindplot.ScreenManager = new Class({
y = y / this._scale; y = y / this._scale;
// Remove decimal part.. // Remove decimal part..
return {x:x,y:y}; return {x: x, y: y};
}, },
getWorkspaceIconPosition : function(e) { getWorkspaceIconPosition: function (e) {
// Retrieve current icon position. // Retrieve current icon position.
var image = e.getImage(); var image = e.getImage();
var elementPosition = image.getPosition(); var elementPosition = image.getPosition();
@ -97,7 +97,7 @@ mindplot.ScreenManager = new Class({
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;
@ -113,18 +113,18 @@ mindplot.ScreenManager = new Class({
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};
}, },
getWorkspaceMousePosition : function(event) { getWorkspaceMousePosition: function (event) {
// Retrieve current mouse position. // Retrieve current mouse position.
var x = event.clientX; var x = event.clientX;
var y = event.clientY; var y = event.clientY;
//FIXME: paulo: why? Subtract div position. //FIXME: paulo: why? Subtract div position.
/*var containerPosition = this.getContainer().position(); /*var containerPosition = this.getContainer().position();
x = x - containerPosition.x; x = x - containerPosition.x;
y = y - containerPosition.y;*/ y = y - containerPosition.y;*/
// Scale coordinate in order to be relative to the workspace. That's coordSize/size; // Scale coordinate in order to be relative to the workspace. That's coordSize/size;
x = x * this._scale; x = x * this._scale;
@ -138,11 +138,11 @@ mindplot.ScreenManager = new Class({
return new core.Point(x, y); return new core.Point(x, y);
}, },
getContainer : function() { getContainer: function () {
return this._divContainer; return this._divContainer;
}, },
setOffset : function(x, y) { setOffset: function (x, y) {
this._padding.x = x; this._padding.x = x;
this._padding.y = y; this._padding.y = y;
} }

View File

@ -17,14 +17,14 @@
*/ */
mindplot.ShirinkConnector = new Class({ mindplot.ShirinkConnector = new Class({
initialize: function(topic) { initialize: function (topic) {
var ellipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES); var ellipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES);
this._ellipse = ellipse; this._ellipse = ellipse;
ellipse.setFill('rgb(62,118,179)'); ellipse.setFill('rgb(62,118,179)');
ellipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH); ellipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
ellipse.addEvent('click', function(event) { ellipse.addEvent('click', function (event) {
var model = topic.getModel(); var model = topic.getModel();
var collapse = !model.areChildrenShrunken(); var collapse = !model.areChildrenShrunken();
@ -36,22 +36,22 @@ mindplot.ShirinkConnector = new Class({
}); });
ellipse.addEvent('mousedown', function(event) { ellipse.addEvent('mousedown', function (event) {
// Avoid node creation ... // Avoid node creation ...
event.stopPropagation(); event.stopPropagation();
}); });
ellipse.addEvent('dblclick', function(event) { ellipse.addEvent('dblclick', function (event) {
// Avoid node creation ... // Avoid node creation ...
event.stopPropagation(); event.stopPropagation();
}); });
ellipse.addEvent('mouseover', function(event) { ellipse.addEvent('mouseover', function (event) {
ellipse.setFill('rgb(153, 0, 255)'); ellipse.setFill('rgb(153, 0, 255)');
}); });
var me = this; var me = this;
ellipse.addEvent('mouseout', function(event) { ellipse.addEvent('mouseout', function (event) {
var color = topic.getBackgroundColor(); var color = topic.getBackgroundColor();
me.setFill(color); me.setFill(color);
}); });
@ -63,7 +63,7 @@ mindplot.ShirinkConnector = new Class({
}, },
changeRender: function(isShrink) { changeRender: function (isShrink) {
var elipse = this._ellipse; var elipse = this._ellipse;
if (isShrink) { if (isShrink) {
elipse.setStroke('2', 'solid'); elipse.setStroke('2', 'solid');
@ -72,36 +72,36 @@ mindplot.ShirinkConnector = new Class({
} }
}, },
setVisibility: function(value) { setVisibility: function (value) {
this._ellipse.setVisibility(value); this._ellipse.setVisibility(value);
}, },
setOpacity: function(opacity) { setOpacity: function (opacity) {
this._ellipse.setOpacity(opacity); this._ellipse.setOpacity(opacity);
}, },
setFill: function(color) { setFill: function (color) {
this._fillColor = color; this._fillColor = color;
this._ellipse.setFill(color); this._ellipse.setFill(color);
}, },
setAttribute: function(name, value) { setAttribute: function (name, value) {
this._ellipse.setAttribute(name, value); this._ellipse.setAttribute(name, value);
}, },
addToWorkspace: function(group) { addToWorkspace: function (group) {
group.append(this._ellipse); group.append(this._ellipse);
}, },
setPosition: function(x, y) { setPosition: function (x, y) {
this._ellipse.setPosition(x, y); this._ellipse.setPosition(x, y);
}, },
moveToBack: function() { moveToBack: function () {
this._ellipse.moveToBack(); this._ellipse.moveToBack();
}, },
moveToFront: function() { moveToFront: function () {
this._ellipse.moveToFront(); this._ellipse.moveToFront();
} }
}); });

View File

@ -18,38 +18,41 @@
//FIXME: Not used! //FIXME: Not used!
mindplot.TextEditor = new Class({ mindplot.TextEditor = new Class({
initialize:function(topic) { initialize: function (topic) {
this._topic = topic; this._topic = topic;
}, },
_buildEditor : function() { _buildEditor: function () {
this._size = {width:500, height:100}; this._size = {width: 500, height: 100};
var result = new Element('div'); var result = new Element('div');
result.setStyles({ result.setStyles({
position:"absolute", position: "absolute",
display: "none", display: "none",
zIndex: "8", zIndex: "8",
width:"500px", width: "500px",
height:"100px"} height: "100px"
}
); );
var inputContainer = new Element('div'); var inputContainer = new Element('div');
inputContainer.setStyles({ inputContainer.setStyles({
border:"none", border: "none",
overflow:"auto" overflow: "auto"
}); });
inputContainer.inject(result); inputContainer.inject(result);
var inputText = new Element('input', var inputText = new Element('input',
{type:"text", {
tabindex:'-1', type: "text",
value:""} tabindex: '-1',
value: ""
}
); );
inputText.setStyles({ inputText.setStyles({
border:"none", border: "none",
background:"transparent" background: "transparent"
}); });
inputText.inject(inputContainer); inputText.inject(inputContainer);
@ -57,7 +60,7 @@ mindplot.TextEditor = new Class({
spanContainer.setStyle('visibility', "hidden"); spanContainer.setStyle('visibility', "hidden");
spanContainer.inject(result); spanContainer.inject(result);
var spanElem = new Element('span', {tabindex:"-1"}); var spanElem = new Element('span', {tabindex: "-1"});
spanElem.setStyle('white-space', "nowrap"); spanElem.setStyle('white-space', "nowrap");
spanElem.setStyle('nowrap', 'nowrap'); spanElem.setStyle('nowrap', 'nowrap');
spanElem.inject(spanContainer); spanElem.inject(spanContainer);
@ -66,7 +69,7 @@ mindplot.TextEditor = new Class({
return result; return result;
}, },
_registerEvents : function(divElem) { _registerEvents: function (divElem) {
var inputElem = this._getTextareaElem(); var inputElem = this._getTextareaElem();
var spanElem = this._getSpanElem(); var spanElem = this._getSpanElem();
var me = this; var me = this;
@ -92,22 +95,22 @@ mindplot.TextEditor = new Class({
}); });
// If the user clicks on the input, all event must be ignored ... // If the user clicks on the input, all event must be ignored ...
divElem.addEvent('click', function(event) { divElem.addEvent('click', function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
divElem.addEvent('dblclick', function(event) { divElem.addEvent('dblclick', function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
divElem.addEvent('mousedown', function(event) { divElem.addEvent('mousedown', function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
}, },
isVisible : function () { isVisible: function () {
return $defined(this._containerElem) && this._containerElem.getStyle('display') == 'block'; return $defined(this._containerElem) && this._containerElem.getStyle('display') == 'block';
}, },
_updateModel : function () { _updateModel: function () {
if (this._topic.getText() != this._getText()) { if (this._topic.getText() != this._getText()) {
var text = this._getText(); var text = this._getText();
@ -118,7 +121,7 @@ mindplot.TextEditor = new Class({
} }
}, },
show : function (text) { show: function (text) {
if (!this.isVisible()) { if (!this.isVisible()) {
//Create editor ui //Create editor ui
@ -131,7 +134,7 @@ mindplot.TextEditor = new Class({
} }
}, },
_showEditor : function (defaultText) { _showEditor: function (defaultText) {
var topic = this._topic; var topic = this._topic;
@ -151,7 +154,7 @@ mindplot.TextEditor = new Class({
var me = this; var me = this;
// Set editor's initial size // Set editor's initial size
var displayFunc = function() { var displayFunc = function () {
// Position the editor and set the size... // Position the editor and set the size...
var textShape = me._topic.getTextShape(); var textShape = me._topic.getTextShape();
@ -171,7 +174,7 @@ mindplot.TextEditor = new Class({
displayFunc.delay(10); displayFunc.delay(10);
}, },
_setStyle : function (fontStyle) { _setStyle: function (fontStyle) {
var inputField = this._getTextareaElem(); var inputField = this._getTextareaElem();
var spanField = this._getSpanElem(); var spanField = this._getSpanElem();
if (!$defined(fontStyle.font)) { if (!$defined(fontStyle.font)) {
@ -197,7 +200,7 @@ mindplot.TextEditor = new Class({
spanField.style.fontSize = fontStyle.size + "px"; spanField.style.fontSize = fontStyle.size + "px";
}, },
_setText : function(text) { _setText: function (text) {
var inputField = this._getTextareaElem(); var inputField = this._getTextareaElem();
inputField.size = text.length + 1; inputField.size = text.length + 1;
this._containerElem.style.width = (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px"; this._containerElem.style.width = (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px";
@ -206,27 +209,27 @@ mindplot.TextEditor = new Class({
inputField.value = text; inputField.value = text;
}, },
_getText : function() { _getText: function () {
return this._getTextareaElem().value; return this._getTextareaElem().value;
}, },
_getTextareaElem : function() { _getTextareaElem: function () {
return this._containerElem.getElement('input'); return this._containerElem.getElement('input');
}, },
_getSpanElem : function() { _getSpanElem: function () {
return this._containerElem.getElement('span'); return this._containerElem.getElement('span');
}, },
_setEditorSize : function (width, height) { _setEditorSize: function (width, height) {
var textShape = this._topic.getTextShape(); var textShape = this._topic.getTextShape();
var scale = web2d.peer.utils.TransformUtil.workoutScale(textShape._peer); var scale = web2d.peer.utils.TransformUtil.workoutScale(textShape._peer);
this._size = {width:width * scale.width, height:height * scale.height}; this._size = {width: width * scale.width, height: height * scale.height};
this._containerElem.style.width = this._size.width * 2 + "px"; this._containerElem.style.width = this._size.width * 2 + "px";
this._containerElem.style.height = this._size.height + "px"; this._containerElem.style.height = this._size.height + "px";
}, },
_positionCursor : function(inputElem, selectText) { _positionCursor: function (inputElem, selectText) {
// Select text if it's required ... // Select text if it's required ...
if (inputElem.createTextRange) //ie if (inputElem.createTextRange) //ie
{ {
@ -246,7 +249,7 @@ mindplot.TextEditor = new Class({
} }
}, },
close : function(update) { close: function (update) {
if (this.isVisible()) { if (this.isVisible()) {
// Update changes ... // Update changes ...
if (!$defined(update) || update) { if (!$defined(update) || update) {

View File

@ -17,7 +17,7 @@
*/ */
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;

View File

@ -21,33 +21,33 @@ mindplot.TopicEventDispatcher = new Class({
Static: { Static: {
_instance: null, _instance: null,
configure: function(readOnly) { configure: function (readOnly) {
this._instance = new mindplot.TopicEventDispatcher(readOnly); this._instance = new mindplot.TopicEventDispatcher(readOnly);
}, },
getInstance : function() { getInstance: function () {
return this._instance; return this._instance;
} }
}, },
initialize:function(readOnly) { initialize: function (readOnly) {
this._readOnly = readOnly; this._readOnly = readOnly;
this._activeEditor = null; this._activeEditor = null;
this._multilineEditor = new mindplot.MultilineTextEditor(); this._multilineEditor = new mindplot.MultilineTextEditor();
}, },
close : function(update) { close: function (update) {
if (this.isVisible()) { if (this.isVisible()) {
this._activeEditor.close(update); this._activeEditor.close(update);
this._activeEditor = null; this._activeEditor = null;
} }
}, },
show : function(topic, options) { show: function (topic, options) {
this.process(mindplot.TopicEvent.EDIT, topic, options); this.process(mindplot.TopicEvent.EDIT, topic, options);
}, },
process : function(eventType, topic, options) { process: function (eventType, topic, options) {
$assert(eventType, "eventType can not be null"); $assert(eventType, "eventType can not be null");
// Close all previous open editor .... // Close all previous open editor ....
@ -61,18 +61,18 @@ mindplot.TopicEventDispatcher = new Class({
this._multilineEditor.show(topic, options ? options.text : null); this._multilineEditor.show(topic, options ? options.text : null);
this._activeEditor = this._multilineEditor; this._activeEditor = this._multilineEditor;
} else { } else {
this.fireEvent(eventType, {model:model,readOnly:this._readOnly}); this.fireEvent(eventType, {model: model, readOnly: this._readOnly});
} }
}, },
isVisible: function() { isVisible: function () {
return this._activeEditor != null && this._activeEditor.isVisible(); return this._activeEditor != null && this._activeEditor.isVisible();
} }
}); });
mindplot.TopicEvent = { mindplot.TopicEvent = {
EDIT : "editnode", EDIT: "editnode",
CLICK : "clicknode" CLICK: "clicknode"
}; };

View File

@ -19,31 +19,31 @@
/** */ /** */
mindplot.TopicFeature = { mindplot.TopicFeature = {
/** the icon object */ /** the icon object */
Icon:{ Icon: {
id:mindplot.model.IconModel.FEATURE_TYPE, id: mindplot.model.IconModel.FEATURE_TYPE,
model:mindplot.model.IconModel, model: mindplot.model.IconModel,
icon:mindplot.ImageIcon icon: mindplot.ImageIcon
}, },
/** the link object */ /** the link object */
Link:{ Link: {
id:mindplot.model.LinkModel.FEATURE_TYPE, id: mindplot.model.LinkModel.FEATURE_TYPE,
model:mindplot.model.LinkModel, model: mindplot.model.LinkModel,
icon:mindplot.LinkIcon icon: mindplot.LinkIcon
}, },
/** the note object */ /** the note object */
Note:{ Note: {
id:mindplot.model.NoteModel.FEATURE_TYPE, id: mindplot.model.NoteModel.FEATURE_TYPE,
model:mindplot.model.NoteModel, model: mindplot.model.NoteModel,
icon:mindplot.NoteIcon icon: mindplot.NoteIcon
}, },
/** /**
* @param id the feature metadata id * @param id the feature metadata id
* @return {Boolean} returns true if the given id is contained in the metadata array * @return {Boolean} returns true if the given id is contained in the metadata array
*/ */
isSupported:function (id) { isSupported: function (id) {
return mindplot.TopicFeature._featuresMetadataById.some(function (elem) { return mindplot.TopicFeature._featuresMetadataById.some(function (elem) {
return elem.id == id; return elem.id == id;
}); });
@ -54,10 +54,10 @@ mindplot.TopicFeature = {
* @param attributes * @param attributes
* @throws will throw an error if type is null or undefined * @throws will throw an error if type is null or undefined
* @throws will throw an error if attributes is null or undefined * @throws will throw an error if attributes is null or undefined
* @return {mindplot.model.FeatureModel} a new instance of the feature model subclass matching * @return {mindplot.model.FeatureModel} a new instance of the feature model subclass matching
* the topic feature * the topic feature
*/ */
createModel:function (type, attributes) { createModel: function (type, attributes) {
$assert(type, 'type can not be null'); $assert(type, 'type can not be null');
$assert(attributes, 'attributes can not be null'); $assert(attributes, 'attributes can not be null');
@ -75,7 +75,7 @@ mindplot.TopicFeature = {
* @throws will throw an error if model is null or undefined * @throws will throw an error if model is null or undefined
* @return {mindplot.Icon} a new instance of the icon subclass matching the topic feature * @return {mindplot.Icon} a new instance of the icon subclass matching the topic feature
*/ */
createIcon:function (topic, model, readOnly) { createIcon: function (topic, model, readOnly) {
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
$assert(model, 'model can not be null'); $assert(model, 'model can not be null');

View File

@ -16,8 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.TopicStyle = new Class({ mindplot.TopicStyle = new Class({
Static:{ Static: {
_getStyles:function (topic) { _getStyles: function (topic) {
$assert(topic, "topic can not be null"); $assert(topic, "topic can not be null");
var result; var result;
@ -38,28 +38,28 @@ mindplot.TopicStyle = new Class({
return result; return result;
}, },
defaultText:function (topic) { defaultText: function (topic) {
var msgKey = this._getStyles(topic).msgKey; var msgKey = this._getStyles(topic).msgKey;
return $msg(msgKey); return $msg(msgKey);
}, },
defaultFontStyle:function (topic) { defaultFontStyle: function (topic) {
return this._getStyles(topic).fontStyle; return this._getStyles(topic).fontStyle;
}, },
defaultBackgroundColor:function (topic) { defaultBackgroundColor: function (topic) {
return this._getStyles(topic).backgroundColor; return this._getStyles(topic).backgroundColor;
}, },
defaultBorderColor:function (topic) { defaultBorderColor: function (topic) {
return this._getStyles(topic).borderColor; return this._getStyles(topic).borderColor;
}, },
getInnerPadding:function (topic) { getInnerPadding: function (topic) {
return this._getStyles(topic).innerPadding; return this._getStyles(topic).innerPadding;
}, },
defaultShapeType:function (topic) { defaultShapeType: function (topic) {
return this._getStyles(topic).shapeType; return this._getStyles(topic).shapeType;
} }
@ -68,65 +68,65 @@ mindplot.TopicStyle = new Class({
mindplot.TopicStyle.STYLES = mindplot.TopicStyle.STYLES =
{ {
CENTRAL_TOPIC:{ CENTRAL_TOPIC: {
borderColor:'rgb(57,113,177)', borderColor: 'rgb(57,113,177)',
backgroundColor:'rgb(80,157,192)', backgroundColor: 'rgb(80,157,192)',
fontStyle:{ fontStyle: {
font:"Verdana", font: "Verdana",
size:10, size: 10,
style:"normal", style: "normal",
weight:"bold", weight: "bold",
color:"#ffffff" color: "#ffffff"
}, },
msgKey:'CENTRAL_TOPIC', msgKey: 'CENTRAL_TOPIC',
innerPadding:11, innerPadding: 11,
shapeType:mindplot.model.TopicShape.ROUNDED_RECT shapeType: mindplot.model.TopicShape.ROUNDED_RECT
}, },
MAIN_TOPIC:{ MAIN_TOPIC: {
borderColor:'rgb(2,59,185)', borderColor: 'rgb(2,59,185)',
backgroundColor:'rgb(224,229,239)', backgroundColor: 'rgb(224,229,239)',
fontStyle:{ fontStyle: {
font:"Arial", font: "Arial",
size:8, size: 8,
style:"normal", style: "normal",
weight:"normal", weight: "normal",
color:"rgb(82,92,97)" color: "rgb(82,92,97)"
}, },
msgKey:'MAIN_TOPIC', msgKey: 'MAIN_TOPIC',
innerPadding:3, innerPadding: 3,
shapeType:mindplot.model.TopicShape.LINE shapeType: mindplot.model.TopicShape.LINE
}, },
SUB_TOPIC:{ SUB_TOPIC: {
borderColor:'rgb(2,59,185)', borderColor: 'rgb(2,59,185)',
backgroundColor:'rgb(224,229,239)', backgroundColor: 'rgb(224,229,239)',
fontStyle:{ fontStyle: {
font:"Arial", font: "Arial",
size:6, size: 6,
style:"normal", style: "normal",
weight:"normal", weight: "normal",
color:"rgb(82,92,97)" color: "rgb(82,92,97)"
}, },
msgKey:'SUB_TOPIC', msgKey: 'SUB_TOPIC',
innerPadding:3, innerPadding: 3,
shapeType:mindplot.model.TopicShape.LINE shapeType: mindplot.model.TopicShape.LINE
}, },
ISOLATED_TOPIC:{ ISOLATED_TOPIC: {
borderColor:'rgb(2,59,185)', borderColor: 'rgb(2,59,185)',
backgroundColor:'rgb(224,229,239)', backgroundColor: 'rgb(224,229,239)',
fontStyle:{ fontStyle: {
font:"Verdana", font: "Verdana",
size:8, size: 8,
style:"normal", style: "normal",
weight:"normal", weight: "normal",
color:"rgb(82,92,97)" color: "rgb(82,92,97)"
}, },
msgKey:'ISOLATED_TOPIC', msgKey: 'ISOLATED_TOPIC',
innerPadding:4, innerPadding: 4,
shapeType:mindplot.model.TopicShape.LINE shapeType: mindplot.model.TopicShape.LINE
} }
}; };

View File

@ -17,7 +17,7 @@
*/ */
mindplot.Workspace = new Class({ mindplot.Workspace = new Class({
initialize: function(screenManager, zoom) { initialize: function (screenManager, zoom) {
// Create a suitable container ... // Create a suitable container ...
$assert(screenManager, 'Div container can not be null'); $assert(screenManager, 'Div container can not be null');
$assert(zoom, 'zoom container can not be null'); $assert(zoom, 'zoom container can not be null');
@ -42,7 +42,7 @@ mindplot.Workspace = new Class({
this._eventsEnabled = true; this._eventsEnabled = true;
}, },
_createWorkspace: function() { _createWorkspace: function () {
// Initialize workspace ... // Initialize workspace ...
var coordOriginX = -(this._screenWidth / 2); var coordOriginX = -(this._screenWidth / 2);
var coordOriginY = -(this._screenHeight / 2); var coordOriginY = -(this._screenHeight / 2);
@ -50,18 +50,18 @@ mindplot.Workspace = new Class({
var workspaceProfile = { var workspaceProfile = {
width: this._screenWidth + "px", width: this._screenWidth + "px",
height: this._screenHeight + "px", height: this._screenHeight + "px",
coordSizeWidth:this._screenWidth, coordSizeWidth: this._screenWidth,
coordSizeHeight:this._screenHeight, coordSizeHeight: this._screenHeight,
coordOriginX:coordOriginX, coordOriginX: coordOriginX,
coordOriginY:coordOriginY, coordOriginY: coordOriginY,
fillColor:'transparent', fillColor: 'transparent',
strokeWidth:0 strokeWidth: 0
}; };
web2d.peer.Toolkit.init(); web2d.peer.Toolkit.init();
return new web2d.Workspace(workspaceProfile); return new web2d.Workspace(workspaceProfile);
}, },
append: function(shape) { append: function (shape) {
if ($defined(shape.addToWorkspace)) { if ($defined(shape.addToWorkspace)) {
shape.addToWorkspace(this); shape.addToWorkspace(this);
} else { } else {
@ -69,7 +69,7 @@ mindplot.Workspace = new Class({
} }
}, },
removeChild: function(shape) { removeChild: function (shape) {
// Element is a node, not a web2d element? // Element is a node, not a web2d element?
if ($defined(shape.removeFromWorkspace)) { if ($defined(shape.removeFromWorkspace)) {
shape.removeFromWorkspace(this); shape.removeFromWorkspace(this);
@ -78,21 +78,21 @@ mindplot.Workspace = new Class({
} }
}, },
addEvent: function(type, listener) { addEvent: function (type, listener) {
this._workspace.addEvent(type, listener); this._workspace.addEvent(type, listener);
}, },
removeEvent: function(type, listener) { removeEvent: function (type, listener) {
$assert(type, 'type can not be null'); $assert(type, 'type can not be null');
$assert(listener, 'listener can not be null'); $assert(listener, 'listener can not be null');
this._workspace.removeEvent(type, listener); this._workspace.removeEvent(type, listener);
}, },
getSize: function() { getSize: function () {
return this._workspace.getCoordSize(); return this._workspace.getCoordSize();
}, },
setZoom: function(zoom, center) { setZoom: function (zoom, center) {
this._zoom = zoom; this._zoom = zoom;
var workspace = this._workspace; var workspace = this._workspace;
@ -135,27 +135,27 @@ mindplot.Workspace = new Class({
this._screenManager.fireEvent('update'); this._screenManager.fireEvent('update');
}, },
getScreenManager: function() { getScreenManager: function () {
return this._screenManager; return this._screenManager;
}, },
enableWorkspaceEvents: function(value) { enableWorkspaceEvents: function (value) {
this._eventsEnabled = value; this._eventsEnabled = value;
}, },
isWorkspaceEventsEnabled: function() { isWorkspaceEventsEnabled: function () {
return this._eventsEnabled; return this._eventsEnabled;
}, },
dumpNativeChart: function() { dumpNativeChart: function () {
return this._workspace.dumpNativeChart(); return this._workspace.dumpNativeChart();
}, },
_registerDragEvents: function() { _registerDragEvents: function () {
var workspace = this._workspace; var workspace = this._workspace;
var screenManager = this._screenManager; var screenManager = this._screenManager;
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);
@ -164,7 +164,7 @@ mindplot.Workspace = new Class({
var originalCoordOrigin = workspace.getCoordOrigin(); var originalCoordOrigin = workspace.getCoordOrigin();
var wasDragged = false; var wasDragged = false;
workspace._mouseMoveListener = function(event) { workspace._mouseMoveListener = function (event) {
var currentMousePosition = screenManager.getWorkspaceMousePosition(event); var currentMousePosition = screenManager.getWorkspaceMousePosition(event);
@ -193,7 +193,7 @@ mindplot.Workspace = new Class({
screenManager.addEvent('mousemove', workspace._mouseMoveListener); screenManager.addEvent('mousemove', workspace._mouseMoveListener);
// Register mouse up listeners ... // Register mouse up listeners ...
workspace._mouseUpListener = function(event) { workspace._mouseUpListener = function (event) {
screenManager.removeEvent('mousemove', workspace._mouseMoveListener); screenManager.removeEvent('mousemove', workspace._mouseMoveListener);
screenManager.removeEvent('mouseup', workspace._mouseUpListener); screenManager.removeEvent('mouseup', workspace._mouseUpListener);
@ -219,7 +219,7 @@ mindplot.Workspace = new Class({
screenManager.addEvent('mousedown', mouseDownListener); screenManager.addEvent('mousedown', mouseDownListener);
}, },
setViewPort : function(size) { setViewPort: function (size) {
this._viewPort = size; this._viewPort = size;
} }
}); });

View File

@ -30,7 +30,7 @@ mindplot.persistence = {};
mindplot.layout = {}; mindplot.layout = {};
Class.Mutators.Static = function(items){ Class.Mutators.Static = function (items) {
this.extend(items); this.extend(items);
}; };

View File

@ -17,27 +17,36 @@
*/ */
core.Point = new Class({ core.Point = new Class({
initialize : function(x, y) { /**
* @constructs
* @param {Number} x coordinate
* @param {Number} y coordinate
*/
initialize: function (x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
}, },
setValue : function(x, y) { /**
* @param {Number} x coordinate
* @param {Number} y coordinate
*/
setValue: function (x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;
}, },
inspect : function() { inspect: function () {
return "{x:" + this.x + ",y:" + this.y + "}"; return "{x:" + this.x + ",y:" + this.y + "}";
}, },
clone : function() { clone: function () {
return new core.Point(this.x, this.y); return new core.Point(this.x, this.y);
} }
}); });
core.Point.fromString = function(point) { core.Point.fromString = function (point) {
var values = point.split(','); var values = point.split(',');
return new core.Point(values[0], values[1]); return new core.Point(values[0], values[1]);

View File

@ -22,8 +22,10 @@ web2d.Workspace = new Class({
this._htmlContainer = this._createDivContainer(); this._htmlContainer = this._createDivContainer();
var peer = web2d.peer.Toolkit.createWorkspace(this._htmlContainer); var peer = web2d.peer.Toolkit.createWorkspace(this._htmlContainer);
var defaultAttributes = {width: '200px', height: '200px', stroke: '1px solid #edf1be', var defaultAttributes = {
fillColor: "white", coordOrigin: '0 0', coordSize: '200 200' }; width: '200px', height: '200px', stroke: '1px solid #edf1be',
fillColor: "white", coordOrigin: '0 0', coordSize: '200 200'
};
for (var key in attributes) { for (var key in attributes) {
defaultAttributes[key] = attributes[key]; defaultAttributes[key] = attributes[key];
} }
@ -34,6 +36,7 @@ web2d.Workspace = new Class({
getType: function () { getType: function () {
return "Workspace"; return "Workspace";
}, },
/** /**
* Appends an element as a child to the object. * Appends an element as a child to the object.
*/ */
@ -154,7 +157,7 @@ web2d.Workspace = new Class({
if (style != 'solid') { if (style != 'solid') {
throw 'Not supported style stroke style:' + style; throw 'Not supported style stroke style:' + style;
} }
this._htmlContainer.css('border',width + ' ' + style + ' ' + color); this._htmlContainer.css('border', width + ' ' + style + ' ' + color);
if (opacity || opacity === 0) { if (opacity || opacity === 0) {
throw "Unsupported operation. Opacity not supported."; throw "Unsupported operation. Opacity not supported.";