adding general collaboration framework and Brix

This commit is contained in:
Pablol 2011-08-07 19:27:23 -03:00
parent 361892e004
commit bd888412f7
37 changed files with 15910 additions and 128 deletions

View File

@ -52,9 +52,9 @@
<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="EventBus.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Mindmap.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="NodeModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="RelationshipModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/Mindmap.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/NodeModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/RelationshipModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="MindmapDesigner.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ScreenManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Workspace.js"/>
@ -98,9 +98,9 @@
<filelist dir="${basedir}/src/main/javascript/" files="Note.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ActionIcon.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ImageIcon.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="IconModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="LinkModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="NoteModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/IconModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/LinkModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Command.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DesignerActionRunner.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DesignerUndoManager.js"/>
@ -155,6 +155,21 @@
<filelist dir="${basedir}/src/main/javascript/"
files="layout/LayoutManagerFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/CollaborationManager.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/AbstractCollaborativeFramework.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/AbstractCollaborativeModelFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/brix/model/NodeModel.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/brix/model/Mindmap.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/brix/BrixCollaborativeModelFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="collaboration/frameworks/brix/BrixFramework.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="footer.js"/>
</concat>
@ -190,9 +205,9 @@
<includes>
<include>header-min.js</include>
<include>EventBus-min.js</include>
<include>Mindmap-min.js</include>
<include>NodeModel-min.js</include>
<include>RelationshipModel-min.js</include>
<include>model/Mindmap-min.js</include>
<include>model/NodeModel-min.js</include>
<include>model/RelationshipModel-min.js</include>
<include>MindmapDesigner-min.js</include>
<include>ScreenManager-min.js</include>
<include>Workspace-min.js</include>
@ -233,9 +248,9 @@
<include>Note-min.js</include>
<include>ActionIcon-min.js</include>
<include>ImageIcon-min.js</include>
<include>IconModel-min.js</include>
<include>LinkModel-min.js</include>
<include>NoteModel-min.js</include>
<include>model/IconModel-min.js</include>
<include>model/LinkModel-min.js</include>
<include>model/NoteModel-min.js</include>
<include>EditorOptions-min.js</include>
<include>Command-min.js</include>
@ -267,6 +282,14 @@
<include>layout/FreeMindLayoutManager-min.js</include>
<include>layout/LayoutManagerFactory-min.js</include>
<include>collaboration/CollaborationManager-min.js</include>
<include>collaboration/frameworks/AbstractCollaborativeFramework-min.js</include>
<include>collaboration/frameworks/AbstractCollaborativeModelFactory-min.js</include>
<include>collaboration/frameworks/brix/model/NodeModel-min.js</include>
<include>collaboration/frameworks/brix/model/Mindmap-min.js</include>
<include>collaboration/frameworks/brix/BrixCollaborativeModelFactory-min.js</include>
<include>collaboration/frameworks/brix/BrixFramework-min.js</include>
<include>footer-min.js</include>
</includes>

View File

