mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2025-01-03 16:53:49 +01:00
Topic editor can be configured based on the shape type.
This commit is contained in:
parent
8a4dee47f2
commit
7c10b00435
@ -51,7 +51,7 @@
|
|||||||
<mkdir dir="${basedir}/target/classes"/>
|
<mkdir dir="${basedir}/target/classes"/>
|
||||||
<concat destfile="${basedir}/target/tmp/mindplot.js" append="false">
|
<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="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/IMindmap.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="model/Mindmap.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="model/Mindmap.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="model/INodeModel.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="model/INodeModel.js"/>
|
||||||
|
@ -61,6 +61,7 @@ mindplot.Designer = new Class({
|
|||||||
// Set editor working area ...
|
// Set editor working area ...
|
||||||
this.setViewPort(options.viewPort);
|
this.setViewPort(options.viewPort);
|
||||||
|
|
||||||
|
mindplot.TopicEditor.configure();
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerEvents : function() {
|
_registerEvents : function() {
|
||||||
@ -448,42 +449,42 @@ mindplot.Designer = new Class({
|
|||||||
this._mindmap = mindmapModel;
|
this._mindmap = mindmapModel;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Init layout manager ...
|
// Init layout manager ...
|
||||||
var size = {width:25,height:25};
|
var size = {width:25,height:25};
|
||||||
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
||||||
layoutManager.addEvent('change', function(event) {
|
layoutManager.addEvent('change', function(event) {
|
||||||
var id = event.getId();
|
var id = event.getId();
|
||||||
var topic = this.getModel().findTopicById(id);
|
var topic = this.getModel().findTopicById(id);
|
||||||
topic.setPosition(event.getPosition());
|
topic.setPosition(event.getPosition());
|
||||||
topic.setOrder(event.getOrder());
|
topic.setOrder(event.getOrder());
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
|
|
||||||
// Building node graph ...
|
// Building node graph ...
|
||||||
var branches = mindmapModel.getBranches();
|
var branches = mindmapModel.getBranches();
|
||||||
for (var i = 0; i < branches.length; i++) {
|
for (var i = 0; i < branches.length; i++) {
|
||||||
// NodeModel -> NodeGraph ...
|
// NodeModel -> NodeGraph ...
|
||||||
var nodeModel = branches[i];
|
var nodeModel = branches[i];
|
||||||
var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false);
|
var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false);
|
||||||
|
|
||||||
// Update shrink render state...
|
// Update shrink render state...
|
||||||
nodeGraph.setBranchVisibility(true);
|
nodeGraph.setBranchVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var relationships = mindmapModel.getRelationships();
|
var relationships = mindmapModel.getRelationships();
|
||||||
for (var j = 0; j < relationships.length; j++) {
|
for (var j = 0; j < relationships.length; j++) {
|
||||||
this._relationshipModelToRelationship(relationships[j]);
|
this._relationshipModelToRelationship(relationships[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place the focus on the Central Topic
|
// Place the focus on the Central Topic
|
||||||
var centralTopic = this.getModel().getCentralTopic();
|
var centralTopic = this.getModel().getCentralTopic();
|
||||||
this.goToNode(centralTopic);
|
this.goToNode(centralTopic);
|
||||||
|
|
||||||
// Finally, sort the map ...
|
// Finally, sort the map ...
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
||||||
|
|
||||||
this.fireEvent('loadSuccess');
|
this.fireEvent('loadSuccess');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
this.fireEvent('loadError', e);
|
this.fireEvent('loadError', e);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
mindplot.MultilineTextEditor = new Class({
|
mindplot.MultilineTextEditor = new Class({
|
||||||
Extends: Events,
|
Extends: Events,
|
||||||
initialize:function(topic) {
|
initialize:function() {
|
||||||
this._topic = topic;
|
this._topic = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildEditor : function() {
|
_buildEditor : function() {
|
||||||
@ -133,8 +133,9 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show : function (text) {
|
show : function (topic,text) {
|
||||||
|
|
||||||
|
this._topic = topic;
|
||||||
if (!this.isVisible()) {
|
if (!this.isVisible()) {
|
||||||
//Create editor ui
|
//Create editor ui
|
||||||
var containerElem = this._buildEditor();
|
var containerElem = this._buildEditor();
|
||||||
@ -260,6 +261,7 @@ mindplot.MultilineTextEditor = new Class({
|
|||||||
// Remove it form the screen ...
|
// Remove it form the screen ...
|
||||||
this._containerElem.dispose();
|
this._containerElem.dispose();
|
||||||
this._containerElem = null;
|
this._containerElem = null;
|
||||||
|
this._topic = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,8 +21,6 @@ mindplot.Topic = new Class({
|
|||||||
Extends:mindplot.NodeGraph,
|
Extends:mindplot.NodeGraph,
|
||||||
initialize : function(model, options) {
|
initialize : function(model, options) {
|
||||||
this.parent(model, options);
|
this.parent(model, options);
|
||||||
this._textEditor = new mindplot.MultilineTextEditor(this);
|
|
||||||
|
|
||||||
this._children = [];
|
this._children = [];
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
this._relationships = [];
|
this._relationships = [];
|
||||||
@ -51,19 +49,9 @@ mindplot.Topic = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.addEvent('dblclick', function (event) {
|
this.addEvent('dblclick', function (event) {
|
||||||
this._textEditor.show();
|
this._getTopicEditor().show(this);
|
||||||
event.stopPropagation(true);
|
event.stopPropagation(true);
|
||||||
}.bind(this));
|
}.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) {
|
setShapeType : function(type) {
|
||||||
@ -664,7 +652,7 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
showTextEditor : function(text) {
|
showTextEditor : function(text) {
|
||||||
this._textEditor.show(text);
|
this._getTopicEditor().show(this, {text:text});
|
||||||
},
|
},
|
||||||
|
|
||||||
showNoteEditor : function() {
|
showNoteEditor : function() {
|
||||||
@ -740,9 +728,12 @@ mindplot.Topic = new Class({
|
|||||||
editor.show();
|
editor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
closeEditors : function() {
|
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.
|
// If a drag node is create for it, let's hide the editor.
|
||||||
this._textEditor.close();
|
this._getTopicEditor().close();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
@ -18,8 +18,49 @@
|
|||||||
|
|
||||||
mindplot.TopicEditor = new Class({
|
mindplot.TopicEditor = new Class({
|
||||||
Extends: Events,
|
Extends: Events,
|
||||||
initialize:function(topic) {
|
Static: {
|
||||||
this._topic = topic;
|
_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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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];
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,3 +29,8 @@ mindplot.collaboration.framework = {};
|
|||||||
mindplot.persistence = {};
|
mindplot.persistence = {};
|
||||||
|
|
||||||
mindplot.layout = {};
|
mindplot.layout = {};
|
||||||
|
|
||||||
|
Class.Mutators.Static = function(items){
|
||||||
|
this.extend(items);
|
||||||
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var mapId = 'welcome';
|
var mapId = 'welcome-reloaded';
|
||||||
$(document).addEvent('loadcomplete', function(resource) {
|
$(document).addEvent('loadcomplete', function(resource) {
|
||||||
var options = loadDesignerOptions();
|
var options = loadDesignerOptions();
|
||||||
var designer = buildDesigner(options);
|
var designer = buildDesigner(options);
|
||||||
@ -33,7 +33,6 @@
|
|||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -30,6 +30,7 @@ function buildDesigner(options) {
|
|||||||
window.waitDialog.destroy();
|
window.waitDialog.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Register error handlers ...
|
||||||
designer.addEvent('loadError', function(e) {
|
designer.addEvent('loadError', function(e) {
|
||||||
window.waitDialog.close();
|
window.waitDialog.close();
|
||||||
window.waitDialog.destroy();
|
window.waitDialog.destroy();
|
||||||
@ -37,7 +38,11 @@ function buildDesigner(options) {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// window.onerror = function()
|
||||||
|
// {
|
||||||
|
// errorDialog.show();
|
||||||
|
// };
|
||||||
|
//
|
||||||
// Configure default persistence manager ...
|
// Configure default persistence manager ...
|
||||||
var persistence;
|
var persistence;
|
||||||
if (options.persistenceManager) {
|
if (options.persistenceManager) {
|
||||||
@ -209,8 +214,7 @@ editor.FatalErrorDialog = new Class({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
this.overlay.close();
|
this.overlay.close();
|
||||||
}}
|
}}
|
||||||
)
|
);
|
||||||
;
|
|
||||||
this.setContent(panel);
|
this.setContent(panel);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
48
wise-editor/src/main/webapp/samples/welcome-reloaded.xml
Normal file
48
wise-editor/src/main/webapp/samples/welcome-reloaded.xml
Normal 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&feature=g-vrec&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>
|
Loading…
Reference in New Issue
Block a user