Topic editor can be configured based on the shape type.

This commit is contained in:
Paulo Gustavo Veiga 2012-03-07 23:51:37 -03:00
parent 8a4dee47f2
commit 7c10b00435
10 changed files with 149 additions and 58 deletions

View File

@ -51,7 +51,7 @@
<mkdir dir="${basedir}/target/classes"/>
<concat destfile="${basedir}/target/tmp/mindplot.js" append="false">
<filelist dir="${basedir}/src/main/javascript/" files="header.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TopicEditor.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/IMindmap.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/Mindmap.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/INodeModel.js"/>

View File

@ -61,6 +61,7 @@ mindplot.Designer = new Class({
// Set editor working area ...
this.setViewPort(options.viewPort);
mindplot.TopicEditor.configure();
},
_registerEvents : function() {

View File

@ -18,8 +18,8 @@
mindplot.MultilineTextEditor = new Class({
Extends: Events,
initialize:function(topic) {
this._topic = topic;
initialize:function() {
this._topic = null;
},
_buildEditor : function() {
@ -133,8 +133,9 @@ mindplot.MultilineTextEditor = new Class({
}
},
show : function (text) {
show : function (topic,text) {
this._topic = topic;
if (!this.isVisible()) {
//Create editor ui
var containerElem = this._buildEditor();
@ -260,6 +261,7 @@ mindplot.MultilineTextEditor = new Class({
// Remove it form the screen ...
this._containerElem.dispose();
this._containerElem = null;
this._topic = null;
}
}
});

View File

@ -21,8 +21,6 @@ mindplot.Topic = new Class({
Extends:mindplot.NodeGraph,
initialize : function(model, options) {
this.parent(model, options);
this._textEditor = new mindplot.MultilineTextEditor(this);
this._children = [];
this._parent = null;
this._relationships = [];
@ -51,19 +49,9 @@ mindplot.Topic = new Class({
});
this.addEvent('dblclick', function (event) {
this._textEditor.show();
this._getTopicEditor().show(this);
event.stopPropagation(true);
}.bind(this));
this._textEditor.addEvent('input', function() {
var textShape = this.getTextShape();
// var oldText = textShape.getText();
// this._setText(text, false);
// @Todo: I must resize, no change the position ...
// textShape.setText(oldText);
}.bind(this));
},
setShapeType : function(type) {
@ -664,7 +652,7 @@ mindplot.Topic = new Class({
},
showTextEditor : function(text) {
this._textEditor.show(text);
this._getTopicEditor().show(this, {text:text});
},
showNoteEditor : function() {
@ -740,9 +728,12 @@ mindplot.Topic = new Class({
editor.show();
},
closeEditors : function() {
this._textEditor.close(true);
this._getTopicEditor().close(true);
},
_getTopicEditor : function() {
return mindplot.TopicEditor.getInstance();
},
/**
@ -1123,7 +1114,7 @@ mindplot.Topic = new Class({
}
// If a drag node is create for it, let's hide the editor.
this._textEditor.close();
this._getTopicEditor().close();
return result;
},

View File

@ -18,8 +18,49 @@
mindplot.TopicEditor = new Class({
Extends: Events,
initialize:function(topic) {
this._topic = topic;
Static: {
_instance: null,
configure: function(options) {
this._instance = new mindplot.TopicEditor();
},
getInstance : function() {
return this._instance;
}
},
initialize:function() {
this._activeEditor = null;
this._multilineEditor = new mindplot.MultilineTextEditor();
},
close : function(update) {
if (this.isVisible()) {
this._activeEditor.close(update);
this._activeEditor = null;
}
},
show : function(topic, options) {
// Close all previous open editor ....
if (this.isVisible()) {
this.close();
}
// Open the new editor ...
var model = topic.getModel();
if (model.getShapeType() != mindplot.model.TopicShape.IMAGE) {
this._multilineEditor.show(topic, options ? options.text : null);
this._activeEditor = this._multilineEditor;
} else {
// To be implemented....
}
},
isVisible: function() {
return this._activeEditor != null && this._activeEditor.isVisible();
}
});

View File

@ -63,6 +63,6 @@ mindplot.TopicFeature = {
}
};
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note]
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note];

View File

@ -29,3 +29,8 @@ mindplot.collaboration.framework = {};
mindplot.persistence = {};
mindplot.layout = {};
Class.Mutators.Static = function(items){
this.extend(items);
};

View File

@ -22,7 +22,7 @@
<script type="text/javascript">
var mapId = 'welcome';
var mapId = 'welcome-reloaded';
$(document).addEvent('loadcomplete', function(resource) {
var options = loadDesignerOptions();
var designer = buildDesigner(options);
@ -33,7 +33,6 @@
designer.loadMap(mindmap);
});
</script>
</head>
<body>

View File

@ -30,6 +30,7 @@ function buildDesigner(options) {
window.waitDialog.destroy();
});
// Register error handlers ...
designer.addEvent('loadError', function(e) {
window.waitDialog.close();
window.waitDialog.destroy();
@ -37,7 +38,11 @@ function buildDesigner(options) {
console.log(e);
});
// window.onerror = function()
// {
// errorDialog.show();
// };
//
// Configure default persistence manager ...
var persistence;
if (options.persistenceManager) {
@ -209,8 +214,7 @@ editor.FatalErrorDialog = new Class({
}.bind(this));
this.overlay.close();
}}
)
;
);
this.setContent(panel);
},

View File

@ -0,0 +1,48 @@
<map name="welcome" version="tango">
<topic central="true" text="Welcome To WiseMapping" id="1" fontStyle=";;#dfcfe6;;;" bgColor="#0a0a08">
<topic position="178,-130" order="0" text="Try it Now!" id="11" fontStyle=";;#ffffff;;;" bgColor="#250be3"
brColor="#080559">
<topic position="272,-156" order="0" text="Double Click" id="12" fontStyle=";;#001be6;;italic;"/>
<topic position="274,-130" order="1" text=" INS to insert" id="13" fontStyle=";;#001be6;;italic;"/>
<topic position="285,-104" order="2" text="Drag map to move" id="14" fontStyle=";;#001be6;;italic;"/>
</topic>
<topic position="-189,-52" order="1" text="Productivity" id="2" fontStyle=";;#104f11;;;" bgColor="#d9b518">
<icon id="chart_bar"/>
<topic position="-310,-104" order="0" text="Share your ideas" id="3">
<icon id="bulb_light_on"/>
</topic>
<topic position="-299,-25" order="2" text="Brainstorming" id="4"/>
<topic position="-283,1" order="3" text="Visual " id="5"/>
<topic position="-307,-65" order="1" shape="image" image="80,43:images/logo-small.png" id="27"
metadata="{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&amp;feature=g-vrec&amp;context=G2b4ab69RVAAAAAAAAAA'}"/>
</topic>
<topic position="185,-39" order="2" text="Mind Mapping" id="6" fontStyle=";;#602378;;;" bgColor="#edabff">
<topic position="303,-78" order="0" text="Share with Collegues" id="7"/>
<topic position="275,-52" order="1" text="Online" id="8"/>
<topic position="299,-26" order="2" text="Anyplace, Anytime" id="9"/>
<topic position="277,0" order="3" text="Free!!!" id="10"/>
</topic>
<topic position="-183,66" order="3" text="Web 2.0 Tool" id="22" fontStyle=";;#0c1d6b;;;" bgColor="#add1f7">
<topic position="-281,27" order="0" text="Collaborate" id="23"/>
<topic position="-302,53" order="1" text="No plugin required" id="24">
<icon id="conn_disconnect"/>
</topic>
<topic position="-271,79" order="2" text="Share" id="25"/>
<topic position="-282,105" order="3" text="Easy to use" id="26"/>
</topic>
<topic position="171,91" order="4" text="Features" id="15">
<topic position="266,26" order="0" text="Links to Sites" id="16" fontStyle=";6;;;;">
<link url="http://www.digg.com" type="url"/>
</topic>
<topic position="245,52" order="1" text="Fonts" id="17"/>
<topic position="255,78" order="2" text="Topic Color" id="18"/>
<topic position="260,104" order="3" text="Topic Shapes" shape="line" id="19"/>
<topic position="252,130" order="4" text="Icons" id="20">
<icon id="object_rainbow"/>
</topic>
<topic position="272,156" order="5" text="History Changes" id="21">
<icon id="arrowc_turn_left"/>
</topic>
</topic>
</topic>
</map>