Bug Uncaught text can not be null fixed.

This commit is contained in:
Paulo Gustavo Veiga
2012-09-01 11:09:47 -03:00
parent c4f4756e4a
commit 7dfb044ae4
3 changed files with 267 additions and 27 deletions

View File

@@ -20,8 +20,8 @@ mindplot.model.NoteModel = new Class({
Extends:mindplot.model.FeatureModel,
initialize:function (attributes) {
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
if (attributes.text)
this.setText(attributes.text);
var noteText = attributes.text ? attributes.text : " ";
this.setText(noteText);
},
getText:function () {

View File

@@ -170,7 +170,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
},
_noteTextToXML:function (document, elem, text) {
if (text.indexOf('\n') == -1 && text.indexOf("&") == -1 && text.indexOf("<") == -1 && text.indexOf("\"") == -1) {
if (text.indexOf('\n') == -1) {
elem.setAttribute('text', text);
} else {
var textDom = document.createElement("text");
@@ -258,6 +258,31 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
var text = domElem.getAttribute('text');
if ($defined(text) && text) {
topic.setText(text);
var fontStyle = domElem.getAttribute('fontStyle');
if ($defined(fontStyle)) {
var font = fontStyle.split(';');
if (font[0]) {
topic.setFontFamily(font[0]);
}
if (font[1]) {
topic.setFontSize(font[1]);
}
if (font[2]) {
topic.setFontColor(font[2]);
}
if (font[3]) {
topic.setFontWeight(font[3]);
}
if (font[4]) {
topic.setFontStyle(font[4]);
}
}
}
var shape = domElem.getAttribute('shape');
@@ -275,30 +300,6 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
}
}
var fontStyle = domElem.getAttribute('fontStyle');
if ($defined(fontStyle)) {
var font = fontStyle.split(';');
if (font[0]) {
topic.setFontFamily(font[0]);
}
if (font[1]) {
topic.setFontSize(font[1]);
}
if (font[2]) {
topic.setFontColor(font[2]);
}
if (font[3]) {
topic.setFontWeight(font[3]);
}
if (font[4]) {
topic.setFontStyle(font[4]);
}
}
var bgColor = domElem.getAttribute('bgColor');
if ($defined(bgColor)) {