@ -28,7 +28,7 @@ mindplot.CentralTopic = new Class({
},
getTopicType : function() {
return mindplot.NodeModel.CENTRAL_TOPIC_TYPE;
return mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE;
},
setCursor : function(type) {
@ -44,7 +44,7 @@ mindplot.CentralTopic = new Class({
// Create a new node ...
var model = this.getModel();
var mindmap = model.getMindmap();
var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
var childModel = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
if (prepositionate) {
if (!$defined(this.___siblingDirection)) {
@ -67,7 +67,7 @@ mindplot.CentralTopic = new Class({
},
_defaultShapeType : function() {
return mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT;
return mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT;
},

View File

@ -27,7 +27,7 @@ mindplot.ConnectionLine = new Class({
var strokeColor = mindplot.ConnectionLine.getStrokeColor();
var line;
if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (targetNode.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
line = this._createLine(lineType, mindplot.ConnectionLine.CURVED);
// line = new web2d.Line();
if (line.getType() == "CurvedLine") {
@ -126,7 +126,7 @@ mindplot.ConnectionLine = new Class({
var offset = mindplot.Topic.CONNECTOR_WIDTH / 2;
var targetTopicSize = targetTopic.getSize();
var y;
if (targetTopic.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) {
if (targetTopic.getShapeType() == mindplot.model.NodeModel.SHAPE_TYPE_LINE) {
y = targetTopicSize.height;
} else {
y = targetTopicSize.height / 2;

View File

@ -93,7 +93,7 @@ mindplot.CommandContext = new Class({
},
createModel:function() {
var mindmap = this._designer.getMindmap();
var model = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
var model = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
return model;
},
connect:function(childTopic, parentTopic, isVisible) {

View File

@ -192,7 +192,7 @@ mindplot.DragPivot = new Class({
$assert(targetTopic, 'parent can not be null');
this._targetTopic = targetTopic;
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (targetTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._line = this._straightLine;
} else {
this._line = this._curvedLine;

View File

@ -170,7 +170,7 @@ mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace)
{
var targetTopic = this.getConnectedToTopic();
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
if (targetTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
{
// Update topic position ...
var dragPivotPosition = dragPivot.getPosition();

View File

@ -48,12 +48,12 @@ mindplot.DragTopicPositioner = new Class({
var currentConnection = dragTopic.getConnectedToTopic();
if ($defined(currentConnection)) {
// MainTopic->MainTopicConnection.
if (currentConnection.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE) {
if (currentConnection.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE) {
if (mainTopicToMainTopicConnection != currentConnection) {
dragTopic.disconnect(this._workspace);
}
}
else if (currentConnection.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
else if (currentConnection.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
// Distance if greater that the allowed.
var dragXPosition = dragTopic.getPosition().x;
var currentXPosition = currentConnection.getPosition().x;
@ -90,7 +90,7 @@ mindplot.DragTopicPositioner = new Class({
for (var i = 0; i < topics.length; i++) {
var targetTopic = topics[i];
var position = dragTopic.getPosition();
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE && targetTopic != draggedNode) {
if (targetTopic.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE && targetTopic != draggedNode) {
var canBeConnected = dragTopic.canBeConnectedTo(targetTopic);
if (canBeConnected) {
var targetPosition = targetTopic.getPosition();

View File

@ -31,10 +31,10 @@ mindplot.MainTopic = new Class({
// Create a new node ...
var model = this.getModel();
var mindmap = model.getMindmap();
siblingModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
siblingModel = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
// Positionate following taking into account the sibling positon.
if (positionate && parentTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (positionate && parentTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
var pos = this.getPosition();
siblingModel.setPosition(pos.x, pos.y);
}
@ -50,7 +50,7 @@ mindplot.MainTopic = new Class({
// Create a new node ...
var model = this.getModel();
var mindmap = model.getMindmap();
var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
var childModel = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
// Get the hights model order position ...
var children = this._getChildren();
@ -99,14 +99,14 @@ mindplot.MainTopic = new Class({
_defaultShapeType : function() {
return mindplot.NodeModel.SHAPE_TYPE_LINE;
return mindplot.model.NodeModel.SHAPE_TYPE_LINE;
},
updateTopicShape : function(targetTopic, workspace) {
// Change figure based on the connected topic ...
var model = this.getModel();
var shapeType = model.getShapeType();
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (targetTopic.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
if (!$defined(shapeType)) {
// Get the real shape type ...
shapeType = this.getShapeType();
@ -127,7 +127,7 @@ mindplot.MainTopic = new Class({
if (!$defined(shapeType)) {
// Change figure ...
shapeType = this.getShapeType();
this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT, false);
this._setShapeType(mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT, false);
}
var innerShape = this.getInnerShape();
innerShape.setVisibility(true);
@ -171,7 +171,7 @@ mindplot.MainTopic = new Class({
var isAtRight = mindplot.util.Shape.isAtRight(sourcePosition, pos);
var result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight);
if (this.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) {
if (this.getShapeType() == mindplot.model.NodeModel.SHAPE_TYPE_LINE) {
result.y = result.y + (this.getSize().height / 2);
}
@ -196,7 +196,7 @@ mindplot.MainTopic = new Class({
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
var result;
if (this.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) {
if (this.getShapeType() == mindplot.model.NodeModel.SHAPE_TYPE_LINE) {
// if (!this.isConnectedToCentralTopic())
// {
result = new core.Point();
@ -240,14 +240,14 @@ mindplot.MainTopic = new Class({
var model = this.getModel();
var parent = model.getParent();
return parent && parent.getType() === mindplot.NodeModel.CENTRAL_TOPIC_TYPE;
return parent && parent.getType() === mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE;
},
_defaultText : function() {
var targetTopic = this.getOutgoingConnectedTopic();
var result = "";
if ($defined(targetTopic)) {
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (targetTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
result = "Main Topic";
} else {
result = "Sub Topic";
@ -262,7 +262,7 @@ mindplot.MainTopic = new Class({
var targetTopic = this.getOutgoingConnectedTopic();
var result;
if ($defined(targetTopic)) {
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (targetTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
result = {
font:"Arial",
size: 8,

View File

@ -102,7 +102,7 @@ mindplot.MindmapDesigner = new Class({
// Create a new topic model ...
var mindmap = mindmapDesigner.getMindmap();
var model = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
var model = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
model.setPosition(pos.x, pos.y);
// Get central topic ...
@ -233,7 +233,7 @@ mindplot.MindmapDesigner = new Class({
}
var topic = nodes[0];
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (topic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
// Central topic doesn't have siblings ...
this.createChildForSelectedNode();
@ -335,6 +335,17 @@ mindplot.MindmapDesigner = new Class({
this._actionRunner.markAsChangeBase();
},
loadFromCollaborativeModel: function(collaborationManager){
var mindmap = collaborationManager.buildWiseModel();
this._loadMap(1, mindmap);
// Place the focus on the Central Topic
var centralTopic = this.getCentralTopic();
this._goToNode.attempt(centralTopic, this);
this._fireEvent("loadsuccess");
},
loadFromXML : function(mapId, xmlContent) {
$assert(xmlContent, 'mindmapId can not be null');
$assert(xmlContent, 'xmlContent can not be null');
@ -526,7 +537,7 @@ mindplot.MindmapDesigner = new Class({
},
_removeNode : function(node) {
if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
var parent = node._parent;
node.disconnect(this._workspace);
@ -551,7 +562,7 @@ mindplot.MindmapDesigner = new Class({
deleteCurrentNode : function() {
var validateFunc = function(selectedObject) {
return selectedObject.getType() == mindplot.RelationshipLine.type || selectedObject.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE
return selectedObject.getType() == mindplot.RelationshipLine.type || selectedObject.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE
};
var validateError = 'Central topic can not be deleted.';
var selectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
@ -615,7 +626,7 @@ mindplot.MindmapDesigner = new Class({
setBackColor2SelectedNode : function(color) {
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.NodeModel.SHAPE_TYPE_LINE
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
};
var validateError = 'Color can not be setted to line topics.';
var validSelectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
@ -675,7 +686,7 @@ mindplot.MindmapDesigner = new Class({
setBorderColor2SelectedNode : function(color) {
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.NodeModel.SHAPE_TYPE_LINE
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
};
var validateError = 'Color can not be setted to line topics.';
var validSelectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
@ -716,7 +727,7 @@ mindplot.MindmapDesigner = new Class({
setShape2SelectedNode : function(shape) {
var validateFunc = function(topic) {
return !(topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.NodeModel.SHAPE_TYPE_LINE)
return !(topic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.NodeModel.SHAPE_TYPE_LINE)
};
var validateError = 'Central Topic shape can not be changed to line figure.';
var validSelectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
@ -966,7 +977,7 @@ mindplot.MindmapDesigner = new Class({
var nodes = this._getSelectedNodes();
if (nodes.length > 0) {
var node = nodes[0];
if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToSideChild(node, 'RIGHT');
}
else {
@ -983,7 +994,7 @@ mindplot.MindmapDesigner = new Class({
var nodes = this._getSelectedNodes();
if (nodes.length > 0) {
var node = nodes[0];
if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToSideChild(node, 'LEFT');
}
else {
@ -1000,7 +1011,7 @@ mindplot.MindmapDesigner = new Class({
var nodes = this._getSelectedNodes();
if (nodes.length > 0) {
var node = nodes[0];
if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToBrother(node, 'UP');
}
}
@ -1009,7 +1020,7 @@ mindplot.MindmapDesigner = new Class({
var nodes = this._getSelectedNodes();
if (nodes.length > 0) {
var node = nodes[0];
if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToBrother(node, 'DOWN');
}
}

View File

@ -137,10 +137,10 @@ mindplot.NodeGraph.create = function(nodeModel) {
$assert(type, 'Node model type can not be null');
var result;
if (type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (type == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
result = new mindplot.CentralTopic(nodeModel);
} else
if (type == mindplot.NodeModel.MAIN_TOPIC_TYPE) {
if (type == mindplot.model.NodeModel.MAIN_TOPIC_TYPE) {
result = new mindplot.MainTopic(nodeModel);
} else {
assert(false, "unsupported node type:" + type);

View File

@ -33,7 +33,7 @@ mindplot.Topic = new Class({
// Positionate topic ....
var model = this.getModel();
var pos = model.getPosition();
if (pos != null && model.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (pos != null && model.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this.setPosition(pos);
}
},
@ -134,7 +134,7 @@ mindplot.Topic = new Class({
this._setBorderColor(brColor, false);
// Define the pointer ...
if (this.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (this.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._innerShape.setCursor('move');
} else {
this._innerShape.setCursor('default');
@ -151,16 +151,16 @@ mindplot.Topic = new Class({
type = this.getShapeType();
}
if (type == mindplot.NodeModel.SHAPE_TYPE_RECT) {
if (type == mindplot.model.NodeModel.SHAPE_TYPE_RECT) {
result = new web2d.Rect(0, attributes);
}
else if (type == mindplot.NodeModel.SHAPE_TYPE_ELIPSE) {
else if (type == mindplot.model.NodeModel.SHAPE_TYPE_ELIPSE) {
result = new web2d.Elipse(attributes);
}
else if (type == mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT) {
else if (type == mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT) {
result = new web2d.Rect(0.3, attributes);
}
else if (type == mindplot.NodeModel.SHAPE_TYPE_LINE) {
else if (type == mindplot.model.NodeModel.SHAPE_TYPE_LINE) {
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1, strokeOpacity:1});
result.setSize = function(width, height) {
this.size = {width:width, height:height};
@ -210,7 +210,7 @@ mindplot.Topic = new Class({
getOuterShape : function() {
if (!$defined(this._outerShape)) {
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT);
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT);
rect.setPosition(-2, -3);
rect.setOpacity(0);
this._outerShape = rect;
@ -410,7 +410,7 @@ mindplot.Topic = new Class({
}
});
if (this.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (this.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
result.setCursor('move');
} else {
result.setCursor('default');
@ -436,9 +436,9 @@ mindplot.Topic = new Class({
getOffset : function(value, updateModel) {
var offset = 18;
if (mindplot.NodeModel.MAIN_TOPIC_TYPE == this.getType()) {
if (mindplot.model.NodeModel.MAIN_TOPIC_TYPE == this.getType()) {
var parent = this.getModel().getParent();
if (parent && mindplot.NodeModel.MAIN_TOPIC_TYPE == parent.getType()) {
if (parent && mindplot.model.NodeModel.MAIN_TOPIC_TYPE == parent.getType()) {
offset = 6;
}
else {
@ -689,7 +689,7 @@ mindplot.Topic = new Class({
iconGroup = this.getOrBuildIconGroup();
}
if (this.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (this.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
shrinkConnector.addToWorkspace(group);
}
@ -852,7 +852,7 @@ mindplot.Topic = new Class({
setBranchVisibility : function(value) {
var current = this;
var parent = this;
while (parent != null && parent.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
while (parent != null && parent.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
current = parent;
parent = current.getParent();
}
@ -1197,7 +1197,7 @@ mindplot.Topic = new Class({
var height = sizeHeight + this._offset;
var width = sizeWidth + this._offset * 2 + iconOffset + 2;
var pos = this._offset / 2 - 1;
if (this.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_ELIPSE) {
if (this.getShapeType() == mindplot.model.NodeModel.SHAPE_TYPE_ELIPSE) {
var factor = 0.25;
height = (width * factor < height ? height : width * factor);
pos = (height - sizeHeight + 3) / 2;

View File

@ -44,11 +44,11 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
var parentTopic = document.createElement("topic");
// Set topic attributes...
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (topic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
parentTopic.setAttribute("central", true);
} else {
var parent = topic.getParent();
if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (parent == null || parent.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
var pos = topic.getPosition();
parentTopic.setAttribute("position", pos.x + ',' + pos.y);
} else {
@ -165,7 +165,7 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
$assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document.");
// Start the loading process ...
var mindmap = new mindplot.Mindmap();
var mindmap = new mindplot.model.Mindmap();
var children = rootElem.childNodes;
for (var i = 0; i < children.length; i++) {
@ -179,7 +179,7 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
},
_deserializeNode : function(domElem, mindmap) {
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
var type = (domElem.getAttribute('central') != null) ? mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.model.NodeModel.MAIN_TOPIC_TYPE;
var topic = mindmap.createNode(type);
// Load attributes...

View File

@ -62,11 +62,11 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
var parentTopic = document.createElement("topic");
// Set topic attributes...
if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (topic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
parentTopic.setAttribute("central", true);
} else {
var parent = topic.getParent();
// if (parent == null || parent.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
// if (parent == null || parent.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
// {
var pos = topic.getPosition();
parentTopic.setAttribute("position", pos.x + ',' + pos.y);
@ -210,7 +210,7 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
this._idsMap = new Hash();
// Start the loading process ...
var mindmap = new mindplot.Mindmap();
var mindmap = new mindplot.model.Mindmap();
var version = rootElem.getAttribute("version");
mindmap.setVersion(version);
@ -237,7 +237,7 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
},
_deserializeNode : function(domElem, mindmap) {
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
var type = (domElem.getAttribute('central') != null) ? mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.model.NodeModel.MAIN_TOPIC_TYPE;
// Load attributes...
var id = domElem.getAttribute('id');
if ($defined(id)) {

View File

@ -0,0 +1,29 @@
mindplot.collaboration = {};
mindplot.collaboration.CollaborationManager = new Class({
initialize:function(){
this.collaborativeModelReady = false;
this.collaborativeModelReady = null;
this.wiseReady = false;
},
isCollaborationFrameworkAvailable:function(){
return $defined(goog.collab.CollaborativeApp);
},
setCollaborativeFramework:function(framework){
this._collaborativeFramework = framework;
this.collaborativeModelReady = true;
if(this.wiseReady){
buildCollaborativeMindmapDesigner();
}
},
setWiseReady:function(ready){
this.wiseReady=ready;
},
isCollaborativeFrameworkReady:function(){
return this.collaborativeModelReady;
},
buildWiseModel: function(){
return this._collaborativeFramework.buildWiseModel();
}
});
$wise_collaborationManager = new mindplot.collaboration.CollaborationManager();

View File

@ -0,0 +1,36 @@
mindplot.collaboration.frameworks = {};
mindplot.collaboration.frameworks.AbstractCollaborativeFramework = new Class({
initialize: function(model, collaborativeModelFactory){
this._collaborativeModelFactory = collaborativeModelFactory;
if(!$defined(model)){
model = this._buildInitialCollaborativeModel();
}
this._model = model;
},
getModel: function(){
return this._model;
},
buildWiseModel: function(){
var cmindMap = this.getModel();
var mindmap = new mindplot.model.Mindmap();
var branches = cmindMap.getBranches();
branches.forEach(function(branch){
var type = branch.getType();
var id = branch.getId();
var node = mindmap.createNode(type,id);
node.setText(branch.getText());
mindmap.addBranch(node);
}.bind(this))
return mindmap;
},
_buildInitialCollaborativeModel: function(){
var mindmap = this._collaborativeModelFactory.buildMindMap();
this.addMindmap(mindmap);
var centralTopic = mindmap.createNode(mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE);
mindmap.addBranch(centralTopic);
return mindmap;
},
addMindmap:function(model){}
});

View File

@ -0,0 +1,9 @@
mindplot.collaboration.frameworks.AbstractCollaborativeModelFactory = new Class({
initialize:function(){},
buildMindMap:function(){
},
buildCollaborativeModelFor:function(model){
}
});

View File

@ -0,0 +1,12 @@
mindplot.collaboration.frameworks.brix.BrixCollaborativeModelFactory = new Class({
Extends:mindplot.collaboration.frameworks.AbstractCollaborativeModelFactory,
initialize:function(brixFramework){
this._brixFramework = brixFramework;
},
buildMindMap:function(){
return new mindplot.collaboration.frameworks.brix.model.Mindmap(null, this._brixFramework);
},
buildCollaborativeModelFor:function(model){
return new mindplot.collaboration.frameworks.brix.model.Mindmap(model, this._brixFramework);
}
});

View File

@ -0,0 +1,42 @@
mindplot.collaboration.frameworks.brix.BrixFramework = new Class({
Extends: mindplot.collaboration.frameworks.AbstractCollaborativeFramework,
initialize: function(model, app){
this._app = app;
var collaborativeModelFactory = new mindplot.collaboration.frameworks.brix.BrixCollaborativeModelFactory(this);
var cModel = null;
var root = this.getBrixModel().getRoot();
if(!root.isEmpty()){
cModel = collaborativeModelFactory.buildCollaborativeModelFor(root.get("mindmap"));
}
this.parent(cModel, collaborativeModelFactory);
},
addMindmap:function(model){
var root = this.getBrixModel().getRoot();
root.put("mindmap",model);
},
getBrixModel:function(){
return this._app.getModel();
},
buildWiseModel: function(){
return this.parent();
}
});
instanciated=false;
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate=function(){
if($defined(isGoogleBrix) && !instanciated){
instanciated=true;
var app = new goog.collab.CollaborativeApp();
app.start();
app.addListener('modelLoad', function(model){
var framework = new mindplot.collaboration.frameworks.brix.BrixFramework(model, app);
$wise_collaborationManager.setCollaborativeFramework(framework);
}.bind(this));
}
};
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate();

View File

@ -0,0 +1,107 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.collaboration.frameworks.brix.model.Mindmap = new Class({
Extends:mindplot.model.Mindmap,
initialize:function(brixModel, brixFramework){
this.parent();
this._brixModel = brixModel;
this._brixFramework = brixFramework;
if(!$defined(this._brixModel)){
this._brixModel = this._createBrixModel();
}else{
var branches = this._brixModel.get("branches");
for(var i=0; i<branches.size(); i++){
var node = branches.get(i);
var nodeModel = new mindplot.collaboration.frameworks.brix.model.NodeModel(node, this._brixFramework);
this.addBranch(nodeModel, false);
}
}
},
_createBrixModel:function(){
var model = this._brixFramework.getBrixModel().create("Map");
var branches = this._brixFramework.getBrixModel().create("List");
model.put("branches",branches);
this._brixFramework.addMindmap(model);
return model;
},
getBrixModel:function(){
return this._brixModel;
},
setId : function(id) {
this._iconType = id;
},
setVersion : function(version) {
this._version = version;
},
addBranch : function(nodeModel, addToModel) {
this.parent(nodeModel);
if($defined(addToModel) && addToModel){
var branches = this._brixModel.get("branches");
branches.add(nodeModel.getBrixModel());
}
},
connect : function(parent, child) {
this.parent(parent, child);
// Remove from the branch ...
var branches = this._brixModel.get("branches");
var childIndex = null;
for(var i = 0; i<branches.size(); i++){
if(branches.get(i)==child.getBrixModel()){
childIndex = i;
break;
}
}
if(childIndex!=null){
branches.remove(childIndex);
}
},
disconnect : function(child) {
var parent = child.getParent();
$assert(child, 'Child can not be null.');
$assert(parent, 'Child model seems to be already connected');
parent._removeChild(child);
var branches = this.getBranches();
branches.push(child);
},
_createNode : function(type, id) {
$assert(type, 'Node type must be specified.');
var result = new mindplot.collaboration.frameworks.brix.model.NodeModel(null, this._brixFramework, type, this, id);
return result;
},
createRelationship : function(fromNode, toNode) {
$assert(fromNode, 'from node cannot be null');
$assert(toNode, 'to node cannot be null');
return new mindplot.model.RelationshipModel(fromNode, toNode);
},
addRelationship : function(relationship) {
this._relationships.push(relationship);
},
removeRelationship : function(relationship) {
this._relationships.erase(relationship);
}
}
);

View File

@ -0,0 +1,449 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.collaboration.frameworks.brix={};
mindplot.collaboration.frameworks.brix.model = {};
mindplot.collaboration.frameworks.brix.model.NodeModel = new Class({
Extends: mindplot.model.NodeModel,
initialize:function(brixModel, brixFramework, type, mindmap, id) {
this._brixModel = brixModel;
this._brixFramework = brixFramework;
if($defined(this._brixModel)){
type = this._brixModel.get("type");
id = this._brixModel.get("id");
}
this.parent(type, mindmap, id);
if(!$defined(this._brixModel)){
this._brixModel = this._createBrixModel();
}
},
_createBrixModel:function(){
var model = this._brixFramework.getBrixModel().create("Map");
model.put("type",this._type);
model.put("id",this._id);
model.put("text",this._type==mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE?"Central Topic":"Main Topic");
model.addListener("valueChanged",this._valueChangedListener.bind(this));
return model;
},
getBrixModel:function(){
return this._brixModel;
},
_valueChangedListener:function(event){
console.log("property: "+ event.getProperty()+" value: "+event.getNewValue());
},
clone : function() {
var result = new mindplot.model.NodeModel(this._type, this._mindmap);
result._order = this._order;
result._type = this._type;
result._children = this._children.map(function(item, index) {
var model = item.clone();
model._parent = result;
return model;
});
result._icons = this._icons;
result._links = this._links;
result._notes = this._notes;
result._size = this._size;
result._position = this._position;
result._id = this._id;
result._mindmap = this._mindmap;
result._text = this._text;
result._shapeType = this._shapeType;
result._fontFamily = this._fontFamily;
result._fontSize = this._fontSize;
result._fontStyle = this._fontStyle;
result._fontWeight = this._fontWeight;
result._fontColor = this._fontColor;
result._borderColor = this._borderColor;
result._backgroundColor = this._backgroundColor;
result._areChildrenShrinked = this._areChildrenShrinked;
return result;
},
areChildrenShrinked : function() {
return this._areChildrenShrinked;
},
setChildrenShrinked : function(value) {
this._areChildrenShrinked = value;
},
getId : function() {
return this._id;
},
setId : function(id) {
this._id = id;
if (mindplot.model.NodeModel._uuid < id) {
mindplot.model.NodeModel._uuid = id;
}
},
getType : function() {
return this._type;
},
setText : function(text) {
this.parent(text);
this._brixModel.set("text",text);
},
getText : function() {
return this._text;
},
isNodeModel : function() {
return true;
},
isConnected : function() {
return this._parent != null;
},
createLink : function(url) {
$assert(url, 'Link URL must be specified.');
return new mindplot.model.LinkModel(url, this);
},
addLink : function(link) {
$assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.push(link);
},
_removeLink : function(link) {
$assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.erase(link);
},
createNote : function(text) {
$assert(text != null, 'note text must be specified.');
return new mindplot.model.NoteModel(text, this);
},
addNote : function(note) {
$assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.push(note);
},
_removeNote : function(note) {
$assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.erase(note);
},
createIcon : function(iconType) {
$assert(iconType, 'IconType must be specified.');
return new mindplot.model.IconModel(iconType, this);
},
addIcon : function(icon) {
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.push(icon);
},
_removeIcon : function(icon) {
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.erase(icon);
},
removeLastIcon : function() {
this._icons.pop();
},
_appendChild : function(child) {
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
this._children.push(child);
child._parent = this;
},
_removeChild : function(child) {
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
this._children.erase(child);
child._parent = null;
},
setPosition : function(x, y) {
$assert(x, "x coordinate must be defined");
$assert(y, "y coordinate must be defined");
if (!$defined(this._position)) {
this._position = new core.Point();
}
this._position.x = parseInt(x);
this._position.y = parseInt(y);
},
getPosition : function() {
return this._position;
},
setFinalPosition : function(x, y) {
$assert(x, "x coordinate must be defined");
$assert(y, "y coordinate must be defined");
if (!$defined(this._finalPosition)) {
this._finalPosition = new core.Point();
}
this._finalPosition.x = parseInt(x);
this._finalPosition.y = parseInt(y);
},
getFinalPosition : function() {
return this._finalPosition;
},
setSize : function(width, height) {
this._size.width = width;
this._size.height = height;
},
getSize : function() {
return {width:this._size.width,height:this._size.height};
},
getChildren : function() {
return this._children;
},
getIcons : function() {
return this._icons;
},
getLinks : function() {
return this._links;
},
getNotes : function() {
return this._notes;
},
getParent : function() {
return this._parent;
},
getMindmap : function() {
return this._mindmap;
},
setParent : function(parent) {
$assert(parent != this, 'The same node can not be parent and child if itself.');
this._parent = parent;
},
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
$assert(sourcePosition, 'childPosition can not be null.');
$assert(targetTopicHeight, 'childrenWidth can not be null.');
// Only can be connected if the node is in the left or rigth.
var targetModel = this;
var mindmap = targetModel.getMindmap();
var targetPosition = targetModel.getPosition();
var result = false;
if (sourceModel.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE) {
// Finally, check current node ubication.
var targetTopicSize = targetModel.getSize();
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
var gap = 35 + targetTopicHeight / 2;
if (targetModel.getChildren().length > 0) {
gap += Math.abs(targetPosition.y - targetModel.getChildren()[0].getPosition().y);
}
if (yDistance <= gap) {
// Circular connection ?
if (!sourceModel._isChildNode(this)) {
var toleranceDistance = (targetTopicSize.width / 2) + targetTopicHeight;
var xDistance = sourcePosition.x - targetPosition.x;
var isTargetAtRightFromCentral = targetPosition.x >= 0;
if (isTargetAtRightFromCentral) {
if (xDistance >= -targetTopicSize.width / 2 && xDistance <= mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
result = true;
}
} else {
if (xDistance <= targetTopicSize.width / 2 && Math.abs(xDistance) <= mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
result = true;
}
}
}
}
} else {
throw "No implemented yet";
}
return result;
},
_isChildNode : function(node) {
var result = false;
if (node == this) {
result = true;
} else {
var children = this.getChildren();
for (var i = 0; i < children.length; i++) {
var child = children[i];
result = child._isChildNode(node);
if (result) {
break;
}
}
}
return result;
},
connectTo : function(parent) {
var mindmap = this.getMindmap();
mindmap.connect(parent, this);
this._parent = parent;
},
disconnect : function() {
var mindmap = this.getMindmap();
mindmap.disconnect(this);
},
getOrder : function() {
return this._order;
},
getShapeType : function() {
return this._shapeType;
},
setShapeType : function(type) {
this._shapeType = type;
},
setOrder : function(value) {
this._order = value;
},
setFontFamily : function(value) {
this._fontFamily = value;
},
getOrder : function() {
return this._order;
},
getFontFamily : function() {
return this._fontFamily;
},
setFontStyle : function(value) {
this._fontStyle = value;
},
getFontStyle : function() {
return this._fontStyle;
},
setFontWeight : function(value) {
this._fontWeight = value;
},
getFontWeight : function() {
return this._fontWeight;
},
setFontColor : function(value) {
this._fontColor = value;
},
getFontColor : function() {
return this._fontColor;
},
setFontSize : function(value) {
this._fontSize = value;
},
getFontSize : function() {
return this._fontSize;
},
getBorderColor : function() {
return this._borderColor;
},
setBorderColor : function(color) {
this._borderColor = color;
},
getBackgroundColor : function() {
return this._backgroundColor;
},
setBackgroundColor : function(color) {
this._backgroundColor = color;
},
deleteNode : function() {
var mindmap = this._mindmap;
// if it has children nodes, Their must be disconnected.
var lenght = this._children;
for (var i = 0; i < lenght; i++) {
var child = this._children[i];
mindmap.disconnect(child);
}
var parent = this._parent;
if ($defined(parent)) {
// if it is connected, I must remove it from the parent..
mindmap.disconnect(this);
}
// It's an isolated node. It must be a hole branch ...
var branches = mindmap.getBranches();
branches.erase(this);
},
inspect : function() {
return '(type:' + this.getType() + ' , id: ' + this.getId() + ')';
}
});
mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
mindplot.model.NodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
mindplot.model.NodeModel.DRAGGED_TOPIC_TYPE = 'DraggedTopic';
mindplot.model.NodeModel.SHAPE_TYPE_RECT = 'rectagle';
mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle';
mindplot.model.NodeModel.SHAPE_TYPE_ELIPSE = 'elipse';
mindplot.model.NodeModel.SHAPE_TYPE_LINE = 'line';
mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
/**
* @todo: This method must be implemented.
*/
mindplot.model.NodeModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}
this._uuid = this._uuid + 1;
return this._uuid;
}

View File

@ -37,7 +37,7 @@ mindplot.commands.DragTopicCommand = new Class(
var origParentTopic = topic.getOutgoingConnectedTopic();
var origOrder = null;
var origPosition = null;
// if (topic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE && origParentTopic != null && origParentTopic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE)
// if (topic.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE && origParentTopic != null && origParentTopic.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE)
// {
// In this case, topics are positioned using order ...
origOrder = topic.getOrder();

View File

@ -74,7 +74,7 @@ mindplot.layout.BaseLayoutManager = new Class({
},
_isCentralTopic:function(node){
var type = node.getModel().getType();
return type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE;
return type == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE;
},
getClassName:function(){
return mindplot.layout.BaseLayoutManager.NAME;

View File

@ -58,7 +58,7 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
});
// Add drag behaviour ...
if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
if (topic.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
{
topic.addEventListener("mousedown",this._reconnectMouseDownListener.bindWithEvent(this,[topic]));
}
@ -267,7 +267,7 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
}
},
addHelpers:function(node){
if (node.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
if (node.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
this._addMoveHelper(node);
},
_addMoveHelper:function(node){

View File

@ -60,7 +60,7 @@ mindplot.layout.OriginalLayoutManager = new Class({
}
}
nodesByOrder = null;
return node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE ? result : children;
return node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE ? result : children;
},
_nodeResizeEvent:function(node) {
@ -123,7 +123,7 @@ mindplot.layout.OriginalLayoutManager = new Class({
});
// Add drag behaviour ...
if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
if (topic.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
// Central Topic doesn't support to be dragged
var dragger = this._dragger;

View File

@ -16,13 +16,13 @@
* limitations under the License.
*/
mindplot.IconModel = new Class({
mindplot.model.IconModel = new Class({
initialize:function(iconType, topic) {
$assert(iconType, 'Icon id can not be null');
$assert(topic, 'topic can not be null');
this._iconType = iconType;
this._id = mindplot.IconModel._nextUUID();
this._id = mindplot.model.IconModel._nextUUID();
this._topic = topic;
},
@ -51,7 +51,7 @@ mindplot.IconModel = new Class({
/**
* @todo: This method must be implemented.
*/
mindplot.IconModel._nextUUID = function() {
mindplot.model.IconModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
mindplot.LinkModel = new Class({
mindplot.model.LinkModel = new Class({
initialize : function(url, topic) {
$assert(url, 'url can not be null');
$assert(topic, 'mindmap can not be null');

View File

@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.Mindmap = new Class({
mindplot.model = {};
mindplot.model.Mindmap = new Class({
initialize : function() {
this._branches = [];
this._description = null;
@ -53,10 +53,10 @@ mindplot.Mindmap = new Class({
addBranch : function(nodeModel) {
$assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects');
if (this._branches.length == 0) {
$assert(nodeModel.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "First element must be the central topic");
$assert(nodeModel.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE, "First element must be the central topic");
nodeModel.setPosition(0, 0);
} else {
$assert(nodeModel.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "Mindmaps only have one cental topic");
$assert(nodeModel.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE, "Mindmaps only have one cental topic");
}
this._branches.push(nodeModel);
@ -114,7 +114,7 @@ mindplot.Mindmap = new Class({
_createNode : function(type, id) {
$assert(type, 'Node type must be specified.');
var result = new mindplot.NodeModel(type, this, id);
var result = new mindplot.model.NodeModel(type, this, id);
return result;
},
@ -122,7 +122,7 @@ mindplot.Mindmap = new Class({
$assert(fromNode, 'from node cannot be null');
$assert(toNode, 'to node cannot be null');
return new mindplot.RelationshipModel(fromNode, toNode);
return new mindplot.model.RelationshipModel(fromNode, toNode);
},
addRelationship : function(relationship) {

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
mindplot.NodeModel = new Class({
mindplot.model.NodeModel = new Class({
initialize:function(type, mindmap, id) {
$assert(type, 'Node type can not be null');
$assert(mindmap, 'mindmap can not be null');
@ -30,12 +30,12 @@ mindplot.NodeModel = new Class({
this._size = {width:50,height:20};
this._position = null;
if ($defined(id)) {
if (!$defined(mindplot.NodeModel._uuid) || id > mindplot.NodeModel._uuid) {
mindplot.NodeModel._uuid = id;
if (!$defined(mindplot.model.NodeModel._uuid) || id > mindplot.model.NodeModel._uuid) {
mindplot.model.NodeModel._uuid = id;
}
this._id = id;
} else {
this._id = mindplot.NodeModel._nextUUID();
this._id = mindplot.model.NodeModel._nextUUID();
}
this._mindmap = mindmap;
this._text = null;
@ -51,7 +51,7 @@ mindplot.NodeModel = new Class({
},
clone : function() {
var result = new mindplot.NodeModel(this._type, this._mindmap);
var result = new mindplot.model.NodeModel(this._type, this._mindmap);
result._order = this._order;
result._type = this._type;
result._children = this._children.map(function(item, index) {
@ -96,8 +96,8 @@ mindplot.NodeModel = new Class({
setId : function(id) {
this._id = id;
if (mindplot.NodeModel._uuid < id) {
mindplot.NodeModel._uuid = id;
if (mindplot.model.NodeModel._uuid < id) {
mindplot.model.NodeModel._uuid = id;
}
},
@ -123,7 +123,7 @@ mindplot.NodeModel = new Class({
createLink : function(url) {
$assert(url, 'Link URL must be specified.');
return new mindplot.LinkModel(url, this);
return new mindplot.model.LinkModel(url, this);
},
addLink : function(link) {
@ -138,7 +138,7 @@ mindplot.NodeModel = new Class({
createNote : function(text) {
$assert(text != null, 'note text must be specified.');
return new mindplot.NoteModel(text, this);
return new mindplot.model.NoteModel(text, this);
},
addNote : function(note) {
@ -153,7 +153,7 @@ mindplot.NodeModel = new Class({
createIcon : function(iconType) {
$assert(iconType, 'IconType must be specified.');
return new mindplot.IconModel(iconType, this);
return new mindplot.model.IconModel(iconType, this);
},
addIcon : function(icon) {
@ -261,7 +261,7 @@ mindplot.NodeModel = new Class({
var targetPosition = targetModel.getPosition();
var result = false;
if (sourceModel.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE) {
if (sourceModel.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE) {
// Finally, check current node ubication.
var targetTopicSize = targetModel.getSize();
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
@ -279,12 +279,12 @@ mindplot.NodeModel = new Class({
var isTargetAtRightFromCentral = targetPosition.x >= 0;
if (isTargetAtRightFromCentral) {
if (xDistance >= -targetTopicSize.width / 2 && xDistance <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
if (xDistance >= -targetTopicSize.width / 2 && xDistance <= mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
result = true;
}
} else {
if (xDistance <= targetTopicSize.width / 2 && Math.abs(xDistance) <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
if (xDistance <= targetTopicSize.width / 2 && Math.abs(xDistance) <= mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
result = true;
}
}
@ -428,21 +428,21 @@ mindplot.NodeModel = new Class({
}
});
mindplot.NodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
mindplot.NodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
mindplot.NodeModel.DRAGGED_TOPIC_TYPE = 'DraggedTopic';
mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
mindplot.model.NodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
mindplot.model.NodeModel.DRAGGED_TOPIC_TYPE = 'DraggedTopic';
mindplot.NodeModel.SHAPE_TYPE_RECT = 'rectagle';
mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle';
mindplot.NodeModel.SHAPE_TYPE_ELIPSE = 'elipse';
mindplot.NodeModel.SHAPE_TYPE_LINE = 'line';
mindplot.model.NodeModel.SHAPE_TYPE_RECT = 'rectagle';
mindplot.model.NodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle';
mindplot.model.NodeModel.SHAPE_TYPE_ELIPSE = 'elipse';
mindplot.model.NodeModel.SHAPE_TYPE_LINE = 'line';
mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
mindplot.model.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
/**
* @todo: This method must be implemented.
*/
mindplot.NodeModel._nextUUID = function() {
mindplot.model.NodeModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
mindplot.NoteModel = new Class({
mindplot.model.NoteModel = new Class({
initialize : function(text, topic) {
$assert(text != null, 'note text can not be null');
$assert(topic, 'mindmap can not be null');

View File

@ -15,12 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.RelationshipModel = new Class({
mindplot.model.RelationshipModel = new Class({
initialize:function(fromNode, toNode) {
$assert(fromNode, 'from node type can not be null');
$assert(toNode, 'to node type can not be null');
this._id = mindplot.RelationshipModel._nextUUID();
this._id = mindplot.model.RelationshipModel._nextUUID();
this._fromNode = fromNode;
this._toNode = toNode;
this._lineType = mindplot.ConnectionLine.SIMPLE_CURVED;
@ -83,7 +83,7 @@ mindplot.RelationshipModel = new Class({
},
clone : function(model) {
var result = new mindplot.RelationshipModel(this._fromNode, this._toNode);
var result = new mindplot.model.RelationshipModel(this._fromNode, this._toNode);
result._id = this._id;
result._lineType = this._lineType;
result._srcCtrlPoint = this._srcCtrlPoint;
@ -102,7 +102,7 @@ mindplot.RelationshipModel = new Class({
/**
* @todo: This method must be implemented.
*/
mindplot.RelationshipModel._nextUUID = function() {
mindplot.model.RelationshipModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}

View File

@ -62,6 +62,7 @@
<includes>
<include>*.wsdl</include>
<include>*.xsd</include>
<include>*.xml</include>
</includes>
</resource>
</webResources>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>messages</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/wisemapping-security.xml
/WEB-INF/wisemapping-dao.xml
/WEB-INF/wisemapping-service.xml
/WEB-INF/wisemapping-model.xml
/WEB-INF/wisemapping-acegi-security.xml
</param-value>
</context-param>
<!--
- Loads the root application context of this web app at startup.
- The application context is then available via
- WebApplicationContextUtils.getWebApplicationContext(servletContext).
-->
<listener>
<listener-class>com.wisemapping.service.HibernateAppListener</listener-class>
</listener>
<filter>
<filter-name>charsetFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charsetFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>hibernate</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>mindmapSessionFactory</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Filter Chain Proxy</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.util.FilterChainProxy</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi Filter Chain Proxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hibernate</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>wisemapping</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/wisemapping-servlet.xml
/WEB-INF/wisemapping-captcha.xml
</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>wisemapping</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>180</session-timeout>
</session-config>
</web-app>

View File

@ -5,7 +5,7 @@
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<![endif]-->
<script type="text/javascript" src="http://docs.google.com/brix/static/api/js/jsapi.nocache.js"></script>
<!-- Internet Explorer 8 Hack -->
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<title>WiseMapping - Editor </title>
@ -16,16 +16,26 @@
<script type='text/javascript' src='../js/mootools-core-1.3.2-full-compat.js'></script>
<script type='text/javascript' src='../js/mootools-more-1.3.2.1-yui.js'></script>
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/common.js'></script>
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/windoo.js'></script>
<!--<script type='text/javascript' src='../js/common.js'></script>-->
<!--<script type='text/javascript' src='../js/windoo.js'></script>-->
<!--<script type='text/javascript' src='../js/wiseEditorLibrary.js'></script>-->
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/IconPanel.js'></script>
<script type='text/javascript' src='../../../../../wise-webapp/src/main/webapp/js/mooRainbow.js'></script>
<!--<script type='text/javascript' src='../js/IconPanel.js'></script>-->
<!--<script type='text/javascript' src='../js/mooRainbow.js'></script>-->
<script type='text/javascript' src='../../../../../core-js/target/classes/core.js'></script>
<script type='text/javascript' src='../js/core.js'></script>
<script type="text/javascript">
//Google-Brix framework load callback function
collabOnLoad = function() {
isGoogleBrix=true;
if(typeof mindplot != "undefined"){
console.log("calling");
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate();
}
};
</script>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">

View File

@ -0,0 +1,80 @@
<html>
<body>
<script type="text/javascript" src="http://docs.google.com/brix/static/api/js/jsapi.nocache.js"></script>
<script type="text/javascript">
var app;
collabOnLoad = function() {
app = new goog.collab.CollaborativeApp();
app.start();
app.addListener('modelLoad', function(model) {
var root = app.getModel().getRoot();
if (root.isEmpty()) {
root.put("a1", ' ');
root.put("a2", " ");
root.put("a3", " ");
root.put("b1", " ");
root.put("b2", " ");
root.put("b3", " ");
root.put("c1", " ");
root.put("c2", " ");
root.put("c3", " ");
root.put("turn", "X");
}
var list1 = app.getModel().create("List");
root.put("list",list1);
document.getElementById("a1").value = root.get("a1");
document.getElementById("a2").value = root.get("a2");
document.getElementById("a3").value = root.get("a3");
document.getElementById("b1").value = root.get("b1");
document.getElementById("b2").value = root.get("b2");
document.getElementById("b3").value = root.get("b3");
document.getElementById("c1").value = root.get("c1");
document.getElementById("c2").value = root.get("c2");
document.getElementById("c3").value = root.get("c3");
relabelTurn(root.get("turn"));
root.addListener('valueChanged', function(e) {
document.getElementById(e.getProperty()).value = e.getNewValue();
relabelTurn(root.get("turn"));
});
});
};
function move(square) {
app.getModel().getRoot().put(square.id, app.getModel().getRoot().get("turn"));
var turn = app.getModel().getRoot().get("turn") == "X" ? "O" : "X";
app.getModel().getRoot().put("turn", turn);
relabelTurn(app.getModel().getRoot().get("turn"));
app.getModel().getRoot().get("list").add(turn);
}
function relabelTurn(turn) {
document.getElementById("turn").innerHTML = "Next move is: " + turn;
}
</script>
<p>
TIC TAC TOE!
<p>
<span id=turn></span>
<table>
<tr>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="a1" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="b1" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="c1" onclick="move(this)"></td>
</tr>
<tr>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="a2" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="b2" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="c2" onclick="move(this)"></td>
</tr>
<tr>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="a3" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="b3" onclick="move(this)"></td>
<td><input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="c3" onclick="move(this)"></td>
</tr>
</table>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
*/
$import("../../../../../mindplot/target/classes/mindplot.svg.js");
$import("../js/mindplot.svg.js");
var designer = null;
@ -181,7 +181,7 @@ function afterMindpotLibraryLoading() {
}
var iconChooser = buildIconChooser();
iconPanel = new IconPanel({button:$('topicIcon'), onStart:cleanScreenEvent, content:iconChooser});
// iconPanel = new IconPanel({button:$('topicIcon'), onStart:cleanScreenEvent, content:iconChooser});
// Register Events ...
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
$("ffoxWorkarroundInput").addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
@ -227,7 +227,7 @@ function afterMindpotLibraryLoading() {
});
var context = this;
var colorPicker1 = new MooRainbow('topicColor', {
/*var colorPicker1 = new MooRainbow('topicColor', {
id: 'topicColor',
imgPath: '../images/',
startColor: [255, 255, 255],
@ -256,7 +256,7 @@ function afterMindpotLibraryLoading() {
onComplete: function(color) {
removeCurrentColorPicker.attempt(colorPicker2, context);
}
});
});*/
$('topicLink').addEvent('click', function(event) {
designer.addLink2SelectedNode();
@ -280,7 +280,7 @@ function afterMindpotLibraryLoading() {
designer.setStyle2SelectedNode();
});
var colorPicker3 = new MooRainbow('fontColor', {
/*var colorPicker3 = new MooRainbow('fontColor', {
id: 'fontColor',
imgPath: '../images/',
startColor: [255, 255, 255],
@ -294,7 +294,7 @@ function afterMindpotLibraryLoading() {
onComplete: function(color) {
removeCurrentColorPicker.attempt(colorPicker3, context);
}
});
});*/
// Save event handler ....
var saveButton = $('saveButton');
@ -380,7 +380,6 @@ function removeCurrentColorPicker(colorPicker) {
}
function buildMindmapDesigner() {
// Initialize message logger ...
// var monitor = new core.Monitor($('msgLoggerContainer'), $('msgLogger'));
// core.Monitor.setInstance(monitor);
@ -397,14 +396,32 @@ function buildMindmapDesigner() {
// body margin ...
editorProperties.width = screenWidth;
editorProperties.height = screenHeight;
designer = new mindplot.MindmapDesigner(editorProperties, container);
if($wise_collaborationManager.isCollaborationFrameworkAvailable()){
buildCollaborativeMindmapDesigner();
}else{
buildStandaloneMindmapDesigner();
}
}
function buildStandaloneMindmapDesigner(){
designer.loadFromXML(mapId, mapXml);
// If a node has focus, focus can be move to another node using the keys.
designer._cleanScreen = cleanScreenEvent.bind(this);
}
function buildCollaborativeMindmapDesigner(){
if($wise_collaborationManager.isCollaborativeFrameworkReady()){
designer.loadFromCollaborativeModel($wise_collaborationManager);
// If a node has focus, focus can be move to another node using the keys.
designer._cleanScreen = cleanScreenEvent.bind(this);
}else{
$wise_collaborationManager.setWiseReady(true);
}
}
function createColorPalette(container, onSelectFunction, event) {
cleanScreenEvent();
_colorPalette = new core.ColorPicker();
@ -422,13 +439,13 @@ function createColorPalette(container, onSelectFunction, event) {
;
function cleanScreenEvent() {
if (this.currentColorPicker) {
/*if (this.currentColorPicker) {
this.currentColorPicker.hide();
}
}*/
$("fontFamilyPanel").setStyle('display', "none");
$("fontSizePanel").setStyle('display', "none");
$("topicShapePanel").setStyle('display', "none");
iconPanel.close();
// iconPanel.close();
}
function fontFamilyPanel() {

File diff suppressed because it is too large Load Diff