diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index b1bb69f4..a49116eb 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -61,7 +61,7 @@ mindplot.Designer = new Class({ // Set editor working area ... this.setViewPort(options.viewPort); - mindplot.TopicEditor.configure(); + mindplot.TopicEditor.configure(this.isReadOnly()); }, _registerEvents : function() { @@ -72,6 +72,15 @@ mindplot.Designer = new Class({ mindplot.DesignerKeyboard.register(this); }, + addEvent: function(type, listener) { + if (type == "editnode") { + var editor = mindplot.TopicEditor.getInstance(); + editor.addEvent(type, listener); + } else { + this.parent(type, listener); + } + }, + _registerMouseEvents : function() { var workspace = this._workspace; var screenManager = workspace.getScreenManager(); @@ -329,7 +338,7 @@ mindplot.Designer = new Class({ // Create a new node ... var model = topic.getModel(); var mindmap = model.getMindmap(); - var childModel = mindmap.createNode(mindplot.model.INodeModel.MAIN_TOPIC_TYPE); + var childModel = mindmap.createNode(); // Create a new node ... var layoutManager = this._eventBussDispatcher.getLayoutManager(); @@ -342,19 +351,9 @@ mindplot.Designer = new Class({ return childModel; }, - addDraggedNode: function(event, options) { + addDraggedNode: function(event, model) { $assert(event, "event can not be null"); - $assert(options, "option can not be null"); - - // Create a new node ... - var mindmap = this.getMindmap(); - var model = mindmap.createNode(mindplot.model.INodeModel.MAIN_TOPIC_TYPE); - model.setShapeType(mindplot.model.TopicShape.IMAGE); - - // Set node specified options ... - model.setImageUrl(options.imageUrl); - model.setImageSize(options.imageWidth, options.imageHeight); - model.setMetadata(options.metadata); + $assert(model, "model can not be null"); // Position far from the visual area ... model.setPosition(1000, 1000); @@ -402,7 +401,7 @@ mindplot.Designer = new Class({ // Create a new node ... var model = topic.getModel(); var mindmap = model.getMindmap(); - result = mindmap.createNode(mindplot.model.INodeModel.MAIN_TOPIC_TYPE); + result = mindmap.createNode(); // Create a new node ... var order = topic.getOrder() + 1; @@ -449,42 +448,42 @@ mindplot.Designer = new Class({ this._mindmap = mindmapModel; // try { - // Init layout manager ... - var size = {width:25,height:25}; - var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); - layoutManager.addEvent('change', function(event) { - var id = event.getId(); - var topic = this.getModel().findTopicById(id); - topic.setPosition(event.getPosition()); - topic.setOrder(event.getOrder()); - }.bind(this)); - this._eventBussDispatcher.setLayoutManager(layoutManager); + // Init layout manager ... + var size = {width:25,height:25}; + var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); + layoutManager.addEvent('change', function(event) { + var id = event.getId(); + var topic = this.getModel().findTopicById(id); + topic.setPosition(event.getPosition()); + topic.setOrder(event.getOrder()); + }.bind(this)); + this._eventBussDispatcher.setLayoutManager(layoutManager); - // Building node graph ... - var branches = mindmapModel.getBranches(); - for (var i = 0; i < branches.length; i++) { - // NodeModel -> NodeGraph ... - var nodeModel = branches[i]; - var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false); + // Building node graph ... + var branches = mindmapModel.getBranches(); + for (var i = 0; i < branches.length; i++) { + // NodeModel -> NodeGraph ... + var nodeModel = branches[i]; + var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false); - // Update shrink render state... - nodeGraph.setBranchVisibility(true); - } + // Update shrink render state... + nodeGraph.setBranchVisibility(true); + } - var relationships = mindmapModel.getRelationships(); - for (var j = 0; j < relationships.length; j++) { - this._relationshipModelToRelationship(relationships[j]); - } + var relationships = mindmapModel.getRelationships(); + for (var j = 0; j < relationships.length; j++) { + this._relationshipModelToRelationship(relationships[j]); + } - // Place the focus on the Central Topic - var centralTopic = this.getModel().getCentralTopic(); - this.goToNode(centralTopic); + // Place the focus on the Central Topic + var centralTopic = this.getModel().getCentralTopic(); + this.goToNode(centralTopic); - // Finally, sort the map ... - mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); + // Finally, sort the map ... + mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); - this.fireEvent('loadSuccess'); + this.fireEvent('loadSuccess'); // } catch(e) { // this.fireEvent('loadError', e); // } diff --git a/mindplot/src/main/javascript/TopicEditor.js b/mindplot/src/main/javascript/TopicEditor.js index 52eb0d5c..c85f70ed 100644 --- a/mindplot/src/main/javascript/TopicEditor.js +++ b/mindplot/src/main/javascript/TopicEditor.js @@ -21,8 +21,8 @@ mindplot.TopicEditor = new Class({ Static: { _instance: null, - configure: function(options) { - this._instance = new mindplot.TopicEditor(); + configure: function(readOnly) { + this._instance = new mindplot.TopicEditor(readOnly); }, getInstance : function() { @@ -30,7 +30,8 @@ mindplot.TopicEditor = new Class({ } }, - initialize:function() { + initialize:function(readOnly) { + this._readOnly = readOnly; this._activeEditor = null; this._multilineEditor = new mindplot.MultilineTextEditor(); }, @@ -51,11 +52,11 @@ mindplot.TopicEditor = new Class({ // Open the new editor ... var model = topic.getModel(); - if (model.getShapeType() != mindplot.model.TopicShape.IMAGE) { + if (model.getShapeType() != mindplot.model.TopicShape.IMAGE && !this._readOnly) { this._multilineEditor.show(topic, options ? options.text : null); this._activeEditor = this._multilineEditor; } else { - // To be implemented.... + this.fireEvent("editnode", {model:model,readOnly:this._readOnly}); } }, diff --git a/mindplot/src/main/javascript/model/Mindmap.js b/mindplot/src/main/javascript/model/Mindmap.js index 7767a62a..99227896 100644 --- a/mindplot/src/main/javascript/model/Mindmap.js +++ b/mindplot/src/main/javascript/model/Mindmap.js @@ -91,7 +91,7 @@ mindplot.model.Mindmap = new Class({ }, createNode : function(type, id) { - $assert(type, "node type can not be null"); + type = !$defined(type) ? mindplot.model.INodeModel.MAIN_TOPIC_TYPE : type; return new mindplot.model.NodeModel(type, this, id); }, diff --git a/wise-editor/src/main/webapp/html/drag.html b/wise-editor/src/main/webapp/html/drag.html new file mode 100644 index 00000000..86bd96cc --- /dev/null +++ b/wise-editor/src/main/webapp/html/drag.html @@ -0,0 +1,214 @@ + + + + + + WiseMapping - Editor + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
Text Node !!
+ +
+ +
+ + + diff --git a/wise-editor/src/main/webapp/html/editor.html b/wise-editor/src/main/webapp/html/editor.html index cc764aee..89b9c44b 100644 --- a/wise-editor/src/main/webapp/html/editor.html +++ b/wise-editor/src/main/webapp/html/editor.html @@ -127,25 +127,6 @@ - - - - - - - - - - - - - - - - - - -
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index f1c4d9d2..b76876b1 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -7,7 +7,6 @@ import com.wisemapping.model.MindmapUser; import com.wisemapping.model.User; import com.wisemapping.rest.model.RestMindmap; import com.wisemapping.rest.model.RestMindmapList; -import com.wisemapping.rest.model.RestUser; import com.wisemapping.security.Utils; import com.wisemapping.service.MindmapService; import org.jetbrains.annotations.NotNull; @@ -21,9 +20,20 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; -import java.util.Date; import java.util.List; + +/** + * Pendings: + * Change map title + * List with filter + * Clone + * Delete map + * Discard Changed + * Public ? + * Admin operations for get/update + * Check visibility + */ @Controller public class MindmapController extends BaseController { @Autowired @@ -92,7 +102,6 @@ public class MindmapController extends BaseController { updateMindmap(minor, mindMap, user); } - private void updateMindmap(boolean minor, MindMap mindMap, User user) throws WiseMappingException { final Calendar now = Calendar.getInstance(); mindMap.setLastModificationTime(now); diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties index 8abef6ba..69310dd9 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -1,6 +1,6 @@ log4j.rootLogger=WARN, stdout, R log4j.logger.com.wisemapping=WARN,stdout,R -log4j.logger.org.springframework=WARN,stdout,R +log4j.logger.org.springframework=DEBUG,stdout,R log4j.logger.org.codehaus.jackson=WARN,stdout,R # Stdout logger �