mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Merge branch 'master' of repo.wisemapping.org:wisemapping/wiseorg
This commit is contained in:
commit
42148c0d2e
@ -5,7 +5,7 @@
|
|||||||
The following products must be installed:
|
The following products must be installed:
|
||||||
|
|
||||||
* Java Development Kit 6 or higher (http://java.sun.com/javase/downloads/index.jsp)
|
* Java Development Kit 6 or higher (http://java.sun.com/javase/downloads/index.jsp)
|
||||||
* Maven 2.2.1 or higher (http://maven.apache.org/)
|
* Maven 3.x or higher (http://maven.apache.org/)
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
@ -14,13 +14,14 @@ WiseMapping uses Maven as packaging and project management. The project is compo
|
|||||||
* core-js: Utilities JavaScript libraries
|
* core-js: Utilities JavaScript libraries
|
||||||
* web2d: JavaScript 2D VML/SVG abstraction library used by the mind map editor
|
* web2d: JavaScript 2D VML/SVG abstraction library used by the mind map editor
|
||||||
* mindplot: JavaScript mind map designer core
|
* mindplot: JavaScript mind map designer core
|
||||||
|
* wise-editor: Mindmap Editor standalone distribution
|
||||||
* wise-webapp: J2EE web application
|
* wise-webapp: J2EE web application
|
||||||
|
|
||||||
Full compilation of the project can be done executing within <project-dir>:
|
Full compilation of the project can be done executing within <project-dir>:
|
||||||
|
|
||||||
`mvn install`
|
`mvn package`
|
||||||
|
|
||||||
Once this command is execute, the file <project-dir>/wise-webapp/target/wisemapping.war will be generated.
|
Once this command is execute, the file <project-dir>/wise-webapp/target/wisemapping*.war will be generated.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
The previously generated war can be deployed locally executing within the directory <project-dir>/wise-webapp the following command:
|
The previously generated war can be deployed locally executing within the directory <project-dir>/wise-webapp the following command:
|
||||||
@ -30,5 +31,4 @@ The previously generated war can be deployed locally executing within the direct
|
|||||||
This will start the application on the URL: http://localhost:8080/wise-webapp/. Additionally, a file based database is automatically populated with a test user.
|
This will start the application on the URL: http://localhost:8080/wise-webapp/. Additionally, a file based database is automatically populated with a test user.
|
||||||
|
|
||||||
User: test@wisemapping.org
|
User: test@wisemapping.org
|
||||||
|
|
||||||
Password: test
|
Password: test
|
11
Faq.textile
11
Faq.textile
@ -1,11 +0,0 @@
|
|||||||
h1. FAQ
|
|
||||||
|
|
||||||
h2. Which technology is being used to render the mind maps?
|
|
||||||
|
|
||||||
We use SVG for Firefox and Safari, and VML for IE and Opera.
|
|
||||||
|
|
||||||
SVG (Scalable Vectorial Graphics) allows straightforward and efficient vector graphics animation and VML (Vector Markup Language) supports the markup of vector graphic information in the same way that HTML supports the markup of textual information.
|
|
||||||
|
|
||||||
h2. What's the source code License?
|
|
||||||
|
|
||||||
http://www.wisemapping.org/license
|
|
@ -16,7 +16,7 @@ The following products must be installed:
|
|||||||
|
|
||||||
WiseMapping uses Maven as packaging and project management. The project is composed of 4 maven sub-modules:
|
WiseMapping uses Maven as packaging and project management. The project is composed of 4 maven sub-modules:
|
||||||
* core-js: Utilities JavaScript libraries
|
* core-js: Utilities JavaScript libraries
|
||||||
* web2d: JavaScript 2D VML/SVG abstraction library used by the mind map editor
|
* web2d: JavaScript 2D SVG abstraction library used by the mind map editor
|
||||||
* mindplot: JavaScript mind map designer core
|
* mindplot: JavaScript mind map designer core
|
||||||
* wise-webapp: J2EE web application
|
* wise-webapp: J2EE web application
|
||||||
|
|
||||||
|
@ -138,111 +138,4 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) {
|
|||||||
var y2 = m * (x2 - tarPos.x) + tarPos.y;
|
var y2 = m * (x2 - tarPos.x) + tarPos.y;
|
||||||
|
|
||||||
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
||||||
};
|
|
||||||
|
|
||||||
core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn) {
|
|
||||||
core.Utils.animateVisibility(elems, isVisible, doneFn);
|
|
||||||
};
|
|
||||||
|
|
||||||
core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible) {
|
|
||||||
var children = core.Utils._addInnerChildrens(rootElem);
|
|
||||||
core.Utils.animateVisibility(children, isVisible);
|
|
||||||
};
|
|
||||||
|
|
||||||
core.Utils.animateVisibility = function (elems, isVisible, doneFn) {
|
|
||||||
var _fadeEffect = null;
|
|
||||||
var _opacity = (isVisible ? 0 : 1);
|
|
||||||
if (isVisible) {
|
|
||||||
elems.forEach(function(child, index) {
|
|
||||||
if ($defined(child)) {
|
|
||||||
child.setOpacity(_opacity);
|
|
||||||
child.setVisibility(isVisible);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var fadeEffect = function(index) {
|
|
||||||
var step = 10;
|
|
||||||
if ((_opacity <= 0 && !isVisible) || (_opacity >= 1 && isVisible)) {
|
|
||||||
$clear(_fadeEffect);
|
|
||||||
_fadeEffect = null;
|
|
||||||
elems.forEach(function(child, index) {
|
|
||||||
if ($defined(child)) {
|
|
||||||
child.setVisibility(isVisible);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
if ($defined(doneFn))
|
|
||||||
doneFn.attempt();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var fix = 1;
|
|
||||||
if (isVisible) {
|
|
||||||
fix = -1;
|
|
||||||
}
|
|
||||||
_opacity -= (1 / step) * fix;
|
|
||||||
elems.forEach(function(child, index) {
|
|
||||||
if ($defined(child)) {
|
|
||||||
child.setOpacity(_opacity);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
_fadeEffect = fadeEffect.periodical(10);
|
|
||||||
};
|
|
||||||
|
|
||||||
core.Utils.animatePosition = function (elems, doneFn, designer) {
|
|
||||||
var _moveEffect = null;
|
|
||||||
var i = 10;
|
|
||||||
var step = 10;
|
|
||||||
var moveEffect = function () {
|
|
||||||
if (i > 0) {
|
|
||||||
var keys = elems.keys();
|
|
||||||
for (var j = 0; j < keys.length; j++) {
|
|
||||||
var id = keys[j];
|
|
||||||
var mod = elems.get(id);
|
|
||||||
var allTopics = designer.getModel().getTopics();
|
|
||||||
var currentTopic = allTopics.filter(function(node) {
|
|
||||||
return node.getId() == id;
|
|
||||||
})[0];
|
|
||||||
var xStep = (mod.originalPos.x - mod.newPos.x) / step;
|
|
||||||
var yStep = (mod.originalPos.y - mod.newPos.y) / step;
|
|
||||||
var newPos = currentTopic.getPosition().clone();
|
|
||||||
newPos.x += xStep;
|
|
||||||
newPos.y += yStep;
|
|
||||||
currentTopic.setPosition(newPos, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$clear(_moveEffect);
|
|
||||||
var keys = elems.keys();
|
|
||||||
for (var j = 0; j < keys.length; j++) {
|
|
||||||
var id = keys[j];
|
|
||||||
var mod = elems.get(id);
|
|
||||||
var allTopics = designer.getModel().getTopics();
|
|
||||||
var currentTopic = allTopics.filter(function(node) {
|
|
||||||
return node.getId() == id;
|
|
||||||
})[0];
|
|
||||||
currentTopic.setPosition(mod.originalPos, false);
|
|
||||||
}
|
|
||||||
if ($defined(doneFn))
|
|
||||||
doneFn.attempt();
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
};
|
|
||||||
_moveEffect = moveEffect.periodical(10);
|
|
||||||
};
|
|
||||||
|
|
||||||
core.Utils._addInnerChildrens = function(elem) {
|
|
||||||
var children = [];
|
|
||||||
var childs = elem._getChildren();
|
|
||||||
for (var i = 0; i < childs.length; i++) {
|
|
||||||
var child = childs[i];
|
|
||||||
children.push(child);
|
|
||||||
children.push(child.getOutgoingLine());
|
|
||||||
var relationships = child.getRelationships();
|
|
||||||
children = children.concat(relationships);
|
|
||||||
var innerChilds = core.Utils._addInnerChildrens(child);
|
|
||||||
children = children.concat(innerChilds);
|
|
||||||
}
|
|
||||||
return children;
|
|
||||||
};
|
};
|
@ -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"/>
|
||||||
@ -81,20 +81,23 @@
|
|||||||
<!--<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>-->
|
<!--<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>-->
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="ModelCodeName.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="util/FadeEffect.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="XMLMindmapSerializer_Pela.js"/>
|
files="persistence/ModelCodeName.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="XMLMindmapSerializer_Tango.js"/>
|
files="persistence/XMLSerializer_Pela.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="Pela2TangoMigrator.js"/>
|
files="persistence/XMLSerializer_Tango.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="XMLMindmapSerializer_Beta.js"/>
|
files="persistence/Pela2TangoMigrator.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.js"/>
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="XMLMindmapSerializerFactory.js"/>
|
files="persistence/XMLSerializer_Beta.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
|
files="persistence/Beta2PelaMigrator.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
|
files="persistence/XMLSerializerFactory.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="RestPersistenceManager.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
|
||||||
@ -104,6 +107,7 @@
|
|||||||
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="ActionIcon.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="ImageIcon.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/" files="model/FeatureModel.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="model/IconModel.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/LinkModel.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/>
|
||||||
@ -113,7 +117,7 @@
|
|||||||
<filelist dir="${basedir}/src/main/javascript/" files="ControlPoint.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="ControlPoint.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="EditorOptions.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="EditorOptions.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/" files="RelationshipPivot.js"/>
|
<filelist dir="${basedir}/src/main/javascript/" files="RelationshipPivot.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/" files="TopicFeature.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/commands/"
|
<filelist dir="${basedir}/src/main/javascript/commands/"
|
||||||
files="GenericFunctionCommand.js"/>
|
files="GenericFunctionCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/commands/" files="DeleteCommand.js"/>
|
<filelist dir="${basedir}/src/main/javascript/commands/" files="DeleteCommand.js"/>
|
||||||
@ -122,17 +126,11 @@
|
|||||||
<filelist dir="${basedir}/src/main/javascript/commands/"
|
<filelist dir="${basedir}/src/main/javascript/commands/"
|
||||||
files="AddTopicCommand.js"/>
|
files="AddTopicCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="commands/ChangeLinkToTopicCommand.js"/>
|
files="commands/ChangeFeatureToTopicCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="commands/RemoveLinkFromTopicCommand.js"/>
|
files="commands/RemoveFeatureFromTopicCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="commands/AddIconToTopicCommand.js"/>
|
files="commands/AddFeatureToTopicCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
|
||||||
files="commands/RemoveIconFromTopicCommand.js"/>
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
|
||||||
files="commands/ChangeNoteToTopicCommand.js"/>
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
|
||||||
files="commands/RemoveNoteFromTopicCommand.js"/>
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="commands/AddRelationshipCommand.js"/>
|
files="commands/AddRelationshipCommand.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
@ -166,6 +164,7 @@
|
|||||||
files="widget/IMenu.js"/>
|
files="widget/IMenu.js"/>
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="widget/Menu.js"/>
|
files="widget/Menu.js"/>
|
||||||
|
<filelist dir="${basedir}/src/main/javascript/" files="TopicFeature.js"/>
|
||||||
|
|
||||||
<filelist dir="${basedir}/src/main/javascript/"
|
<filelist dir="${basedir}/src/main/javascript/"
|
||||||
files="layout/EventBusDispatcher.js"/>
|
files="layout/EventBusDispatcher.js"/>
|
||||||
@ -245,23 +244,7 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- <plugin>
|
|
||||||
<groupId>com.google.jstestdriver</groupId>
|
|
||||||
<artifactId>maven-jstestdriver-plugin</artifactId>
|
|
||||||
<version>1.2.2-SNAPSHOT</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>run-tests</id>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<config>${basedir}/src/test/jsTestDriver.conf</config>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin> -->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -23,18 +23,6 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
$assert(commandContext, "commandContext can not be null");
|
$assert(commandContext, "commandContext can not be null");
|
||||||
},
|
},
|
||||||
|
|
||||||
addIconToTopic: function(topicId, iconType) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
changeLinkToTopic: function(topicId, url) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
changeNoteToTopic: function(topicId, text) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
connectByRelation: function(model, mindmap) {
|
connectByRelation: function(model, mindmap) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
@ -59,18 +47,6 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
removeIconFromTopic: function(topicId, iconModel) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
removeLinkFromTopic: function(topicId) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
removeNoteFromTopic: function(topicId) {
|
|
||||||
throw "method must be implemented.";
|
|
||||||
},
|
|
||||||
|
|
||||||
changeFontFamilyToTopic: function(topicIds, fontFamily) {
|
changeFontFamilyToTopic: function(topicIds, fontFamily) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
@ -109,9 +85,19 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
|
|
||||||
shrinkBranch : function(topicsIds, collapse) {
|
shrinkBranch : function(topicsIds, collapse) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
|
},
|
||||||
|
|
||||||
|
addFeatureToTopic : function(topicId, type, attributes) {
|
||||||
|
throw "method must be implemented.";
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFeatureToTopic : function(topicId, featureId, attributes) {
|
||||||
|
throw "method must be implemented.";
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFeatureFromTopic : function(topicId, featureId) {
|
||||||
|
throw "method must be implemented.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.ActionDispatcher.setInstance = function(dispatcher) {
|
mindplot.ActionDispatcher.setInstance = function(dispatcher) {
|
||||||
|
@ -55,7 +55,7 @@ mindplot.CentralTopic = new Class({
|
|||||||
|
|
||||||
|
|
||||||
_defaultShapeType : function() {
|
_defaultShapeType : function() {
|
||||||
return mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT;
|
return mindplot.model.TopicShape.ROUNDED_RECT;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -90,5 +90,9 @@ mindplot.CentralTopic = new Class({
|
|||||||
weight:"bold",
|
weight:"bold",
|
||||||
color:"#ffffff"
|
color:"#ffffff"
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
getShrinkConnector : function() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -34,7 +34,7 @@ mindplot.BrixActionDispatcher = new Class({
|
|||||||
// Set position ...
|
// Set position ...
|
||||||
node.setPosition(position);
|
node.setPosition(position);
|
||||||
} else {
|
} else {
|
||||||
$assert("Illegal commnad state exception.");
|
$assert("Illegal commnand state exception.");
|
||||||
}
|
}
|
||||||
// Finally, connect node ...
|
// Finally, connect node ...
|
||||||
if ($defined(this._parentId)) {
|
if ($defined(this._parentId)) {
|
@ -22,14 +22,17 @@ mindplot.Command = new Class(
|
|||||||
{
|
{
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext)
|
execute: function(commandContext)
|
||||||
{
|
{
|
||||||
throw "execute must be implemented.";
|
throw "execute must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext)
|
undoExecute: function(commandContext)
|
||||||
{
|
{
|
||||||
throw "undo must be implemented.";
|
throw "undo must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
getId:function()
|
getId:function()
|
||||||
{
|
{
|
||||||
return this._id;
|
return this._id;
|
||||||
|
@ -123,7 +123,7 @@ mindplot.ConnectionLine = new Class({
|
|||||||
var offset = mindplot.Topic.CONNECTOR_WIDTH / 2;
|
var offset = mindplot.Topic.CONNECTOR_WIDTH / 2;
|
||||||
var targetTopicSize = targetTopic.getSize();
|
var targetTopicSize = targetTopic.getSize();
|
||||||
var y;
|
var y;
|
||||||
if (targetTopic.getShapeType() == mindplot.model.INodeModel.SHAPE_TYPE_LINE) {
|
if (targetTopic.getShapeType() == mindplot.model.TopicShape.LINE) {
|
||||||
y = targetTopicSize.height;
|
y = targetTopicSize.height;
|
||||||
} else {
|
} else {
|
||||||
y = targetTopicSize.height / 2;
|
y = targetTopicSize.height / 2;
|
||||||
@ -131,13 +131,15 @@ mindplot.ConnectionLine = new Class({
|
|||||||
y = y - offset;
|
y = y - offset;
|
||||||
|
|
||||||
var connector = targetTopic.getShrinkConnector();
|
var connector = targetTopic.getShrinkConnector();
|
||||||
if (Math.sign(targetPosition.x) > 0) {
|
if ($defined(connector)) {
|
||||||
var x = targetTopicSize.width;
|
if (Math.sign(targetPosition.x) > 0) {
|
||||||
connector.setPosition(x, y);
|
var x = targetTopicSize.width;
|
||||||
}
|
connector.setPosition(x, y);
|
||||||
else {
|
}
|
||||||
var x = -mindplot.Topic.CONNECTOR_WIDTH;
|
else {
|
||||||
connector.setPosition(x, y);
|
var x = -mindplot.Topic.CONNECTOR_WIDTH;
|
||||||
|
connector.setPosition(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -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() {
|
||||||
@ -160,6 +161,7 @@ mindplot.Designer = new Class({
|
|||||||
this._workspace.setZoom(model.getZoom(), true);
|
this._workspace.setZoom(model.getZoom(), true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_buildNodeGraph : function(model, readOnly) {
|
_buildNodeGraph : function(model, readOnly) {
|
||||||
var workspace = this._workspace;
|
var workspace = this._workspace;
|
||||||
|
|
||||||
@ -340,6 +342,30 @@ mindplot.Designer = new Class({
|
|||||||
return childModel;
|
return childModel;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addDraggedNode: function(event, options) {
|
||||||
|
$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);
|
||||||
|
|
||||||
|
// Position far from the visual area ...
|
||||||
|
model.setPosition(1000, 1000);
|
||||||
|
|
||||||
|
this._actionDispatcher.addTopic(model, null, false);
|
||||||
|
var topic = this.getModel().findTopicById(model.getId());
|
||||||
|
|
||||||
|
// Simulate a mouse down event to start the dragging ...
|
||||||
|
topic.fireEvent("mousedown", event);
|
||||||
|
},
|
||||||
|
|
||||||
createSiblingForSelectedNode : function() {
|
createSiblingForSelectedNode : function() {
|
||||||
var nodes = this.getModel().filterSelectedTopics();
|
var nodes = this.getModel().filterSelectedTopics();
|
||||||
if (nodes.length <= 0) {
|
if (nodes.length <= 0) {
|
||||||
@ -422,7 +448,7 @@ mindplot.Designer = new Class({
|
|||||||
$assert(mindmapModel, "mindmapModel can not be null");
|
$assert(mindmapModel, "mindmapModel can not be null");
|
||||||
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);
|
||||||
@ -446,7 +472,6 @@ mindplot.Designer = new Class({
|
|||||||
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]);
|
||||||
@ -460,9 +485,9 @@ mindplot.Designer = new Class({
|
|||||||
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);
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
getMindmap : function() {
|
getMindmap : function() {
|
||||||
@ -596,8 +621,8 @@ mindplot.Designer = new Class({
|
|||||||
node.disconnect(this._workspace);
|
node.disconnect(this._workspace);
|
||||||
|
|
||||||
//remove children
|
//remove children
|
||||||
while (node._getChildren().length > 0) {
|
while (node.getChildren().length > 0) {
|
||||||
this._removeNode(node._getChildren()[0]);
|
this._removeNode(node.getChildren()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._workspace.removeChild(node);
|
this._workspace.removeChild(node);
|
||||||
@ -657,7 +682,7 @@ mindplot.Designer = new Class({
|
|||||||
changeBackgroundColor : function(color) {
|
changeBackgroundColor : function(color) {
|
||||||
|
|
||||||
var validateFunc = function(topic) {
|
var validateFunc = function(topic) {
|
||||||
return topic.getShapeType() != mindplot.model.INodeModel.SHAPE_TYPE_LINE
|
return topic.getShapeType() != mindplot.model.TopicShape.LINE;
|
||||||
};
|
};
|
||||||
var validateError = 'Color can not be set to line topics.';
|
var validateError = 'Color can not be set to line topics.';
|
||||||
|
|
||||||
@ -669,7 +694,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
changeBorderColor : function(color) {
|
changeBorderColor : function(color) {
|
||||||
var validateFunc = function(topic) {
|
var validateFunc = function(topic) {
|
||||||
return topic.getShapeType() != mindplot.model.INodeModel.SHAPE_TYPE_LINE
|
return topic.getShapeType() != mindplot.model.TopicShape.LINE;
|
||||||
};
|
};
|
||||||
var validateError = 'Color can not be set to line topics.';
|
var validateError = 'Color can not be set to line topics.';
|
||||||
var topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError);
|
var topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError);
|
||||||
@ -687,7 +712,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
changeTopicShape : function(shape) {
|
changeTopicShape : function(shape) {
|
||||||
var validateFunc = function(topic) {
|
var validateFunc = function(topic) {
|
||||||
return !(topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.INodeModel.SHAPE_TYPE_LINE)
|
return !(topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.TopicShape.LINE)
|
||||||
};
|
};
|
||||||
|
|
||||||
var validateError = 'Central Topic shape can not be changed to line figure.';
|
var validateError = 'Central Topic shape can not be changed to line figure.';
|
||||||
@ -707,7 +732,7 @@ mindplot.Designer = new Class({
|
|||||||
addIconType : function(iconType) {
|
addIconType : function(iconType) {
|
||||||
var topicsIds = this.getModel().filterTopicsIds();
|
var topicsIds = this.getModel().filterTopicsIds();
|
||||||
if (topicsIds.length > 0) {
|
if (topicsIds.length > 0) {
|
||||||
this._actionDispatcher.addIconToTopic(topicsIds[0], iconType);
|
this._actionDispatcher.addFeatureToTopic(topicsIds[0], mindplot.TopicFeature.Icon.id, {id:iconType});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
|
|
||||||
var regex = /^(?:shift|control|ctrl|alt|meta)$/;
|
var regex = /^(?:shift|control|ctrl|alt|meta)$/;
|
||||||
var modifiers = ['shift', 'control', 'alt', 'meta'];
|
var modifiers = ['shift', 'control', 'alt', 'meta'];
|
||||||
var excludes = ['esc','capslock','tab','f1','f3','f4','f5','f6','f7','f8','f9','f10','f11','f12','backspace','down','up','left','right'];
|
var excludes = ['esc','capslock','tab','f1','f3','f4','f5','f6','f7','f8','f9','f10','f11','f12','backspace','down','up','left','right','control'];
|
||||||
|
|
||||||
$(document).addEvent('keydown', function(event) {
|
$(document).addEvent('keydown', function(event) {
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_goToBrother : function(designer, node, direction) {
|
_goToBrother : function(designer, node, direction) {
|
||||||
var brothers = node._parent._getChildren();
|
var brothers = node._parent.getChildren();
|
||||||
var target = node;
|
var target = node;
|
||||||
var y = node.getPosition().y;
|
var y = node.getPosition().y;
|
||||||
var x = node.getPosition().x;
|
var x = node.getPosition().x;
|
||||||
@ -280,7 +280,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
|
|
||||||
|
|
||||||
_goToSideChild : function(designer, node, side) {
|
_goToSideChild : function(designer, node, side) {
|
||||||
var children = node._getChildren();
|
var children = node.getChildren();
|
||||||
if (children.length > 0) {
|
if (children.length > 0) {
|
||||||
var target = children[0];
|
var target = children[0];
|
||||||
var top = null;
|
var top = null;
|
||||||
@ -311,7 +311,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_goToChild : function(designer, node) {
|
_goToChild : function(designer, node) {
|
||||||
var children = node._getChildren();
|
var children = node.getChildren();
|
||||||
if (children.length > 0) {
|
if (children.length > 0) {
|
||||||
var target = children[0];
|
var target = children[0];
|
||||||
var top = target.getPosition().y;
|
var top = target.getPosition().y;
|
||||||
|
@ -81,8 +81,8 @@ mindplot.DragConnector = new Class({
|
|||||||
var targetPosition = targetTopic.getPosition();
|
var targetPosition = targetTopic.getPosition();
|
||||||
var fix = position.y > targetPosition.y;
|
var fix = position.y > targetPosition.y;
|
||||||
var gap = 0;
|
var gap = 0;
|
||||||
if (targetTopic._getChildren().length > 0) {
|
if (targetTopic.getChildren().length > 0) {
|
||||||
gap = Math.abs(targetPosition.y - targetTopic._getChildren()[0].getPosition().y)
|
gap = Math.abs(targetPosition.y - targetTopic.getChildren()[0].getPosition().y)
|
||||||
}
|
}
|
||||||
var yDistance = Math.abs(position.y - fix * gap - targetPosition.y);
|
var yDistance = Math.abs(position.y - fix * gap - targetPosition.y);
|
||||||
if (distance == null || yDistance < distance) {
|
if (distance == null || yDistance < distance) {
|
||||||
|
@ -110,7 +110,7 @@ mindplot.DragTopic = new Class({
|
|||||||
var targetTopicModel = targetTopic.getModel();
|
var targetTopicModel = targetTopic.getModel();
|
||||||
var childTopicModel = draggedNode.getModel();
|
var childTopicModel = draggedNode.getModel();
|
||||||
|
|
||||||
result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, 18);
|
result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, 18, targetTopic.getSize());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = false;
|
result = false;
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.DwrPersitenceManager = new Class({
|
|
||||||
Extends:mindplot.PersistenceManager,
|
|
||||||
initialize: function() {
|
|
||||||
this.parent();
|
|
||||||
},
|
|
||||||
|
|
||||||
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
|
||||||
window.MapEditorService.saveMap(mapId, mapXml, pref, saveHistory, {
|
|
||||||
callback:function(response) {
|
|
||||||
if (response.msgCode != "OK") {
|
|
||||||
events.onError(response);
|
|
||||||
} else {
|
|
||||||
events.onSuccess(response);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
errorHandler:function(message) {
|
|
||||||
events.onError(message);
|
|
||||||
},
|
|
||||||
verb:"POST",
|
|
||||||
async: true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
|
|
||||||
loadMapDom : function(mapId) {
|
|
||||||
$assert(mapId, "mapId can not be null");
|
|
||||||
throw "This must be implemented";
|
|
||||||
|
|
||||||
// var result = {r:null};
|
|
||||||
// window.MapEditorService.loadMap(mapId, {
|
|
||||||
// callback:function(response) {
|
|
||||||
//
|
|
||||||
// if (response.msgCode == "OK") {
|
|
||||||
// // Explorer Hack with local files ...
|
|
||||||
// var xmlContent = response.content;
|
|
||||||
// var domDocument = core.Utils.createDocumentFromText(xmlContent);
|
|
||||||
// var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
|
||||||
// var mindmap = serializer.loadFromDom(domDocument);
|
|
||||||
// mindmap.setId(mapId);
|
|
||||||
//
|
|
||||||
// result.r = mindmap;
|
|
||||||
// } else {
|
|
||||||
// // Handle error message ...
|
|
||||||
// var msg = response.msgDetails;
|
|
||||||
// var monitor = core.ToolbarNotifier.getInstance();
|
|
||||||
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
|
||||||
//// wLogger.error(msg);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// verb:"GET",
|
|
||||||
// async: false,
|
|
||||||
// errorHandler:function(msg) {
|
|
||||||
// var monitor = core.ToolbarNotifier.getInstance();
|
|
||||||
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
|
|
||||||
//// wLogger.error(msg);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return result.r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@ -70,23 +70,12 @@ mindplot.IconGroup = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_findIconFromUrl : function(url) {
|
|
||||||
var result = null;
|
|
||||||
this._icons.each(function(el) {
|
|
||||||
var nativeImage = el.getImage();
|
|
||||||
if (nativeImage.getHref() == url) {
|
|
||||||
result = el;
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
|
|
||||||
_findIconFromModel : function(iconModel) {
|
_findIconFromModel : function(iconModel) {
|
||||||
var result = null;
|
var result = null;
|
||||||
this._icons.each(function(el) {
|
this._icons.each(function(icon) {
|
||||||
var elModel = el.getModel();
|
var elModel = icon.getModel();
|
||||||
if (result == null && $defined(elModel.isIconModel) && elModel.getId() == iconModel.getId()) {
|
if (elModel.getId() == iconModel.getId()) {
|
||||||
result = el;
|
result = icon;
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
@ -97,16 +86,10 @@ mindplot.IconGroup = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeIconByUrl : function(url) {
|
removeIconByModel : function(featureModel) {
|
||||||
var icon = this._findIconFromUrl(url);
|
$assert(featureModel, "featureModel can not be null");
|
||||||
$assert(icon, 'icon could not be found');
|
|
||||||
this._removeIcon(icon);
|
|
||||||
},
|
|
||||||
|
|
||||||
removeIcon : function(iconModel) {
|
var icon = this._findIconFromModel(featureModel);
|
||||||
$assert(iconModel, "iconModel can not be null");
|
|
||||||
|
|
||||||
var icon = this._findIconFromModel(iconModel);
|
|
||||||
this._removeIcon(icon);
|
this._removeIcon(icon);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -215,7 +198,6 @@ mindplot.IconGroup.RemoveTip = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this._activeIcon) {
|
if (this._activeIcon) {
|
||||||
var icon = this._activeIcon;
|
|
||||||
var widget = this._widget;
|
var widget = this._widget;
|
||||||
var close = function() {
|
var close = function() {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ mindplot.ImageIcon = new Class({
|
|||||||
$assert(topic, 'topic can not be null');
|
$assert(topic, 'topic can not be null');
|
||||||
|
|
||||||
this._topicId = topic.getId();
|
this._topicId = topic.getId();
|
||||||
this._iconModel = iconModel;
|
this._featureModel = iconModel;
|
||||||
|
|
||||||
// @Todo: Read only must be a property ...
|
// @Todo: Read only must be a property ...
|
||||||
this._readOnly = designer._readOnly;
|
this._readOnly = designer._readOnly;
|
||||||
@ -53,11 +53,11 @@ mindplot.ImageIcon = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getImageUrl : function(iconId) {
|
_getImageUrl : function(iconId) {
|
||||||
return "../icons/" + iconId + ".png";
|
return "icons/" + iconId + ".png";
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel : function() {
|
getModel : function() {
|
||||||
return this._iconModel;
|
return this._featureModel;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getNextFamilyIconId : function(iconId) {
|
_getNextFamilyIconId : function(iconId) {
|
||||||
@ -98,21 +98,39 @@ mindplot.ImageIcon = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
getId : function() {
|
|
||||||
return this._iconType;
|
|
||||||
},
|
|
||||||
|
|
||||||
getUiId : function() {
|
|
||||||
return this._uiId;
|
|
||||||
},
|
|
||||||
|
|
||||||
remove : function() {
|
remove : function() {
|
||||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||||
actionDispatcher.removeIconFromTopic(this._topicId, this._iconModel);
|
var featureId = this._featureModel.getId();
|
||||||
|
var topicId = this._topicId;
|
||||||
|
actionDispatcher.removeFeatureFromTopic(topicId, featureId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
mindplot.ImageIcon.prototype.ICON_FAMILIES = [{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},{"id": "tick", "icons" : ["tick_tick","tick_cross"]},{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]},{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]}];
|
mindplot.ImageIcon.prototype.ICON_FAMILIES = [
|
||||||
|
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},
|
||||||
|
{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},
|
||||||
|
{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},
|
||||||
|
{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},
|
||||||
|
{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},
|
||||||
|
{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},
|
||||||
|
{"id": "tick", "icons" : ["tick_tick","tick_cross"]},
|
||||||
|
{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},
|
||||||
|
{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},
|
||||||
|
{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},
|
||||||
|
{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},
|
||||||
|
{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},
|
||||||
|
{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},
|
||||||
|
{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},
|
||||||
|
{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},
|
||||||
|
{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},
|
||||||
|
{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},
|
||||||
|
{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},
|
||||||
|
{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},
|
||||||
|
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},
|
||||||
|
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},
|
||||||
|
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]},
|
||||||
|
{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +52,6 @@ mindplot.LinkIcon = new Class({
|
|||||||
actionDispatcher.removeLinkFromTopic(this._topic.getId());
|
actionDispatcher.removeLinkFromTopic(this._topic.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mindplot.LinkIcon.IMAGE_URL = "../images/links.png";
|
mindplot.LinkIcon.IMAGE_URL = "images/links.png";
|
||||||
|
|
||||||
|
|
@ -27,12 +27,16 @@ mindplot.LocalStorageManager = new Class({
|
|||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
discard : function(mapId) {
|
||||||
|
localStorage.removeItem(mapId + "-xml");
|
||||||
|
},
|
||||||
|
|
||||||
loadMapDom : function(mapId) {
|
loadMapDom : function(mapId) {
|
||||||
var xml = localStorage.getItem(mapId + "-xml");
|
var xml = localStorage.getItem(mapId + "-xml");
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
// Let's try to open one from the local directory ...
|
// Let's try to open one from the local directory ...
|
||||||
var xmlRequest = new Request({
|
var xmlRequest = new Request({
|
||||||
url: '../samples/' + mapId + '.xml',
|
url: 'samples/' + mapId + '.xml',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
async: false,
|
async: false,
|
||||||
onSuccess: function(responseText) {
|
onSuccess: function(responseText) {
|
||||||
|
@ -25,7 +25,7 @@ mindplot.MainTopic = new Class({
|
|||||||
INNER_RECT_ATTRIBUTES : {stroke:'0.5 solid #009900'},
|
INNER_RECT_ATTRIBUTES : {stroke:'0.5 solid #009900'},
|
||||||
|
|
||||||
_buildDragShape : function() {
|
_buildDragShape : function() {
|
||||||
var innerShape = this.buildShape(this.INNER_RECT_ATTRIBUTES);
|
var innerShape = this._buildShape(this.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
innerShape.setSize(size.width, size.height);
|
innerShape.setSize(size.width, size.height);
|
||||||
innerShape.setPosition(0, 0);
|
innerShape.setPosition(0, 0);
|
||||||
@ -45,18 +45,19 @@ mindplot.MainTopic = new Class({
|
|||||||
group.appendChild(innerShape);
|
group.appendChild(innerShape);
|
||||||
|
|
||||||
// Add Text ...
|
// Add Text ...
|
||||||
var textShape = this._buildTextShape(true);
|
if (this.getShapeType() != mindplot.model.TopicShape.IMAGE) {
|
||||||
var text = this.getText();
|
var textShape = this._buildTextShape(true);
|
||||||
textShape.setText(text);
|
var text = this.getText();
|
||||||
textShape.setOpacity(0.5);
|
textShape.setText(text);
|
||||||
group.appendChild(textShape);
|
textShape.setOpacity(0.5);
|
||||||
|
group.appendChild(textShape);
|
||||||
|
}
|
||||||
return group;
|
return group;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_defaultShapeType : function() {
|
_defaultShapeType : function() {
|
||||||
return mindplot.model.INodeModel.SHAPE_TYPE_LINE;
|
return mindplot.model.TopicShape.LINE;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTopicShape : function(targetTopic, workspace) {
|
updateTopicShape : function(targetTopic, workspace) {
|
||||||
@ -81,7 +82,7 @@ mindplot.MainTopic = new Class({
|
|||||||
if (!$defined(shapeType)) {
|
if (!$defined(shapeType)) {
|
||||||
// Change figure ...
|
// Change figure ...
|
||||||
shapeType = this.getShapeType();
|
shapeType = this.getShapeType();
|
||||||
this._setShapeType(mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT, false);
|
this._setShapeType(mindplot.model.TopicShape.ROUNDED_RECT, false);
|
||||||
}
|
}
|
||||||
var innerShape = this.getInnerShape();
|
var innerShape = this.getInnerShape();
|
||||||
innerShape.setVisibility(true);
|
innerShape.setVisibility(true);
|
||||||
@ -112,7 +113,7 @@ mindplot.MainTopic = new Class({
|
|||||||
|
|
||||||
var isAtRight = mindplot.util.Shape.isAtRight(sourcePosition, pos);
|
var isAtRight = mindplot.util.Shape.isAtRight(sourcePosition, pos);
|
||||||
var result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight);
|
var result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight);
|
||||||
if (this.getShapeType() == mindplot.model.INodeModel.SHAPE_TYPE_LINE) {
|
if (this.getShapeType() == mindplot.model.TopicShape.LINE) {
|
||||||
result.y = result.y + (this.getSize().height / 2);
|
result.y = result.y + (this.getSize().height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,14 +134,15 @@ mindplot.MainTopic = new Class({
|
|||||||
workoutOutgoingConnectionPoint : function(targetPosition) {
|
workoutOutgoingConnectionPoint : function(targetPosition) {
|
||||||
$assert(targetPosition, 'targetPoint can not be null');
|
$assert(targetPosition, 'targetPoint can not be null');
|
||||||
var pos = this.getPosition();
|
var pos = this.getPosition();
|
||||||
|
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||||
|
var size = this.getSize();
|
||||||
|
|
||||||
var result;
|
var result;
|
||||||
if (this.getShapeType() == mindplot.model.INodeModel.SHAPE_TYPE_LINE) {
|
if (this.getShapeType() == mindplot.model.TopicShape.LINE) {
|
||||||
|
|
||||||
result = new core.Point();
|
result = new core.Point();
|
||||||
var groupPosition = this._elem2d.getPosition();
|
var groupPosition = this._elem2d.getPosition();
|
||||||
var innerShareSize = this.getInnerShape().getSize();
|
var innerShareSize = this.getInnerShape().getSize();
|
||||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
|
||||||
|
|
||||||
if (innerShareSize) {
|
if (innerShareSize) {
|
||||||
var magicCorrectionNumber = 0.3;
|
var magicCorrectionNumber = 0.3;
|
||||||
@ -153,7 +155,6 @@ mindplot.MainTopic = new Class({
|
|||||||
} else {
|
} else {
|
||||||
// Hack: When the size has not being defined. This is because the node has not being added.
|
// Hack: When the size has not being defined. This is because the node has not being added.
|
||||||
// Try to do our best ...
|
// Try to do our best ...
|
||||||
var size = this.getSize();
|
|
||||||
if (!isAtRight) {
|
if (!isAtRight) {
|
||||||
result.x = pos.x + (size.width / 2);
|
result.x = pos.x + (size.width / 2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,6 +25,7 @@ mindplot.NodeGraph = new Class({
|
|||||||
this.setModel(nodeModel);
|
this.setModel(nodeModel);
|
||||||
this._onFocus = false;
|
this._onFocus = false;
|
||||||
this._event = new Events();
|
this._event = new Events();
|
||||||
|
this._size = {width:50,height:20};
|
||||||
},
|
},
|
||||||
|
|
||||||
getType : function() {
|
getType : function() {
|
||||||
@ -73,11 +74,12 @@ mindplot.NodeGraph = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSize : function() {
|
getSize : function() {
|
||||||
return this._model.getSize();
|
return this._size;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize : function(size) {
|
setSize : function(size) {
|
||||||
this._model.setSize(parseInt(size.width), parseInt(size.height));
|
this._size.width = parseInt(size.width);
|
||||||
|
this._size.height = parseInt(size.height);
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel:function() {
|
getModel:function() {
|
||||||
|
@ -83,5 +83,5 @@ mindplot.NoteIcon = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.NoteIcon.IMAGE_URL = "../images/notes.png";
|
mindplot.NoteIcon.IMAGE_URL = "images/notes.png";
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ mindplot.PersistenceManager = new Class({
|
|||||||
var mapId = mindmap.getId();
|
var mapId = mindmap.getId();
|
||||||
$assert(mapId, "mapId can not be null");
|
$assert(mapId, "mapId can not be null");
|
||||||
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap(mindmap);
|
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromMindmap(mindmap);
|
||||||
var domMap = serializer.toXML(mindmap);
|
var domMap = serializer.toXML(mindmap);
|
||||||
var mapXml = core.Utils.innerXML(domMap);
|
var mapXml = core.Utils.innerXML(domMap);
|
||||||
|
|
||||||
@ -47,6 +47,10 @@ mindplot.PersistenceManager = new Class({
|
|||||||
return this.loadFromDom(mapId, domDocument);
|
return this.loadFromDom(mapId, domDocument);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
discard: function(mapId) {
|
||||||
|
throw "Method must be implemented";
|
||||||
|
},
|
||||||
|
|
||||||
loadMapDom: function(mapId) {
|
loadMapDom: function(mapId) {
|
||||||
throw "Method must be implemented";
|
throw "Method must be implemented";
|
||||||
},
|
},
|
||||||
@ -59,7 +63,7 @@ mindplot.PersistenceManager = new Class({
|
|||||||
$assert(mapId, "mapId can not be null");
|
$assert(mapId, "mapId can not be null");
|
||||||
$assert(mapDom, "mapDom can not be null");
|
$assert(mapDom, "mapDom can not be null");
|
||||||
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(mapDom);
|
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(mapDom);
|
||||||
return serializer.loadFromDom(mapDom, mapId);
|
return serializer.loadFromDom(mapDom, mapId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
57
mindplot/src/main/javascript/RestPersistenceManager.js
Normal file
57
mindplot/src/main/javascript/RestPersistenceManager.js
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* 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.RESTPersistenceManager = new Class({
|
||||||
|
Extends:mindplot.PersistenceManager,
|
||||||
|
initialize: function(saveUrl) {
|
||||||
|
this.parent();
|
||||||
|
$assert(saveUrl, "saveUrl can not be null");
|
||||||
|
this.saveUrl = saveUrl;
|
||||||
|
},
|
||||||
|
|
||||||
|
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id:mapId,
|
||||||
|
xml: mapXml,
|
||||||
|
properties: pref
|
||||||
|
};
|
||||||
|
|
||||||
|
var request = new Request({
|
||||||
|
url:this.saveUrl + mapId + "?minor=" + !saveHistory,
|
||||||
|
method: 'put',
|
||||||
|
onSuccess:function(responseText, responseXML) {
|
||||||
|
events.onSuccess();
|
||||||
|
|
||||||
|
},
|
||||||
|
onException:function(headerName, value) {
|
||||||
|
events.onError();
|
||||||
|
},
|
||||||
|
onFailure:function(xhr) {
|
||||||
|
events.onError();
|
||||||
|
},
|
||||||
|
headers: {"Content-Type":"application/json","Accept":"application/json"},
|
||||||
|
emulation:false,
|
||||||
|
urlEncoded:false
|
||||||
|
});
|
||||||
|
request.put(JSON.encode(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.RichTextEditor = mindplot.TextEditor.extend({
|
|
||||||
initialize:function(screenManager,actionRunner){
|
|
||||||
this.parent(screenManager, actionRunner);
|
|
||||||
},
|
|
||||||
_buildEditor:function(){
|
|
||||||
//Create editor ui
|
|
||||||
this._size = {width:440, height:200};
|
|
||||||
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: "50%", left:"50%", marginLeft:"-200px", marginTop:"-90px", width:"400px", height:"180px"});
|
|
||||||
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).inject(this._myOverlay);
|
|
||||||
this.inputText = new Element('textarea').setProperties({tabindex:'-1', id:"inputText2", value:""}).setStyles({width:"398px", height:"175px", border:"none", background:"transparent"}).inject(inputContainer);
|
|
||||||
this._myOverlay.inject(this._screenManager.getContainer());
|
|
||||||
this._editorNode = new web2d.Rect(0.3,mindplot.Topic.OUTER_SHAPE_ATTRIBUTES);
|
|
||||||
this._editorNode.setSize(50,20);
|
|
||||||
this._editorNode.setVisibility(false);
|
|
||||||
this._designer.getWorkSpace().appendChild(this._editorNode);
|
|
||||||
this._addListeners();
|
|
||||||
},
|
|
||||||
_registerListeners:function(){
|
|
||||||
|
|
||||||
$(this._myOverlay).addEvent('click', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
event.stop();
|
|
||||||
}.bindWithEvent(this));
|
|
||||||
$(this._myOverlay).addEvent('dblclick', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
event.stop();
|
|
||||||
}.bindWithEvent(this));
|
|
||||||
},
|
|
||||||
getFocusEvent:function(node){
|
|
||||||
var screenSize = this._designer.getWorkSpace().getSize();
|
|
||||||
var coordOrigin = this._designer.getWorkSpace()._workspace.getCoordOrigin();
|
|
||||||
var middlePosition = {x:parseInt(screenSize.width)/2 + parseInt(coordOrigin.x), y:parseInt(screenSize.height)/2 + parseInt(coordOrigin.y)};
|
|
||||||
|
|
||||||
this._designer.getWorkSpace().enableWorkspaceEvents(false);
|
|
||||||
var position = node.getPosition().clone();
|
|
||||||
var size = node.getSize();
|
|
||||||
this._editorNode.setPosition(position.x-(size.width/2), position.y-(size.height/2));
|
|
||||||
position = this._editorNode.getPosition();
|
|
||||||
this._editorNode.setSize(size.width, size.height);
|
|
||||||
this._editorNode.moveToFront();
|
|
||||||
this._editorNode.setVisibility(true);
|
|
||||||
var scale = web2d.peer.utils.TransformUtil.workoutScale(node.getOuterShape());
|
|
||||||
// scale.width=1;
|
|
||||||
// scale.height = 1;
|
|
||||||
var steps = 10;
|
|
||||||
this._delta = {width:((this._size.width/scale.width)-size.width)/steps, height:((this._size.height/scale.height)-size.height)/steps};
|
|
||||||
var finx = (middlePosition.x-(((this._size.width)/2)/scale.width));
|
|
||||||
var finy = (middlePosition.y-((this._size.height/2)/scale.height));
|
|
||||||
var step = 10;
|
|
||||||
var d = {x:(position.x - finx)/step, y:(position.y - finy)/step};
|
|
||||||
var _animEffect = null;
|
|
||||||
var effect = function(){
|
|
||||||
if(step>=0){
|
|
||||||
var xStep= (position.x -finx)/step;
|
|
||||||
var yStep= (position.y -finy)/step;
|
|
||||||
var pos = {x:position.x - d.x*(10-step), y: position.y -d.y *(10-step)};
|
|
||||||
|
|
||||||
var size = this._editorNode.getSize();
|
|
||||||
this._editorNode.setSize(size.width + this._delta.width, size.height + this._delta.height);
|
|
||||||
this._editorNode.setPosition(pos.x, pos.y);
|
|
||||||
if(step>0)
|
|
||||||
this._editorNode.setOpacity(1-step/10);
|
|
||||||
step--;
|
|
||||||
}else{
|
|
||||||
$clear(_animEffect);
|
|
||||||
this._editorNode.setSize((this._size.width/scale.width), (this._size.height/scale.height));
|
|
||||||
this.init(node);
|
|
||||||
}
|
|
||||||
}.bind(this);
|
|
||||||
_animEffect = effect.periodical(10);
|
|
||||||
$(this.inputText).value = $defined(this.initialText)&& this.initialText!=""? this.initialText: node.getText();
|
|
||||||
this._editor = new nicEditor({iconsPath: '../images/nicEditorIcons.gif', buttonList : ['bold','italic','underline','removeformat','forecolor', 'fontSize', 'fontFamily', 'xhtml']}).panelInstance("inputText2");
|
|
||||||
},
|
|
||||||
init:function(node){
|
|
||||||
this._currentNode = node;
|
|
||||||
this._applyChanges = false;
|
|
||||||
$(this._myOverlay.setStyle('display','block'));
|
|
||||||
inst = this._editor.instanceById("inputText2");
|
|
||||||
inst.elm.focus();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//becarefull this._editor is not mootools!!
|
|
||||||
this._editor.addEvent('blur',function(event){
|
|
||||||
this._myOverlay.setStyle('display','none');
|
|
||||||
var text = this._text;
|
|
||||||
this._text = this._editor.instanceById("inputText2").getContent();
|
|
||||||
if(text!=this._text){
|
|
||||||
this._applyChanges = true;
|
|
||||||
}
|
|
||||||
console.log('bye');
|
|
||||||
this.lostFocusListener();
|
|
||||||
this._editor.removeInstance("inputText2");
|
|
||||||
this._editor.destruct();
|
|
||||||
this._editor = null;
|
|
||||||
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
this._editor.fireEvent();
|
|
||||||
$(this.inputText).focus();
|
|
||||||
},
|
|
||||||
getText:function(){
|
|
||||||
return this._text;
|
|
||||||
},
|
|
||||||
lostFocusListener:function(){
|
|
||||||
this._hideNode();
|
|
||||||
if (this._currentNode != null)
|
|
||||||
{
|
|
||||||
if(this._applyChanges)
|
|
||||||
{
|
|
||||||
this._updateModel();
|
|
||||||
}
|
|
||||||
this._applyChanges=true;
|
|
||||||
this._currentNode = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_hideNode:function(){
|
|
||||||
var _animEffect = null;
|
|
||||||
var step = 10;
|
|
||||||
var position = this._editorNode.getPosition();
|
|
||||||
var finx = this._currentNode.getPosition().x - this._currentNode.getSize().width/2;
|
|
||||||
var finy = this._currentNode.getPosition().y - this._currentNode.getSize().height/2;
|
|
||||||
var d = {x:(position.x - finx)/step, y:(position.y - finy)/step};
|
|
||||||
var effect = function(){
|
|
||||||
if(step>=0){
|
|
||||||
var pos = {x:position.x - d.x*(10-step), y: position.y - d.y*(10-step)};
|
|
||||||
|
|
||||||
var size = this._editorNode.getSize();
|
|
||||||
this._editorNode.setSize(size.width - this._delta.width, size.height - this._delta.height);
|
|
||||||
this._editorNode.setPosition(pos.x, pos.y);
|
|
||||||
this._editorNode.setOpacity(step/10);
|
|
||||||
step--;
|
|
||||||
}else{
|
|
||||||
$clear(_animEffect);
|
|
||||||
this._designer.getWorkSpace().enableWorkspaceEvents(true);
|
|
||||||
this._editorNode.setVisibility(false); }
|
|
||||||
}.bind(this);
|
|
||||||
_animEffect = effect.periodical(10);
|
|
||||||
}
|
|
||||||
});
|
|
@ -28,26 +28,12 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this._actionRunner.hasBeenChanged();
|
this._actionRunner.hasBeenChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
addIconToTopic: function(topicId, iconType) {
|
|
||||||
var command = new mindplot.commands.AddIconToTopicCommand(topicId, iconType);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
changeLinkToTopic: function(topicId, url) {
|
|
||||||
var command = new mindplot.commands.ChangeLinkToTopicCommand(topicId, url);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
addTopic:function(nodeModel, parentTopicId, animated) {
|
addTopic:function(nodeModel, parentTopicId, animated) {
|
||||||
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
|
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeNoteToTopic: function(topicId, text) {
|
|
||||||
var command = new mindplot.commands.ChangeNoteToTopicCommand(topicId, text);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
connectByRelation: function(model) {
|
connectByRelation: function(model) {
|
||||||
var command = new mindplot.commands.AddRelationshipCommand(model);
|
var command = new mindplot.commands.AddRelationshipCommand(model);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
@ -82,20 +68,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeIconFromTopic: function(topicId, iconModel) {
|
|
||||||
var command = new mindplot.commands.RemoveIconFromTopicCommand(topicId, iconModel);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
removeLinkFromTopic: function(topicId) {
|
|
||||||
var command = new mindplot.commands.RemoveLinkFromTopicCommand(topicId);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
removeNoteFromTopic: function(topicId) {
|
|
||||||
var command = new mindplot.commands.RemoveNoteFromTopicCommand(topicId);
|
|
||||||
this.execute(command);
|
|
||||||
},
|
|
||||||
|
|
||||||
changeFontStyleToTopic: function(topicsIds) {
|
changeFontStyleToTopic: function(topicsIds) {
|
||||||
|
|
||||||
var commandFunc = function(topic) {
|
var commandFunc = function(topic) {
|
||||||
@ -242,6 +214,21 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command, false);
|
this.execute(command, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addFeatureToTopic : function(topicId, featureType, attributes) {
|
||||||
|
var command = new mindplot.commands.AddFeatureToTopicCommand(topicId, featureType, attributes);
|
||||||
|
this.execute(command);
|
||||||
|
},
|
||||||
|
|
||||||
|
changeFeatureToTopic : function(topicId, featureId, attributes) {
|
||||||
|
var command = new mindplot.commands.ChangeFeatureToTopicCommand(topicId, featureId, attributes);
|
||||||
|
this.execute(command);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFeatureFromTopic : function(topicId, featureId) {
|
||||||
|
var command = new mindplot.commands.RemoveFeatureFromTopicCommand(topicId, featureId);
|
||||||
|
this.execute(command);
|
||||||
|
},
|
||||||
|
|
||||||
execute:function(command) {
|
execute:function(command) {
|
||||||
this._actionRunner.execute(command);
|
this._actionRunner.execute(command);
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
||||||
@ -273,8 +260,7 @@ mindplot.CommandContext = new Class({
|
|||||||
|
|
||||||
createTopic:function(model, isVisible) {
|
createTopic:function(model, isVisible) {
|
||||||
$assert(model, "model can not be null");
|
$assert(model, "model can not be null");
|
||||||
var result = this._designer._nodeModelToNodeGraph(model, isVisible);
|
return this._designer._nodeModelToNodeGraph(model, isVisible);
|
||||||
return result;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createModel:function() {
|
createModel:function() {
|
||||||
|
@ -21,13 +21,11 @@ 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 = [];
|
||||||
this._isInWorkspace = false;
|
this._isInWorkspace = false;
|
||||||
this._buildShape();
|
this._buildTopicShape();
|
||||||
|
|
||||||
// Position a topic ....
|
// Position a topic ....
|
||||||
var pos = model.getPosition();
|
var pos = model.getPosition();
|
||||||
@ -51,24 +49,13 @@ 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(event, text) {
|
|
||||||
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) {
|
||||||
this._setShapeType(type, true);
|
this._setShapeType(type, true);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getParent : function() {
|
getParent : function() {
|
||||||
@ -91,7 +78,7 @@ mindplot.Topic = new Class({
|
|||||||
var innerShape = this.getInnerShape();
|
var innerShape = this.getInnerShape();
|
||||||
|
|
||||||
// Update figure size ...
|
// Update figure size ...
|
||||||
var size = model.getSize();
|
var size = this.getSize();
|
||||||
this.setSize(size, true);
|
this.setSize(size, true);
|
||||||
|
|
||||||
var group = this.get2DElement();
|
var group = this.get2DElement();
|
||||||
@ -106,6 +93,7 @@ mindplot.Topic = new Class({
|
|||||||
if ($defined(iconGroup)) {
|
if ($defined(iconGroup)) {
|
||||||
iconGroup.moveToFront();
|
iconGroup.moveToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Move connector to front
|
//Move connector to front
|
||||||
var connector = this.getShrinkConnector();
|
var connector = this.getShrinkConnector();
|
||||||
if ($defined(connector)) {
|
if ($defined(connector)) {
|
||||||
@ -135,7 +123,7 @@ mindplot.Topic = new Class({
|
|||||||
getInnerShape : function() {
|
getInnerShape : function() {
|
||||||
if (!$defined(this._innerShape)) {
|
if (!$defined(this._innerShape)) {
|
||||||
// Create inner box.
|
// Create inner box.
|
||||||
this._innerShape = this.buildShape(mindplot.Topic.INNER_RECT_ATTRIBUTES);
|
this._innerShape = this._buildShape(mindplot.Topic.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||||
|
|
||||||
// Update bgcolor ...
|
// Update bgcolor ...
|
||||||
var bgColor = this.getBackgroundColor();
|
var bgColor = this.getBackgroundColor();
|
||||||
@ -156,22 +144,36 @@ mindplot.Topic = new Class({
|
|||||||
return this._innerShape;
|
return this._innerShape;
|
||||||
},
|
},
|
||||||
|
|
||||||
buildShape : function(attributes, type) {
|
_buildShape : function(attributes, shapeType) {
|
||||||
var result;
|
$assert(attributes, "attributes can not be null");
|
||||||
if (!$defined(type)) {
|
$assert(shapeType, "shapeType can not be null");
|
||||||
type = this.getShapeType();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == mindplot.model.INodeModel.SHAPE_TYPE_RECT) {
|
var result;
|
||||||
|
if (shapeType == mindplot.model.TopicShape.RECTANGLE) {
|
||||||
result = new web2d.Rect(0, attributes);
|
result = new web2d.Rect(0, attributes);
|
||||||
|
} else if (shapeType == mindplot.model.TopicShape.IMAGE) {
|
||||||
|
var model = this.getModel();
|
||||||
|
var url = model.getImageUrl();
|
||||||
|
var size = model.getImageSize();
|
||||||
|
|
||||||
|
result = new web2d.Image();
|
||||||
|
result.setHref(url);
|
||||||
|
result.setSize(size.width, size.height);
|
||||||
|
|
||||||
|
result.getSize = function() {
|
||||||
|
return model.getImageSize();
|
||||||
|
};
|
||||||
|
|
||||||
|
result.setPosition = function() {
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_ELIPSE) {
|
else if (shapeType == mindplot.model.TopicShape.ELLIPSE) {
|
||||||
result = new web2d.Rect(0.9, attributes);
|
result = new web2d.Rect(0.9, attributes);
|
||||||
}
|
}
|
||||||
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT) {
|
else if (shapeType == mindplot.model.TopicShape.ROUNDED_RECT) {
|
||||||
result = new web2d.Rect(0.3, attributes);
|
result = new web2d.Rect(0.3, attributes);
|
||||||
}
|
}
|
||||||
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_LINE) {
|
else if (shapeType == mindplot.model.TopicShape.LINE) {
|
||||||
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1});
|
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1});
|
||||||
result.setSize = function(width, height) {
|
result.setSize = function(width, height) {
|
||||||
this.size = {width:width, height:height};
|
this.size = {width:width, height:height};
|
||||||
@ -190,7 +192,6 @@ mindplot.Topic = new Class({
|
|||||||
result.setPosition = function() {
|
result.setPosition = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var setStrokeFunction = result.setStroke;
|
|
||||||
result.setFill = function() {
|
result.setFill = function() {
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -200,7 +201,7 @@ mindplot.Topic = new Class({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$assert(false, "Unsupported figure type:" + type);
|
$assert(false, "Unsupported figure shapeType:" + shapeType);
|
||||||
}
|
}
|
||||||
result.setPosition(0, 0);
|
result.setPosition(0, 0);
|
||||||
return result;
|
return result;
|
||||||
@ -220,7 +221,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
getOuterShape : function() {
|
getOuterShape : function() {
|
||||||
if (!$defined(this._outerShape)) {
|
if (!$defined(this._outerShape)) {
|
||||||
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT);
|
var rect = this._buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.model.TopicShape.ROUNDED_RECT);
|
||||||
rect.setPosition(-2, -3);
|
rect.setPosition(-2, -3);
|
||||||
rect.setOpacity(0);
|
rect.setOpacity(0);
|
||||||
this._outerShape = rect;
|
this._outerShape = rect;
|
||||||
@ -237,6 +238,7 @@ mindplot.Topic = new Class({
|
|||||||
var text = this.getText();
|
var text = this.getText();
|
||||||
this._setText(text, false);
|
this._setText(text, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._text;
|
return this._text;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -260,129 +262,55 @@ mindplot.Topic = new Class({
|
|||||||
var padding = this._getInnerPadding();
|
var padding = this._getInnerPadding();
|
||||||
result.setPosition(padding, padding);
|
result.setPosition(padding, padding);
|
||||||
|
|
||||||
|
// Load topic features ...
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
|
var featuresModel = model.getFeatures();
|
||||||
//Icons
|
for (var i = 0; i < featuresModel.length; i++) {
|
||||||
var icons = model.getIcons();
|
var featureModel = featuresModel[i];
|
||||||
for (var i = 0; i < icons.length; i++) {
|
var icon = mindplot.TopicFeature.createIcon(this, featureModel);
|
||||||
// Update model identifier ...
|
result.addIcon(icon, featureModel.getType() == "icon"); // @Todo: Remove hack ...
|
||||||
var iconModel = icons[i];
|
|
||||||
var icon = new mindplot.ImageIcon(this, iconModel);
|
|
||||||
result.addIcon(icon, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Links
|
|
||||||
var links = model.getLinks();
|
|
||||||
for (var i = 0; i < links.length; i++) {
|
|
||||||
this._link = new mindplot.LinkIcon(this, links[i]);
|
|
||||||
result.addIcon(this._link);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Notes
|
|
||||||
var notes = model.getNotes();
|
|
||||||
for (var j = 0; j < notes.length; j++) {
|
|
||||||
this._note = new mindplot.NoteIcon(this, notes[j]);
|
|
||||||
result.addIcon(this._note);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
addLink : function(url) {
|
addFeature : function(type, attributes) {
|
||||||
var iconGroup = this.getOrBuildIconGroup();
|
|
||||||
var model = this.getModel();
|
|
||||||
var linkModel = model.createLink(url);
|
|
||||||
model.addLink(linkModel);
|
|
||||||
|
|
||||||
this._link = new mindplot.LinkIcon(this, linkModel);
|
|
||||||
iconGroup.addIcon(this._link);
|
|
||||||
|
|
||||||
this._adjustShapes();
|
|
||||||
},
|
|
||||||
|
|
||||||
addNote : function(text) {
|
|
||||||
var iconGroup = this.getOrBuildIconGroup();
|
|
||||||
var model = this.getModel();
|
|
||||||
|
|
||||||
var noteModel = model.createNote(text);
|
|
||||||
model.addNote(noteModel);
|
|
||||||
|
|
||||||
this._note = new mindplot.NoteIcon(this, noteModel);
|
|
||||||
iconGroup.addIcon(this._note);
|
|
||||||
|
|
||||||
this._adjustShapes();
|
|
||||||
},
|
|
||||||
|
|
||||||
addIcon : function(iconType) {
|
|
||||||
var iconGroup = this.getOrBuildIconGroup();
|
var iconGroup = this.getOrBuildIconGroup();
|
||||||
this.closeEditors();
|
this.closeEditors();
|
||||||
|
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
|
|
||||||
// Update model ...
|
// Update model ...
|
||||||
var iconModel = model.createIcon(iconType);
|
var feature = model.createFeature(type, attributes);
|
||||||
model.addIcon(iconModel);
|
model.addFeature(feature);
|
||||||
|
|
||||||
|
var result = mindplot.TopicFeature.createIcon(this, feature);
|
||||||
|
iconGroup.addIcon(result, type == "icon"); // @Todo: Remove hack ...
|
||||||
|
|
||||||
var imageIcon = new mindplot.ImageIcon(this, iconModel);
|
|
||||||
iconGroup.addIcon(imageIcon, true);
|
|
||||||
this._adjustShapes();
|
this._adjustShapes();
|
||||||
return imageIcon;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeIcon : function(iconModel) {
|
findFeatureById : function(id) {
|
||||||
|
var model = this.getModel();
|
||||||
|
return model.findFeatureById(id);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFeature : function(featureModel) {
|
||||||
|
$assert(featureModel, "featureModel could not be null");
|
||||||
|
|
||||||
//Removing the icon from MODEL
|
//Removing the icon from MODEL
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
model.removeIcon(iconModel);
|
model.removeFeature(featureModel);
|
||||||
|
|
||||||
//Removing the icon from UI
|
//Removing the icon from UI
|
||||||
var iconGroup = this.getIconGroup();
|
var iconGroup = this.getIconGroup();
|
||||||
if ($defined(iconGroup)) {
|
if ($defined(iconGroup)) {
|
||||||
iconGroup.removeIcon(iconModel);
|
iconGroup.removeIconByModel(featureModel);
|
||||||
}
|
}
|
||||||
this._adjustShapes();
|
this._adjustShapes();
|
||||||
},
|
},
|
||||||
|
|
||||||
removeLink : function() {
|
|
||||||
// Update model ...
|
|
||||||
var model = this.getModel();
|
|
||||||
var links = model.getLinks();
|
|
||||||
model._removeLink(links[0]);
|
|
||||||
|
|
||||||
// Remove UI ...
|
|
||||||
var iconGroup = this.getIconGroup();
|
|
||||||
if ($defined(iconGroup)) {
|
|
||||||
iconGroup.removeIconByUrl(mindplot.LinkIcon.IMAGE_URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._link = null;
|
|
||||||
this._adjustShapes();
|
|
||||||
},
|
|
||||||
|
|
||||||
removeNote : function() {
|
|
||||||
// Update model ...
|
|
||||||
var model = this.getModel();
|
|
||||||
var notes = model.getNotes();
|
|
||||||
model.removeNote(notes[0]);
|
|
||||||
|
|
||||||
// Remove UI ...
|
|
||||||
var iconGroup = this.getIconGroup();
|
|
||||||
if ($defined(iconGroup)) {
|
|
||||||
iconGroup.removeIconByUrl(mindplot.NoteIcon.IMAGE_URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._note = null;
|
|
||||||
this._adjustShapes();
|
|
||||||
},
|
|
||||||
|
|
||||||
hasNote : function() {
|
|
||||||
return this.getModel().getNotes().length != 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
hasLink : function() {
|
|
||||||
return this.getModel().getLinks().length != 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
connectByRelation : function(relationship) {
|
connectByRelation : function(relationship) {
|
||||||
this._relationships.push(relationship);
|
this._relationships.push(relationship);
|
||||||
},
|
},
|
||||||
@ -562,7 +490,9 @@ mindplot.Topic = new Class({
|
|||||||
innerShape.setFill(color);
|
innerShape.setFill(color);
|
||||||
|
|
||||||
var connector = this.getShrinkConnector();
|
var connector = this.getShrinkConnector();
|
||||||
connector.setFill(color);
|
if (connector) {
|
||||||
|
connector.setFill(color);
|
||||||
|
}
|
||||||
|
|
||||||
if ($defined(updateModel) && updateModel) {
|
if ($defined(updateModel) && updateModel) {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
@ -588,8 +518,9 @@ mindplot.Topic = new Class({
|
|||||||
innerShape.setAttribute('strokeColor', color);
|
innerShape.setAttribute('strokeColor', color);
|
||||||
|
|
||||||
var connector = this.getShrinkConnector();
|
var connector = this.getShrinkConnector();
|
||||||
connector.setAttribute('strokeColor', color);
|
if (connector) {
|
||||||
|
connector.setAttribute('strokeColor', color);
|
||||||
|
}
|
||||||
|
|
||||||
if ($defined(updateModel) && updateModel) {
|
if ($defined(updateModel) && updateModel) {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
@ -606,7 +537,7 @@ mindplot.Topic = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildShape : function() {
|
_buildTopicShape : function() {
|
||||||
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
|
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
|
||||||
var group = new web2d.Group(groupAttributes);
|
var group = new web2d.Group(groupAttributes);
|
||||||
this._set2DElement(group);
|
this._set2DElement(group);
|
||||||
@ -615,7 +546,6 @@ mindplot.Topic = new Class({
|
|||||||
var outerShape = this.getOuterShape();
|
var outerShape = this.getOuterShape();
|
||||||
var innerShape = this.getInnerShape();
|
var innerShape = this.getInnerShape();
|
||||||
var textShape = this.getTextShape();
|
var textShape = this.getTextShape();
|
||||||
var shrinkConnector = this.getShrinkConnector();
|
|
||||||
|
|
||||||
// Add to the group ...
|
// Add to the group ...
|
||||||
group.appendChild(outerShape);
|
group.appendChild(outerShape);
|
||||||
@ -624,11 +554,12 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
// Update figure size ...
|
// Update figure size ...
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
if (model.getLinks().length != 0 || model.getNotes().length != 0 || model.getIcons().length != 0) {
|
if (model.getFeatures().length != 0) {
|
||||||
this.getOrBuildIconGroup();
|
this.getOrBuildIconGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
var shrinkConnector = this.getShrinkConnector();
|
||||||
|
if ($defined(shrinkConnector)) {
|
||||||
shrinkConnector.addToWorkspace(group);
|
shrinkConnector.addToWorkspace(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +601,6 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
isCollapsed : function() {
|
isCollapsed : function() {
|
||||||
var model = this.getModel();
|
|
||||||
var result = false;
|
var result = false;
|
||||||
|
|
||||||
var current = this.getParent();
|
var current = this.getParent();
|
||||||
@ -687,12 +617,21 @@ mindplot.Topic = new Class({
|
|||||||
model.setChildrenShrunken(value);
|
model.setChildrenShrunken(value);
|
||||||
|
|
||||||
// Change render base on the state.
|
// Change render base on the state.
|
||||||
var shrinkConnector = this.getShrinkConnector();
|
|
||||||
shrinkConnector.changeRender(value);
|
|
||||||
|
|
||||||
// Hide children ...
|
var shrinkConnector = this.getShrinkConnector();
|
||||||
core.Utils.setChildrenVisibilityAnimated(this, !value);
|
if ($defined(shrinkConnector)) {
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, this.getModel());
|
shrinkConnector.changeRender(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do some fancy animation ....
|
||||||
|
var elements = this._flatten2DElements(this);
|
||||||
|
var fade = new mindplot.util.FadeEffect(elements, !value);
|
||||||
|
fade.addEvent('complete', function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
fade.start();
|
||||||
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getShrinkConnector : function() {
|
getShrinkConnector : function() {
|
||||||
@ -711,7 +650,7 @@ mindplot.Topic = new Class({
|
|||||||
outerShape.setOpacity(1);
|
outerShape.setOpacity(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMouseOut : function(event) {
|
handleMouseOut : function() {
|
||||||
var outerShape = this.getOuterShape();
|
var outerShape = this.getOuterShape();
|
||||||
if (!this.isOnFocus()) {
|
if (!this.isOnFocus()) {
|
||||||
outerShape.setOpacity(0);
|
outerShape.setOpacity(0);
|
||||||
@ -719,7 +658,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() {
|
||||||
@ -728,7 +667,7 @@ mindplot.Topic = new Class({
|
|||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var editorModel = {
|
var editorModel = {
|
||||||
getValue : function() {
|
getValue : function() {
|
||||||
var notes = model.getNotes();
|
var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
|
||||||
var result;
|
var result;
|
||||||
if (notes.length > 0)
|
if (notes.length > 0)
|
||||||
result = notes[0].getText();
|
result = notes[0].getText();
|
||||||
@ -738,11 +677,18 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
setValue : function(value) {
|
setValue : function(value) {
|
||||||
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
||||||
|
var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
|
||||||
if (!$defined(value)) {
|
if (!$defined(value)) {
|
||||||
dispatcher.removeNoteFromTopic(topicId);
|
var featureId = notes[0].getId();
|
||||||
|
dispatcher.removeFeatureFromTopic(topicId, featureId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dispatcher.changeNoteToTopic(topicId, value);
|
if (notes.length > 0) {
|
||||||
|
dispatcher.changeFeatureToTopic(topicId, notes[0].getId(), {text:value});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dispatcher.addFeatureToTopic(topicId, mindplot.TopicFeature.Note.id, {text:value});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -757,7 +703,7 @@ mindplot.Topic = new Class({
|
|||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var editorModel = {
|
var editorModel = {
|
||||||
getValue : function() {
|
getValue : function() {
|
||||||
var links = model.getLinks();
|
var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
|
||||||
var result;
|
var result;
|
||||||
if (links.length > 0)
|
if (links.length > 0)
|
||||||
result = links[0].getUrl();
|
result = links[0].getUrl();
|
||||||
@ -767,11 +713,18 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
setValue : function(value) {
|
setValue : function(value) {
|
||||||
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
||||||
|
var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
|
||||||
if (!$defined(value)) {
|
if (!$defined(value)) {
|
||||||
dispatcher.removeLinkFromTopic(topicId);
|
var featureId = links[0].getId();
|
||||||
|
dispatcher.removeFeatureFromTopic(topicId, featureId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dispatcher.changeLinkToTopic(topicId, value);
|
if (links.length > 0) {
|
||||||
|
dispatcher.changeFeatureToTopic(topicId, links[0].getId(), {url:value});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dispatcher.addFeatureToTopic(topicId, mindplot.TopicFeature.Link.id, {url:value});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -781,9 +734,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();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -821,7 +777,7 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
getIncomingLines : function() {
|
getIncomingLines : function() {
|
||||||
var result = [];
|
var result = [];
|
||||||
var children = this._getChildren();
|
var children = this.getChildren();
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var node = children[i];
|
var node = children[i];
|
||||||
var line = node.getOutgoingLine();
|
var line = node.getOutgoingLine();
|
||||||
@ -841,7 +797,6 @@ mindplot.Topic = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_updateConnectionLines : function() {
|
_updateConnectionLines : function() {
|
||||||
// Update this to parent line ...
|
// Update this to parent line ...
|
||||||
var outgoingLine = this.getOutgoingLine();
|
var outgoingLine = this.getOutgoingLine();
|
||||||
@ -925,20 +880,23 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
if (this.getIncomingLines().length > 0) {
|
if (this.getIncomingLines().length > 0) {
|
||||||
var connector = this.getShrinkConnector();
|
var connector = this.getShrinkConnector();
|
||||||
connector.setVisibility(value);
|
if ($defined(connector)) {
|
||||||
|
connector.setVisibility(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var textShape = this.getTextShape();
|
var textShape = this.getTextShape();
|
||||||
textShape.setVisibility(value);
|
textShape.setVisibility(this.getShapeType() != mindplot.model.TopicShape.IMAGE ? value : false);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setOpacity : function(opacity) {
|
setOpacity : function(opacity) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
elem.setOpacity(opacity);
|
elem.setOpacity(opacity);
|
||||||
|
|
||||||
this.getShrinkConnector().setOpacity(opacity);
|
var connector = this.getShrinkConnector();
|
||||||
|
if ($defined(connector)) {
|
||||||
|
connector.setOpacity(opacity);
|
||||||
|
}
|
||||||
var textShape = this.getTextShape();
|
var textShape = this.getTextShape();
|
||||||
textShape.setOpacity(opacity);
|
textShape.setOpacity(opacity);
|
||||||
},
|
},
|
||||||
@ -946,7 +904,7 @@ mindplot.Topic = new Class({
|
|||||||
_setChildrenVisibility : function(isVisible) {
|
_setChildrenVisibility : function(isVisible) {
|
||||||
|
|
||||||
// Hide all children.
|
// Hide all children.
|
||||||
var children = this._getChildren();
|
var children = this.getChildren();
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
|
|
||||||
isVisible = isVisible ? !model.areChildrenShrunken() : isVisible;
|
isVisible = isVisible ? !model.areChildrenShrunken() : isVisible;
|
||||||
@ -997,7 +955,7 @@ mindplot.Topic = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePositionOnChangeSize : function(oldSize, newSize) {
|
_updatePositionOnChangeSize : function() {
|
||||||
$assert(false, "this method must be overwrited.");
|
$assert(false, "this method must be overwrited.");
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1036,9 +994,11 @@ mindplot.Topic = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide connection line?.
|
// Hide connection line?.
|
||||||
if (targetTopic._getChildren().length == 0) {
|
if (targetTopic.getChildren().length == 0) {
|
||||||
var connector = targetTopic.getShrinkConnector();
|
var connector = targetTopic.getShrinkConnector();
|
||||||
connector.setVisibility(false);
|
if ($defined(connector)) {
|
||||||
|
connector.setVisibility(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1070,8 +1030,9 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
// Create a connection line ...
|
// Create a connection line ...
|
||||||
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
|
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
|
||||||
if ($defined(isVisible))
|
if ($defined(isVisible)) {
|
||||||
outgoingLine.setVisibility(isVisible);
|
outgoingLine.setVisibility(isVisible);
|
||||||
|
}
|
||||||
this._outgoingLine = outgoingLine;
|
this._outgoingLine = outgoingLine;
|
||||||
workspace.appendChild(outgoingLine);
|
workspace.appendChild(outgoingLine);
|
||||||
|
|
||||||
@ -1092,7 +1053,9 @@ mindplot.Topic = new Class({
|
|||||||
|
|
||||||
// Display connection node...
|
// Display connection node...
|
||||||
var connector = targetTopic.getShrinkConnector();
|
var connector = targetTopic.getShrinkConnector();
|
||||||
connector.setVisibility(true);
|
if ($defined(connector)) {
|
||||||
|
connector.setVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Redraw line ...
|
// Redraw line ...
|
||||||
outgoingLine.redraw();
|
outgoingLine.redraw();
|
||||||
@ -1105,16 +1068,16 @@ mindplot.Topic = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
appendChild : function(child) {
|
appendChild : function(child) {
|
||||||
var children = this._getChildren();
|
var children = this.getChildren();
|
||||||
children.push(child);
|
children.push(child);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeChild : function(child) {
|
removeChild : function(child) {
|
||||||
var children = this._getChildren();
|
var children = this.getChildren();
|
||||||
children.erase(child);
|
children.erase(child);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getChildren : function() {
|
getChildren : function() {
|
||||||
var result = this._children;
|
var result = this._children;
|
||||||
if (!$defined(result)) {
|
if (!$defined(result)) {
|
||||||
this._children = [];
|
this._children = [];
|
||||||
@ -1165,42 +1128,69 @@ 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;
|
||||||
},
|
},
|
||||||
|
|
||||||
_adjustShapes : function() {
|
_adjustShapes : function() {
|
||||||
if (this._isInWorkspace) {
|
if (this._isInWorkspace) {
|
||||||
|
|
||||||
var textShape = this.getTextShape();
|
var textShape = this.getTextShape();
|
||||||
var textWidth = textShape.getWidth();
|
if (this.getShapeType() != mindplot.model.TopicShape.IMAGE) {
|
||||||
|
|
||||||
var textHeight = textShape.getHeight();
|
var textWidth = textShape.getWidth();
|
||||||
textHeight = textHeight != 0 ? textHeight : 20;
|
|
||||||
|
|
||||||
var topicPadding = this._getInnerPadding();
|
var textHeight = textShape.getHeight();
|
||||||
|
textHeight = textHeight != 0 ? textHeight : 20;
|
||||||
|
|
||||||
// Adjust the icon size to the size of the text ...
|
var topicPadding = this._getInnerPadding();
|
||||||
var iconGroup = this.getOrBuildIconGroup();
|
|
||||||
var fontHeight = this.getTextShape().getFontHeight();
|
|
||||||
iconGroup.setPosition(topicPadding, topicPadding);
|
|
||||||
iconGroup.seIconSize(fontHeight, fontHeight);
|
|
||||||
|
|
||||||
// Add a extra padding between the text and the icons
|
// Adjust the icon size to the size of the text ...
|
||||||
var iconsWidth = iconGroup.getSize().width;
|
var iconGroup = this.getOrBuildIconGroup();
|
||||||
if (iconsWidth != 0) {
|
var fontHeight = this.getTextShape().getFontHeight();
|
||||||
|
iconGroup.setPosition(topicPadding, topicPadding);
|
||||||
|
iconGroup.seIconSize(fontHeight, fontHeight);
|
||||||
|
|
||||||
iconsWidth = iconsWidth + (textHeight / 4);
|
// Add a extra padding between the text and the icons
|
||||||
|
var iconsWidth = iconGroup.getSize().width;
|
||||||
|
if (iconsWidth != 0) {
|
||||||
|
|
||||||
|
iconsWidth = iconsWidth + (textHeight / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
var height = textHeight + (topicPadding * 2);
|
||||||
|
var width = textWidth + iconsWidth + (topicPadding * 2);
|
||||||
|
|
||||||
|
this.setSize({width:width,height:height});
|
||||||
|
|
||||||
|
// Position node ...
|
||||||
|
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
||||||
|
} else {
|
||||||
|
// In case of images, the size if fixed ...
|
||||||
|
var size = this.getModel().getImageSize();
|
||||||
|
this.setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
var height = textHeight + (topicPadding * 2);
|
|
||||||
var width = textWidth + iconsWidth + (topicPadding * 2);
|
|
||||||
|
|
||||||
this.setSize({width:width,height:height});
|
|
||||||
|
|
||||||
// Position node ...
|
|
||||||
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_flatten2DElements : function(topic) {
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
var children = topic.getChildren();
|
||||||
|
for (var i = 0; i < children.length; i++) {
|
||||||
|
|
||||||
|
var child = children[i];
|
||||||
|
result.push(child);
|
||||||
|
result.push(child.getOutgoingLine());
|
||||||
|
|
||||||
|
var relationships = child.getRelationships();
|
||||||
|
result = result.concat(relationships);
|
||||||
|
|
||||||
|
var innerChilds = this._flatten2DElements(child);
|
||||||
|
result = result.concat(innerChilds);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
66
mindplot/src/main/javascript/TopicEditor.js
Normal file
66
mindplot/src/main/javascript/TopicEditor.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* 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.TopicEditor = new Class({
|
||||||
|
Extends: Events,
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
68
mindplot/src/main/javascript/TopicFeature.js
Normal file
68
mindplot/src/main/javascript/TopicFeature.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* 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.TopicFeature = {
|
||||||
|
Icon: {
|
||||||
|
id:mindplot.model.IconModel.FEATURE_TYPE,
|
||||||
|
model: mindplot.model.IconModel,
|
||||||
|
icon : mindplot.ImageIcon
|
||||||
|
},
|
||||||
|
|
||||||
|
Link: {
|
||||||
|
id: mindplot.model.LinkModel.FEATURE_TYPE,
|
||||||
|
model: mindplot.model.LinkModel,
|
||||||
|
icon : mindplot.LinkIcon
|
||||||
|
},
|
||||||
|
|
||||||
|
Note: {
|
||||||
|
id: mindplot.model.NoteModel.FEATURE_TYPE,
|
||||||
|
model: mindplot.model.NoteModel,
|
||||||
|
icon : mindplot.NoteIcon
|
||||||
|
},
|
||||||
|
|
||||||
|
isSupported : function(id) {
|
||||||
|
return mindplot.TopicFeature._featuresMetadataById.some(function(elem) {
|
||||||
|
return elem.id == id;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
createModel : function(id, topic, attributes) {
|
||||||
|
$assert(id, 'type can not be null');
|
||||||
|
$assert(topic, 'topic can not be null');
|
||||||
|
$assert(attributes, 'attributes can not be null');
|
||||||
|
|
||||||
|
var model = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
|
||||||
|
return elem.id == id;
|
||||||
|
})[0].model;
|
||||||
|
return new model(topic, attributes);
|
||||||
|
},
|
||||||
|
|
||||||
|
createIcon : function(topic, model) {
|
||||||
|
$assert(topic, 'topic can not be null');
|
||||||
|
$assert(model, 'model can not be null');
|
||||||
|
|
||||||
|
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
|
||||||
|
return elem.id == model.getType();
|
||||||
|
})[0].icon;
|
||||||
|
return new icon(topic, model);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note];
|
||||||
|
|
||||||
|
|
@ -16,23 +16,28 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
mindplot.commands.AddFeatureToTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId) {
|
initialize: function(topicId, featureType, attributes) {
|
||||||
|
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
$assert(featureType, 'featureType can not be null');
|
||||||
|
$assert(attributes, 'attributes can not be null');
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
this._topicId = topicId;
|
||||||
|
this._featureType = featureType;
|
||||||
|
this._attributes = attributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._topicId)[0];
|
||||||
var model = topic.getModel();
|
var icon = topic.addFeature(this._featureType, this._attributes);
|
||||||
var links = model.getLinks()[0];
|
this._featureModel = icon.getModel();
|
||||||
this._text = links.getUrl();
|
|
||||||
topic.removeLink();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._topicId)[0];
|
||||||
topic.addLink(this._url, commandContext._designer);
|
topic.removeFeature(this._featureModel);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -19,8 +19,9 @@ mindplot.commands.AddRelationshipCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(model) {
|
initialize: function(model) {
|
||||||
$assert(model, 'Relationship model can not be null');
|
$assert(model, 'Relationship model can not be null');
|
||||||
|
|
||||||
|
this.parent();
|
||||||
this._model = model;
|
this._model = model;
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var relationship = commandContext.createRelationship(this._model);
|
var relationship = commandContext.createRelationship(this._model);
|
||||||
|
@ -16,53 +16,41 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.commands.AddTopicCommand = new Class(
|
mindplot.commands.AddTopicCommand = new Class({
|
||||||
{
|
Extends:mindplot.Command,
|
||||||
Extends:mindplot.Command,
|
initialize: function(model, parentTopicId) {
|
||||||
initialize: function(model, parentTopicId, animated) {
|
$assert(model, 'Model can not be null');
|
||||||
$assert(model, 'Model can not be null');
|
|
||||||
this._model = model;
|
|
||||||
this._parentId = parentTopicId;
|
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
this._animated = $defined(animated) ? animated : false;
|
|
||||||
},
|
|
||||||
|
|
||||||
execute: function(commandContext) {
|
this.parent();
|
||||||
|
this._model = model;
|
||||||
|
this._parentId = parentTopicId;
|
||||||
|
},
|
||||||
|
|
||||||
// Add a new topic ...
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.createTopic(this._model, !this._animated);
|
|
||||||
|
|
||||||
// Connect to topic ...
|
// Add a new topic ...
|
||||||
if ($defined(this._parentId)) {
|
var topic = commandContext.createTopic(this._model, false);
|
||||||
var parentTopic = commandContext.findTopics(this._parentId)[0];
|
|
||||||
commandContext.connect(topic, parentTopic, !this._animated);
|
|
||||||
}
|
|
||||||
|
|
||||||
var doneFn = function() {
|
// Connect to topic ...
|
||||||
// Finally, focus ...
|
if ($defined(this._parentId)) {
|
||||||
var designer = commandContext._designer;
|
var parentTopic = commandContext.findTopics(this._parentId)[0];
|
||||||
designer.onObjectFocusEvent(topic);
|
commandContext.connect(topic, parentTopic);
|
||||||
topic.setOnFocus(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this._animated) {
|
|
||||||
core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], true, doneFn);
|
|
||||||
} else {
|
|
||||||
doneFn.attempt();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
|
||||||
// Finally, delete the topic from the workspace ...
|
|
||||||
var topicId = this._model.getId();
|
|
||||||
var topic = commandContext.findTopics(topicId)[0];
|
|
||||||
var doneFn = function() {
|
|
||||||
commandContext.deleteTopic(topic);
|
|
||||||
};
|
|
||||||
if (this._animated) {
|
|
||||||
core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], false, doneFn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
doneFn.attempt();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
// Finally, focus ...
|
||||||
|
var designer = commandContext._designer;
|
||||||
|
var fade = new mindplot.util.FadeEffect([topic,topic.getOutgoingLine()], true);
|
||||||
|
fade.addEvent('complete', function() {
|
||||||
|
designer.onObjectFocusEvent(topic);
|
||||||
|
topic.setOnFocus(true);
|
||||||
|
});
|
||||||
|
fade.start();
|
||||||
|
},
|
||||||
|
|
||||||
|
undoExecute: function(commandContext) {
|
||||||
|
// Finally, delete the topic from the workspace ...
|
||||||
|
var topicId = this._model.getId();
|
||||||
|
var topic = commandContext.findTopics(topicId)[0];
|
||||||
|
commandContext.deleteTopic(topic);
|
||||||
|
}
|
||||||
|
});
|
@ -16,23 +16,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.commands.AddIconToTopicCommand = new Class({
|
mindplot.commands.ChangeFeatureToTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId, iconType) {
|
initialize: function(topicId, featureId, attributes) {
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
$assert(iconType, 'iconType can not be null');
|
$assert($defined(featureId), 'featureId can not be null');
|
||||||
this._topicsIds = topicId;
|
$assert($defined(attributes), 'attributes can not be null');
|
||||||
this._iconType = iconType;
|
|
||||||
|
this.parent();
|
||||||
|
this._topicId = topicId;
|
||||||
|
this._featureId = featureId;
|
||||||
|
this._attributes = attributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._topicId)[0];
|
||||||
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
var feature = topic.findFeatureById(this._featureId);
|
||||||
this._iconModel = iconImg.getModel();
|
|
||||||
|
var oldAttributes = feature.getAttributes();
|
||||||
|
feature.setAttributes(this._attributes);
|
||||||
|
this._attributes = oldAttributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
this.execute(commandContext);
|
||||||
topic.removeIcon(this._iconModel);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.commands.ChangeLinkToTopicCommand = new Class({
|
|
||||||
Extends:mindplot.Command,
|
|
||||||
initialize: function(topicId, url) {
|
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
|
||||||
this._topicsIds = topicId;
|
|
||||||
this._url = url;
|
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
},
|
|
||||||
|
|
||||||
execute: function(commandContext) {
|
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
|
||||||
if (topic.hasLink()) {
|
|
||||||
var model = topic.getModel();
|
|
||||||
var link = model.getLinks()[0];
|
|
||||||
this._oldUrl = link.getUrl();
|
|
||||||
topic.removeLink();
|
|
||||||
}
|
|
||||||
topic.addLink(this._url);
|
|
||||||
},
|
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
|
||||||
if (this._oldtext) {
|
|
||||||
topic.removeLink();
|
|
||||||
topic.addLink(this._oldUrl);
|
|
||||||
} else {
|
|
||||||
topic.removeLink();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.commands.ChangeNoteToTopicCommand = new Class({
|
|
||||||
Extends:mindplot.Command,
|
|
||||||
initialize: function(topicId, text) {
|
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
|
||||||
this._topicsIds = topicId;
|
|
||||||
this._text = text;
|
|
||||||
this._oldtext = null;
|
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
},
|
|
||||||
|
|
||||||
execute: function(commandContext) {
|
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
|
||||||
if (topic.hasNote()) {
|
|
||||||
var model = topic.getModel();
|
|
||||||
var notes = model.getNotes()[0];
|
|
||||||
this._oldtext = notes.getText();
|
|
||||||
topic.removeNote();
|
|
||||||
}
|
|
||||||
topic.addNote(this._text);
|
|
||||||
},
|
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
|
||||||
if (this._oldtext) {
|
|
||||||
topic.removeNote();
|
|
||||||
topic.addNote(this._oldtext);
|
|
||||||
} else {
|
|
||||||
topic.removeNote();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -21,6 +21,7 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
initialize: function(topicIds, relIds) {
|
initialize: function(topicIds, relIds) {
|
||||||
$assert($defined(topicIds), 'topicIds can not be null');
|
$assert($defined(topicIds), 'topicIds can not be null');
|
||||||
|
|
||||||
|
this.parent();
|
||||||
this._relIds = relIds;
|
this._relIds = relIds;
|
||||||
this._topicIds = topicIds;
|
this._topicIds = topicIds;
|
||||||
this._deletedTopicModels = [];
|
this._deletedTopicModels = [];
|
||||||
|
@ -25,6 +25,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
if ($defined(parentTopic))
|
if ($defined(parentTopic))
|
||||||
this._parentId = parentTopic.getId();
|
this._parentId = parentTopic.getId();
|
||||||
|
|
||||||
|
this.parent();
|
||||||
this._position = position;
|
this._position = position;
|
||||||
this._order = order;
|
this._order = order;
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
@ -58,7 +59,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
// Set position ...
|
// Set position ...
|
||||||
topic.setPosition(this._position);
|
topic.setPosition(this._position);
|
||||||
} else {
|
} else {
|
||||||
$assert("Illegal commnad state exception.");
|
$assert("Illegal command state exception.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, connect topic ...
|
// Finally, connect topic ...
|
||||||
|
@ -22,11 +22,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
$assert(commandFunc, "commandFunc must be defined");
|
$assert(commandFunc, "commandFunc must be defined");
|
||||||
$assert($defined(topicsIds), "topicsIds must be defined");
|
$assert($defined(topicsIds), "topicsIds must be defined");
|
||||||
|
|
||||||
|
this.parent();
|
||||||
this._value = value;
|
this._value = value;
|
||||||
this._topicsIds = topicsIds;
|
this._topicsIds = topicsIds;
|
||||||
this._commandFunc = commandFunc;
|
this._commandFunc = commandFunc;
|
||||||
this._oldValues = [];
|
this._oldValues = [];
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
|
@ -21,6 +21,7 @@ mindplot.commands.MoveControlPointCommand = new Class({
|
|||||||
$assert(ctrlPointController, 'line can not be null');
|
$assert(ctrlPointController, 'line can not be null');
|
||||||
$assert($defined(point), 'point can not be null');
|
$assert($defined(point), 'point can not be null');
|
||||||
|
|
||||||
|
this.parent();
|
||||||
this._ctrlPointControler = ctrlPointController;
|
this._ctrlPointControler = ctrlPointController;
|
||||||
this._line = ctrlPointController._line;
|
this._line = ctrlPointController._line;
|
||||||
this._controlPoint = this._ctrlPointControler.getControlPoint(point).clone();
|
this._controlPoint = this._ctrlPointControler.getControlPoint(point).clone();
|
||||||
@ -36,7 +37,6 @@ mindplot.commands.MoveControlPointCommand = new Class({
|
|||||||
this._endPoint = this._line.getLine().getTo().clone();
|
this._endPoint = this._line.getLine().getTo().clone();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this._id = mindplot.Command._nextUUID();
|
|
||||||
this._point = point;
|
this._point = point;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -16,21 +16,31 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId) {
|
initialize: function(topicId, featureId) {
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
this._topicsIds = topicId;
|
$assert(featureId, 'iconModel can not be null');
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
this._topicId = topicId;
|
||||||
|
this._featureId = featureId;
|
||||||
|
this._oldFeature = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._topicId)[0];
|
||||||
var model = topic.getModel();
|
|
||||||
var notes = model.getNotes()[0];
|
var feature = topic.findFeatureById(this._featureId);
|
||||||
this._text = notes.getText();
|
topic.removeFeature(feature);
|
||||||
topic.removeNote();
|
this._oldFeature = feature;
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
var topic = commandContext.findTopics(this._topicId)[0];
|
||||||
topic.addNote(this._text, commandContext._designer);
|
|
||||||
|
var feature = this._oldFeature;
|
||||||
|
topic.addFeature(feature.getType(), feature.getAttributes());
|
||||||
|
this._oldFeature = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -26,7 +26,11 @@ mindplot.widget = {};
|
|||||||
mindplot.model = {};
|
mindplot.model = {};
|
||||||
mindplot.collaboration = {};
|
mindplot.collaboration = {};
|
||||||
mindplot.collaboration.framework = {};
|
mindplot.collaboration.framework = {};
|
||||||
mindplot.collaboration.framework.brix = {};
|
mindplot.persistence = {};
|
||||||
mindplot.collaboration.framework.brix.model = {};
|
|
||||||
|
|
||||||
mindplot.layout = {};
|
mindplot.layout = {};
|
||||||
|
|
||||||
|
Class.Mutators.Static = function(items){
|
||||||
|
this.extend(items);
|
||||||
|
};
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ mindplot.layout.EventBusDispatcher = new Class({
|
|||||||
// (function() {
|
// (function() {
|
||||||
this._layoutManager.layout(true);
|
this._layoutManager.layout(true);
|
||||||
// console.log("---------");
|
// console.log("---------");
|
||||||
this._layoutManager.dump();
|
// this._layoutManager.dump();
|
||||||
// console.log("---------");
|
// console.log("---------");
|
||||||
// console.log("---------");
|
// console.log("---------");
|
||||||
// }).delay(0, this);
|
// }).delay(0, this);
|
||||||
|
@ -157,7 +157,8 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (!sibling.isFree() || overlappingOccurs) {
|
if (!sibling.isFree() || overlappingOccurs) {
|
||||||
this._treeSet.shiftBranchPosition(sibling, 0, node.getFreeDisplacement().y);
|
var sAmount = node.getFreeDisplacement().y;
|
||||||
|
this._treeSet.shiftBranchPosition(sibling, 0, sAmount);
|
||||||
shiftedBranches.push(sibling);
|
shiftedBranches.push(sibling);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
@ -167,14 +168,9 @@ mindplot.layout.OriginalLayout = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
branchesToShift.forEach(function(branch) {
|
branchesToShift.forEach(function(branch) {
|
||||||
var overlappingOccurs = shiftedBranches.some(function(shiftedBranch) {
|
var bAmount = node.getFreeDisplacement().y;
|
||||||
return this._branchesOverlap(shiftedBranch, branch, heightById);
|
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
||||||
}, this);
|
shiftedBranches.push(branch);
|
||||||
|
|
||||||
if (overlappingOccurs) {
|
|
||||||
this._treeSet.shiftBranchPosition(branch, 0, node.getFreeDisplacement().y);
|
|
||||||
shiftedBranches.push(branch);
|
|
||||||
}
|
|
||||||
last = branch;
|
last = branch;
|
||||||
},this);
|
},this);
|
||||||
},
|
},
|
||||||
|
@ -176,6 +176,10 @@ mindplot.layout.SymmetricSorter = new Class({
|
|||||||
|
|
||||||
toString:function() {
|
toString:function() {
|
||||||
return "Symmetric Sorter";
|
return "Symmetric Sorter";
|
||||||
|
},
|
||||||
|
|
||||||
|
_getVerticalPadding: function() {
|
||||||
|
return mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
76
mindplot/src/main/javascript/model/FeatureModel.js
Normal file
76
mindplot/src/main/javascript/model/FeatureModel.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* 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.model.FeatureModel = new Class({
|
||||||
|
initialize:function(type, topic) {
|
||||||
|
$assert(type, 'type can not be null');
|
||||||
|
$assert(topic, 'topic can not be null');
|
||||||
|
|
||||||
|
this._id = mindplot.model.FeatureModel._nextUUID();
|
||||||
|
this._type = type;
|
||||||
|
this._topic = topic;
|
||||||
|
this._attributes = {};
|
||||||
|
|
||||||
|
// Create type method ...
|
||||||
|
this['is' + type.camelCase() + 'Model'] = function() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
getAttributes : function() {
|
||||||
|
return Object.clone(this._attributes);
|
||||||
|
},
|
||||||
|
|
||||||
|
setAttributes : function(attributes) {
|
||||||
|
for (key in attributes) {
|
||||||
|
this["set" + key.capitalize()](attributes[key]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setAttribute : function(key, value) {
|
||||||
|
$assert(key, 'key id can not be null');
|
||||||
|
this._attributes[key] = value;
|
||||||
|
},
|
||||||
|
|
||||||
|
getAttribute : function(key) {
|
||||||
|
$assert(key, 'key id can not be null');
|
||||||
|
|
||||||
|
return this._attributes[key];
|
||||||
|
},
|
||||||
|
|
||||||
|
getTopic : function() {
|
||||||
|
return this._topic;
|
||||||
|
},
|
||||||
|
|
||||||
|
getId : function() {
|
||||||
|
return this._id;
|
||||||
|
},
|
||||||
|
|
||||||
|
getType:function() {
|
||||||
|
return this._type;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mindplot.model.FeatureModel._nextUUID = function() {
|
||||||
|
if (!$defined(this._uuid)) {
|
||||||
|
this._uuid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._uuid = this._uuid + 1;
|
||||||
|
return this._uuid;
|
||||||
|
};
|
@ -69,12 +69,12 @@ mindplot.model.INodeModel = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize : function(width, height) {
|
setImageSize : function(width, height) {
|
||||||
this.putProperty('size', '{width:' + width + ',height:' + height + '}');
|
this.putProperty('imageSize', '{width:' + width + ',height:' + height + '}');
|
||||||
},
|
},
|
||||||
|
|
||||||
getSize : function() {
|
getImageSize : function() {
|
||||||
var value = this.getProperty('size');
|
var value = this.getProperty('imageSize');
|
||||||
var result = null;
|
var result = null;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
result = eval("(" + value + ")");
|
result = eval("(" + value + ")");
|
||||||
@ -82,6 +82,24 @@ mindplot.model.INodeModel = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setImageUrl:function(url) {
|
||||||
|
this.putProperty('imageUrl', url);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getMetadata:function() {
|
||||||
|
return this.getProperty('metadata');
|
||||||
|
},
|
||||||
|
|
||||||
|
setMetadata:function(json) {
|
||||||
|
this.putProperty('metadata', json);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getImageUrl:function() {
|
||||||
|
return this.getProperty('imageUrl');
|
||||||
|
},
|
||||||
|
|
||||||
getMindmap : function() {
|
getMindmap : function() {
|
||||||
return this._mindmap;
|
return this._mindmap;
|
||||||
},
|
},
|
||||||
@ -239,58 +257,10 @@ mindplot.model.INodeModel = new Class({
|
|||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
createLink : function(url) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
addLink : function(link) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
createNote : function(text) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
addNote : function(note) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
removeNote : function(note) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
createIcon : function(iconType) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
addIcon : function(icon) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
removeIcon : function(icon) {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
removeLastIcon : function() {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
getChildren : function() {
|
getChildren : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getIcons : function() {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
getLinks : function() {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
getNotes : function() {
|
|
||||||
throw "Unsupported operation";
|
|
||||||
},
|
|
||||||
|
|
||||||
getParent : function() {
|
getParent : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
@ -328,13 +298,19 @@ mindplot.model.INodeModel = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mindplot.model.TopicShape =
|
||||||
|
{
|
||||||
|
RECTANGLE : 'rectagle',
|
||||||
|
ROUNDED_RECT : 'rounded rectagle',
|
||||||
|
ELLIPSE : 'elipse',
|
||||||
|
LINE : 'line',
|
||||||
|
IMAGE : 'image'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
|
mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic';
|
||||||
mindplot.model.INodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
|
mindplot.model.INodeModel.MAIN_TOPIC_TYPE = 'MainTopic';
|
||||||
|
|
||||||
mindplot.model.INodeModel.SHAPE_TYPE_RECT = 'rectagle';
|
|
||||||
mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle';
|
|
||||||
mindplot.model.INodeModel.SHAPE_TYPE_ELIPSE = 'elipse';
|
|
||||||
mindplot.model.INodeModel.SHAPE_TYPE_LINE = 'line';
|
|
||||||
|
|
||||||
mindplot.model.INodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
|
mindplot.model.INodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220;
|
||||||
|
|
||||||
|
@ -17,46 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.model.IconModel = new Class({
|
mindplot.model.IconModel = new Class({
|
||||||
initialize:function(iconType, topic) {
|
Extends: mindplot.model.FeatureModel,
|
||||||
$assert(iconType, 'Icon id can not be null');
|
initialize:function(topic, attributes) {
|
||||||
$assert(topic, 'topic can not be null');
|
this.parent(mindplot.model.IconModel.FEATURE_TYPE, topic);
|
||||||
|
this.setIconType(attributes.id);
|
||||||
this._iconType = iconType;
|
|
||||||
this._id = mindplot.model.IconModel._nextUUID();
|
|
||||||
this._topic = topic;
|
|
||||||
},
|
|
||||||
|
|
||||||
getId : function() {
|
|
||||||
return this._id;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getIconType : function() {
|
getIconType : function() {
|
||||||
return this._iconType;
|
return this.getAttribute('id');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
setIconType : function(iconType) {
|
setIconType : function(iconType) {
|
||||||
this._iconType = iconType;
|
$assert(iconType, 'iconType id can not be null');
|
||||||
},
|
this.setAttribute('id', iconType);
|
||||||
|
|
||||||
getTopic : function() {
|
|
||||||
return this._topic;
|
|
||||||
},
|
|
||||||
|
|
||||||
isIconModel : function() {
|
|
||||||
return true;
|
|
||||||
}});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo: This method must be implemented.
|
|
||||||
*/
|
|
||||||
mindplot.model.IconModel._nextUUID = function() {
|
|
||||||
if (!$defined(this._uuid)) {
|
|
||||||
this._uuid = 0;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
this._uuid = this._uuid + 1;
|
mindplot.model.IconModel.FEATURE_TYPE = "icon";
|
||||||
return this._uuid;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@ -17,31 +17,27 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.model.LinkModel = new Class({
|
mindplot.model.LinkModel = new Class({
|
||||||
initialize : function(url, topic) {
|
Extends: mindplot.model.FeatureModel,
|
||||||
$assert(url, 'url can not be null');
|
initialize : function(topic, attributes) {
|
||||||
$assert(topic, 'mindmap can not be null');
|
this.parent(mindplot.model.LinkModel.FEATURE_TYPE, topic);
|
||||||
this._topic = topic;
|
this.setUrl(attributes.url);
|
||||||
this.setUrl(url);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getUrl : function() {
|
getUrl : function() {
|
||||||
return this._url;
|
return this.getAttribute('url');
|
||||||
},
|
},
|
||||||
|
|
||||||
setUrl : function(url) {
|
setUrl : function(url) {
|
||||||
$assert(url, 'url can not be null');
|
$assert(url, 'url can not be null');
|
||||||
this._url = this._fixUrl(url);
|
|
||||||
this._type = this._url.contains('mailto:') ? 'mail' : 'url';
|
var fixedUrl = this._fixUrl(url);
|
||||||
|
this.setAttribute('url', fixedUrl);
|
||||||
|
|
||||||
|
var type = fixedUrl.contains('mailto:') ? 'mail' : 'url';
|
||||||
|
this.setAttribute('type', type);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopic : function() {
|
|
||||||
return this._topic;
|
|
||||||
},
|
|
||||||
|
|
||||||
isLinkModel : function() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
,
|
|
||||||
_fixUrl : function(url) {
|
_fixUrl : function(url) {
|
||||||
var result = url;
|
var result = url;
|
||||||
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
|
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
|
||||||
@ -49,4 +45,6 @@ mindplot.model.LinkModel = new Class({
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mindplot.model.LinkModel.FEATURE_TYPE = 'link';
|
@ -22,7 +22,7 @@ mindplot.model.Mindmap = new Class({
|
|||||||
this._branches = [];
|
this._branches = [];
|
||||||
this._description = null;
|
this._description = null;
|
||||||
this._relationships = [];
|
this._relationships = [];
|
||||||
this._version = $defined(version) ? version : mindplot.ModelCodeName.TANGO;
|
this._version = $defined(version) ? version : mindplot.persistence.ModelCodeName.TANGO;
|
||||||
this._id = id;
|
this._id = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -27,12 +27,41 @@ mindplot.model.NodeModel = new Class({
|
|||||||
this.setId(id);
|
this.setId(id);
|
||||||
this.setType(type);
|
this.setType(type);
|
||||||
this.areChildrenShrunken(false);
|
this.areChildrenShrunken(false);
|
||||||
this.setSize(50, 20);
|
|
||||||
|
|
||||||
this._children = [];
|
this._children = [];
|
||||||
this._icons = [];
|
this._feature = [];
|
||||||
this._links = [];
|
},
|
||||||
this._notes = [];
|
|
||||||
|
createFeature: function(type, attributes) {
|
||||||
|
return mindplot.TopicFeature.createModel(type, this, attributes);
|
||||||
|
},
|
||||||
|
|
||||||
|
addFeature: function(feature) {
|
||||||
|
$assert(feature, 'feature can not be null');
|
||||||
|
this._feature.push(feature);
|
||||||
|
},
|
||||||
|
|
||||||
|
getFeatures: function() {
|
||||||
|
return this._feature;
|
||||||
|
},
|
||||||
|
|
||||||
|
removeFeature: function(feature) {
|
||||||
|
$assert(feature, 'feature can not be null');
|
||||||
|
this._feature.erase(feature);
|
||||||
|
},
|
||||||
|
|
||||||
|
findFeatureByType : function(type) {
|
||||||
|
$assert(type, 'type can not be null');
|
||||||
|
return this._feature.filter(function(feature) {
|
||||||
|
return feature.getType() == type;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
findFeatureById : function(id) {
|
||||||
|
$assert($defined(id), 'id can not be null');
|
||||||
|
return this._feature.filter(function(feature) {
|
||||||
|
return feature.getId() == id;
|
||||||
|
})[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
getPropertiesKeys : function() {
|
getPropertiesKeys : function() {
|
||||||
@ -64,67 +93,10 @@ mindplot.model.NodeModel = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
result._properties = Object.clone(this._properties);
|
result._properties = Object.clone(this._properties);
|
||||||
result._icons = this._icons.clone();
|
result._feature = this._feature.clone();
|
||||||
result._links = this._links.clone();
|
|
||||||
result._notes = this._notes.clone();
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
addChildren : function() {
|
|
||||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
|
|
||||||
this._children.push(child);
|
|
||||||
child._parent = this;
|
|
||||||
},
|
|
||||||
|
|
||||||
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) {
|
appendChild : function(child) {
|
||||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
|
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
|
||||||
this._children.push(child);
|
this._children.push(child);
|
||||||
@ -141,18 +113,6 @@ mindplot.model.NodeModel = new Class({
|
|||||||
return this._children;
|
return this._children;
|
||||||
},
|
},
|
||||||
|
|
||||||
getIcons : function() {
|
|
||||||
return this._icons;
|
|
||||||
},
|
|
||||||
|
|
||||||
getLinks : function() {
|
|
||||||
return this._links;
|
|
||||||
},
|
|
||||||
|
|
||||||
getNotes : function() {
|
|
||||||
return this._notes;
|
|
||||||
},
|
|
||||||
|
|
||||||
getParent : function() {
|
getParent : function() {
|
||||||
return this._parent;
|
return this._parent;
|
||||||
},
|
},
|
||||||
@ -162,10 +122,12 @@ mindplot.model.NodeModel = new Class({
|
|||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
},
|
},
|
||||||
|
|
||||||
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
|
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight,targetTopicSize) {
|
||||||
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
||||||
$assert(sourcePosition, 'childPosition can not be null.');
|
$assert(sourcePosition, 'childPosition can not be null.');
|
||||||
$assert(targetTopicHeight, 'childrenWidth can not be null.');
|
$assert(targetTopicHeight, 'childrenWidth can not be null.');
|
||||||
|
$assert(targetTopicSize, 'targetTopicSize can not be null.');
|
||||||
|
|
||||||
|
|
||||||
// Only can be connected if the node is in the left or rigth.
|
// Only can be connected if the node is in the left or rigth.
|
||||||
var targetModel = this;
|
var targetModel = this;
|
||||||
@ -174,8 +136,7 @@ mindplot.model.NodeModel = new Class({
|
|||||||
var result = false;
|
var result = false;
|
||||||
|
|
||||||
if (sourceModel.getType() == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
if (sourceModel.getType() == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||||
// Finally, check current node ubication.
|
// Finally, check current node position ...
|
||||||
var targetTopicSize = targetModel.getSize();
|
|
||||||
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
|
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
|
||||||
var gap = 35 + targetTopicHeight / 2;
|
var gap = 35 + targetTopicHeight / 2;
|
||||||
if (targetModel.getChildren().length > 0) {
|
if (targetModel.getChildren().length > 0) {
|
||||||
|
@ -17,26 +17,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.model.NoteModel = new Class({
|
mindplot.model.NoteModel = new Class({
|
||||||
initialize : function(text, topic) {
|
Extends: mindplot.model.FeatureModel,
|
||||||
$assert(text, 'text text can not be null');
|
initialize : function(topic, attributes) {
|
||||||
$assert(topic, 'topic can not be null');
|
this.parent(mindplot.model.NoteModel.FEATURE_TYPE, topic);
|
||||||
this._text = text;
|
this.setText(attributes.text);
|
||||||
this._topic = topic;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getText:function() {
|
getText:function() {
|
||||||
return this._text;
|
return this.getAttribute('text');
|
||||||
},
|
},
|
||||||
|
|
||||||
setText : function(text) {
|
setText : function(text) {
|
||||||
this._text = text;
|
$assert(text, 'text can not be null');
|
||||||
},
|
this.setAttribute('text', text);
|
||||||
|
|
||||||
getTopic : function() {
|
|
||||||
return this._topic;
|
|
||||||
},
|
|
||||||
|
|
||||||
isNoteModel : function() {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mindplot.model.NoteModel.FEATURE_TYPE = "note";
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.Beta2PelaMigrator = new Class({
|
mindplot.persistence.Beta2PelaMigrator = new Class({
|
||||||
initialize : function(betaSerializer) {
|
initialize : function(betaSerializer) {
|
||||||
this._betaSerializer = betaSerializer;
|
this._betaSerializer = betaSerializer;
|
||||||
this._pelaSerializer = new mindplot.XMLMindmapSerializer_Pela();
|
this._pelaSerializer = new mindplot.persistence.XMLSerializer_Pela();
|
||||||
},
|
},
|
||||||
|
|
||||||
toXML : function(mindmap) {
|
toXML : function(mindmap) {
|
||||||
@ -28,7 +28,7 @@ mindplot.Beta2PelaMigrator = new Class({
|
|||||||
loadFromDom : function(dom, mapId) {
|
loadFromDom : function(dom, mapId) {
|
||||||
$assert($defined(mapId), "mapId can not be null");
|
$assert($defined(mapId), "mapId can not be null");
|
||||||
var mindmap = this._betaSerializer.loadFromDom(dom, mapId);
|
var mindmap = this._betaSerializer.loadFromDom(dom, mapId);
|
||||||
mindmap.setVersion(mindplot.ModelCodeName.PELA);
|
mindmap.setVersion(mindplot.persistence.ModelCodeName.PELA);
|
||||||
return mindmap;
|
return mindmap;
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.ModelCodeName = {
|
mindplot.persistence.ModelCodeName = {
|
||||||
BETA : "beta",
|
BETA : "beta",
|
||||||
PELA : "pela",
|
PELA : "pela",
|
||||||
TANGO : "tango"
|
TANGO : "tango"
|
@ -15,10 +15,10 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.Pela2TangoMigrator = new Class({
|
mindplot.persistence.Pela2TangoMigrator = new Class({
|
||||||
initialize : function(pelaSerializer) {
|
initialize : function(pelaSerializer) {
|
||||||
this._pelaSerializer = pelaSerializer;
|
this._pelaSerializer = pelaSerializer;
|
||||||
this._tangoSerializer = new mindplot.XMLMindmapSerializer_Tango();
|
this._tangoSerializer = new mindplot.persistence.XMLSerializer_Tango();
|
||||||
},
|
},
|
||||||
|
|
||||||
toXML : function(mindmap) {
|
toXML : function(mindmap) {
|
||||||
@ -28,7 +28,7 @@ mindplot.Pela2TangoMigrator = new Class({
|
|||||||
loadFromDom : function(dom, mapId) {
|
loadFromDom : function(dom, mapId) {
|
||||||
$assert($defined(mapId), "mapId can not be null");
|
$assert($defined(mapId), "mapId can not be null");
|
||||||
var mindmap = this._pelaSerializer.loadFromDom(dom, mapId);
|
var mindmap = this._pelaSerializer.loadFromDom(dom, mapId);
|
||||||
mindmap.setVersion(mindplot.ModelCodeName.TANGO);
|
mindmap.setVersion(mindplot.persistence.ModelCodeName.TANGO);
|
||||||
this._fixOrder(mindmap);
|
this._fixOrder(mindmap);
|
||||||
return mindmap;
|
return mindmap;
|
||||||
},
|
},
|
@ -15,23 +15,23 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.XMLMindmapSerializerFactory = {};
|
mindplot.persistence.XMLSerializerFactory = {};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap = function(mindmap) {
|
mindplot.persistence.XMLSerializerFactory.getSerializerFromMindmap = function(mindmap) {
|
||||||
return mindplot.XMLMindmapSerializerFactory.getSerializer(mindmap.getVersion());
|
return mindplot.persistence.XMLSerializerFactory.getSerializer(mindmap.getVersion());
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument = function(domDocument) {
|
mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument = function(domDocument) {
|
||||||
var rootElem = domDocument.documentElement;
|
var rootElem = domDocument.documentElement;
|
||||||
return mindplot.XMLMindmapSerializerFactory.getSerializer(rootElem.getAttribute("version"))
|
return mindplot.persistence.XMLSerializerFactory.getSerializer(rootElem.getAttribute("version"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory.getSerializer = function(version) {
|
mindplot.persistence.XMLSerializerFactory.getSerializer = function(version) {
|
||||||
if (!$defined(version)) {
|
if (!$defined(version)) {
|
||||||
version = mindplot.ModelCodeName.BETA;
|
version = mindplot.persistence.ModelCodeName.BETA;
|
||||||
}
|
}
|
||||||
var codeNames = mindplot.XMLMindmapSerializerFactory._codeNames;
|
var codeNames = mindplot.persistence.XMLSerializerFactory._codeNames;
|
||||||
var found = false;
|
var found = false;
|
||||||
var serializer = null;
|
var serializer = null;
|
||||||
for (var i = 0; i < codeNames.length; i++) {
|
for (var i = 0; i < codeNames.length; i++) {
|
||||||
@ -48,22 +48,22 @@ mindplot.XMLMindmapSerializerFactory.getSerializer = function(version) {
|
|||||||
return serializer;
|
return serializer;
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializerFactory._codeNames =
|
mindplot.persistence.XMLSerializerFactory._codeNames =
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
codeName:mindplot.ModelCodeName.BETA,
|
codeName:mindplot.persistence.ModelCodeName.BETA,
|
||||||
serializer: mindplot.XMLMindmapSerializer_Beta,
|
serializer: mindplot.persistence.XMLSerializer_Beta,
|
||||||
migrator:function() {
|
migrator:function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
codeName:mindplot.ModelCodeName.PELA,
|
codeName:mindplot.persistence.ModelCodeName.PELA,
|
||||||
serializer:mindplot.XMLMindmapSerializer_Pela,
|
serializer:mindplot.persistence.XMLSerializer_Pela,
|
||||||
migrator:mindplot.Beta2PelaMigrator
|
migrator:mindplot.persistence.Beta2PelaMigrator
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
codeName:mindplot.ModelCodeName.TANGO,
|
codeName:mindplot.persistence.ModelCodeName.TANGO,
|
||||||
serializer:mindplot.XMLMindmapSerializer_Tango,
|
serializer:mindplot.persistence.XMLSerializer_Tango,
|
||||||
migrator:mindplot.Pela2TangoMigrator
|
migrator:mindplot.persistence.Pela2TangoMigrator
|
||||||
}
|
}
|
||||||
];
|
];
|
@ -14,7 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.XMLMindmapSerializer_Beta = new Class({
|
mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||||
|
|
||||||
toXML : function(mindmap) {
|
toXML : function(mindmap) {
|
||||||
$assert(mindmap, "Can not save a null mindmap");
|
$assert(mindmap, "Can not save a null mindmap");
|
||||||
@ -164,11 +164,11 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
|
|||||||
var rootElem = dom.documentElement;
|
var rootElem = dom.documentElement;
|
||||||
|
|
||||||
// Is a wisemap?.
|
// Is a wisemap?.
|
||||||
$assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document.");
|
$assert(rootElem.tagName == mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document.");
|
||||||
|
|
||||||
// Start the loading process ...
|
// Start the loading process ...
|
||||||
var version = rootElem.getAttribute("version");
|
var version = rootElem.getAttribute("version");
|
||||||
version = !$defined(version) ? mindplot.ModelCodeName.BETA : version;
|
version = !$defined(version) ? mindplot.persistence.ModelCodeName.BETA : version;
|
||||||
var mindmap = new mindplot.model.Mindmap(mapId, version);
|
var mindmap = new mindplot.model.Mindmap(mapId, version);
|
||||||
|
|
||||||
var children = rootElem.childNodes;
|
var children = rootElem.childNodes;
|
||||||
@ -260,13 +260,13 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
|
|||||||
childTopic.connectTo(topic);
|
childTopic.connectTo(topic);
|
||||||
} else if (child.tagName == "icon") {
|
} else if (child.tagName == "icon") {
|
||||||
var icon = this._deserializeIcon(child, topic);
|
var icon = this._deserializeIcon(child, topic);
|
||||||
topic.addIcon(icon);
|
topic.addFeature(icon);
|
||||||
} else if (child.tagName == "link") {
|
} else if (child.tagName == "link") {
|
||||||
var link = this._deserializeLink(child, topic);
|
var link = this._deserializeLink(child, topic);
|
||||||
topic.addLink(link);
|
topic.addFeature(link);
|
||||||
} else if (child.tagName == "note") {
|
} else if (child.tagName == "note") {
|
||||||
var note = this._deserializeNote(child, topic);
|
var note = this._deserializeNote(child, topic);
|
||||||
topic.addNote(note);
|
topic.addFeature(note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,15 +277,15 @@ mindplot.XMLMindmapSerializer_Beta = new Class({
|
|||||||
_deserializeIcon : function(domElem, topic) {
|
_deserializeIcon : function(domElem, topic) {
|
||||||
var icon = domElem.getAttribute("id");
|
var icon = domElem.getAttribute("id");
|
||||||
icon = icon.replace("images/", "icons/legacy/");
|
icon = icon.replace("images/", "icons/legacy/");
|
||||||
return topic.createIcon(icon);
|
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, topic, {id:icon});
|
||||||
},
|
},
|
||||||
|
|
||||||
_deserializeLink : function(domElem, topic) {
|
_deserializeLink : function(domElem, topic) {
|
||||||
return topic.createLink(domElem.getAttribute("url"));
|
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, topic, {url:domElem.getAttribute("url")});
|
||||||
},
|
},
|
||||||
|
|
||||||
_deserializeNote : function(domElem, topic) {
|
_deserializeNote : function(domElem, topic) {
|
||||||
return topic.createNote(domElem.getAttribute("text"));
|
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, topic, {text:domElem.getAttribute("url")});
|
||||||
}});
|
}});
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE = 'map';
|
mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE = 'map';
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela = new Class({
|
mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||||
|
|
||||||
toXML : function(mindmap) {
|
toXML : function(mindmap) {
|
||||||
$assert(mindmap, "Can not save a null mindmap");
|
$assert(mindmap, "Can not save a null mindmap");
|
||||||
@ -47,8 +47,6 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
// Create Relationships
|
// Create Relationships
|
||||||
var relationships = mindmap.getRelationships();
|
var relationships = mindmap.getRelationships();
|
||||||
if (relationships.length > 0) {
|
if (relationships.length > 0) {
|
||||||
// var relationshipDom=document.createElement("relationships");
|
|
||||||
// mapElem.appendChild(relationshipDom);
|
|
||||||
for (var j = 0; j < relationships.length; j++) {
|
for (var j = 0; j < relationships.length; j++) {
|
||||||
var relationDom = this._relationshipToXML(document, relationships[j]);
|
var relationDom = this._relationshipToXML(document, relationships[j]);
|
||||||
mapElem.appendChild(relationDom);
|
mapElem.appendChild(relationDom);
|
||||||
@ -82,6 +80,11 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
var shape = topic.getShapeType();
|
var shape = topic.getShapeType();
|
||||||
if ($defined(shape)) {
|
if ($defined(shape)) {
|
||||||
parentTopic.setAttribute('shape', shape);
|
parentTopic.setAttribute('shape', shape);
|
||||||
|
|
||||||
|
if (shape == mindplot.model.TopicShape.IMAGE) {
|
||||||
|
parentTopic.setAttribute('image', topic.getImageSize().width + "," + topic.getImageSize().height + ":" + topic.getImageUrl());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topic.areChildrenShrunken()) {
|
if (topic.areChildrenShrunken()) {
|
||||||
@ -124,60 +127,43 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
parentTopic.setAttribute('brColor', brColor);
|
parentTopic.setAttribute('brColor', brColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ICONS
|
var metadata = topic.getMetadata();
|
||||||
var icons = topic.getIcons();
|
if ($defined(metadata)) {
|
||||||
for (var i = 0; i < icons.length; i++) {
|
parentTopic.setAttribute('metadata', metadata);
|
||||||
var icon = icons[i];
|
|
||||||
var iconDom = this._iconToXML(document, icon);
|
|
||||||
parentTopic.appendChild(iconDom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//LINKS
|
// Serialize features ...
|
||||||
var links = topic.getLinks();
|
var features = topic.getFeatures();
|
||||||
for (var i = 0; i < links.length; i++) {
|
for (var i = 0; i < features.length; i++) {
|
||||||
var link = links[i];
|
var feature = features[i];
|
||||||
var linkDom = this._linkToXML(document, link);
|
|
||||||
parentTopic.appendChild(linkDom);
|
|
||||||
}
|
|
||||||
|
|
||||||
var notes = topic.getNotes();
|
var featureType = feature.getType();
|
||||||
for (var i = 0; i < notes.length; i++) {
|
var featureDom = document.createElement(featureType);
|
||||||
var note = notes[i];
|
var attributes = feature.getAttributes();
|
||||||
var noteDom = this._noteToXML(document, note);
|
|
||||||
parentTopic.appendChild(noteDom);
|
for (var key in attributes) {
|
||||||
|
var value = attributes[key];
|
||||||
|
if (key == 'text') {
|
||||||
|
var cdata = document.createCDATASection(value);
|
||||||
|
featureDom.appendChild(cdata);
|
||||||
|
} else {
|
||||||
|
featureDom.setAttribute(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parentTopic.appendChild(featureDom);
|
||||||
}
|
}
|
||||||
|
|
||||||
//CHILDREN TOPICS
|
//CHILDREN TOPICS
|
||||||
var childTopics = topic.getChildren();
|
var childTopics = topic.getChildren();
|
||||||
for (var i = 0; i < childTopics.length; i++) {
|
for (var j = 0; j < childTopics.length; j++) {
|
||||||
var childTopic = childTopics[i];
|
var childTopic = childTopics[j];
|
||||||
var childDom = this._topicToXML(document, childTopic);
|
var childDom = this._topicToXML(document, childTopic);
|
||||||
parentTopic.appendChild(childDom);
|
parentTopic.appendChild(childDom);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parentTopic;
|
return parentTopic;
|
||||||
},
|
},
|
||||||
|
|
||||||
_iconToXML : function(document, icon) {
|
|
||||||
var iconDom = document.createElement("icon");
|
|
||||||
iconDom.setAttribute('id', icon.getIconType());
|
|
||||||
return iconDom;
|
|
||||||
},
|
|
||||||
|
|
||||||
_linkToXML : function(document, link) {
|
|
||||||
var linkDom = document.createElement("link");
|
|
||||||
linkDom.setAttribute('url', link.getUrl());
|
|
||||||
return linkDom;
|
|
||||||
},
|
|
||||||
|
|
||||||
_noteToXML : function(document, note) {
|
|
||||||
var noteDom = document.createElement("note");
|
|
||||||
var cdata = document.createCDATASection(note.getText());
|
|
||||||
noteDom.appendChild(cdata);
|
|
||||||
return noteDom;
|
|
||||||
},
|
|
||||||
|
|
||||||
_noteTextToXML : function(document, elem, text) {
|
_noteTextToXML : function(document, elem, text) {
|
||||||
if (text.indexOf('\n') == -1) {
|
if (text.indexOf('\n') == -1) {
|
||||||
elem.setAttribute('text', text);
|
elem.setAttribute('text', text);
|
||||||
@ -217,7 +203,7 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
var rootElem = dom.documentElement;
|
var rootElem = dom.documentElement;
|
||||||
|
|
||||||
// Is a wisemap?.
|
// Is a wisemap?.
|
||||||
$assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE, "This seem not to be a map document.");
|
$assert(rootElem.tagName == mindplot.persistence.XMLSerializer_Pela.MAP_ROOT_NODE, "This seem not to be a map document.");
|
||||||
|
|
||||||
this._idsMap = new Hash();
|
this._idsMap = new Hash();
|
||||||
// Start the loading process ...
|
// Start the loading process ...
|
||||||
@ -262,25 +248,24 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var topic = mindmap.createNode(type, id);
|
var topic = mindmap.createNode(type, id);
|
||||||
|
|
||||||
var text = domElem.getAttribute('text');
|
var text = domElem.getAttribute('text');
|
||||||
if ($defined(text)) {
|
if ($defined(text)) {
|
||||||
topic.setText(text);
|
topic.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
var order = domElem.getAttribute('order');
|
|
||||||
if ($defined(order)) {
|
|
||||||
topic.setOrder(parseInt(order));
|
|
||||||
}
|
|
||||||
|
|
||||||
var shape = domElem.getAttribute('shape');
|
var shape = domElem.getAttribute('shape');
|
||||||
if ($defined(shape)) {
|
if ($defined(shape)) {
|
||||||
topic.setShapeType(shape);
|
topic.setShapeType(shape);
|
||||||
}
|
|
||||||
|
|
||||||
var isShrink = domElem.getAttribute('shrink');
|
if (shape == mindplot.model.TopicShape.IMAGE) {
|
||||||
if ($defined(isShrink)) {
|
var image = domElem.getAttribute('image');
|
||||||
topic.setChildrenShrunken(isShrink);
|
var size = image.substring(0, image.indexOf(':'));
|
||||||
|
var url = image.substring(image.indexOf(':') + 1, image.length);
|
||||||
|
topic.setImageUrl(url);
|
||||||
|
|
||||||
|
var split = size.split(',');
|
||||||
|
topic.setImageSize(split[0], split[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fontStyle = domElem.getAttribute('fontStyle');
|
var fontStyle = domElem.getAttribute('fontStyle');
|
||||||
@ -318,51 +303,66 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
topic.setBorderColor(borderColor);
|
topic.setBorderColor(borderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var order = domElem.getAttribute('order');
|
||||||
|
if ($defined(order)) {
|
||||||
|
topic.setOrder(parseInt(order));
|
||||||
|
}
|
||||||
|
|
||||||
|
var isShrink = domElem.getAttribute('shrink');
|
||||||
|
if ($defined(isShrink)) {
|
||||||
|
topic.setChildrenShrunken(isShrink);
|
||||||
|
}
|
||||||
|
|
||||||
var position = domElem.getAttribute('position');
|
var position = domElem.getAttribute('position');
|
||||||
if ($defined(position)) {
|
if ($defined(position)) {
|
||||||
var pos = position.split(',');
|
var pos = position.split(',');
|
||||||
topic.setPosition(pos[0], pos[1]);
|
topic.setPosition(pos[0], pos[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var metadata = domElem.getAttribute('metadata');
|
||||||
|
if ($defined(metadata)) {
|
||||||
|
topic.setMetadata(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
//Creating icons and children nodes
|
//Creating icons and children nodes
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == Node.ELEMENT_NODE) {
|
if (child.nodeType == Node.ELEMENT_NODE) {
|
||||||
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note" || child.tagName == "text", 'Illegal node type:' + child.tagName);
|
|
||||||
if (child.tagName == "topic") {
|
if (child.tagName == "topic") {
|
||||||
var childTopic = this._deserializeNode(child, mindmap);
|
var childTopic = this._deserializeNode(child, mindmap);
|
||||||
childTopic.connectTo(topic);
|
childTopic.connectTo(topic);
|
||||||
} else if (child.tagName == "icon") {
|
} else if (mindplot.TopicFeature.isSupported(child.tagName)) {
|
||||||
var icon = this._deserializeIcon(child, topic);
|
|
||||||
topic.addIcon(icon);
|
// Load attributes ...
|
||||||
} else if (child.tagName == "link") {
|
var namedNodeMap = child.attributes;
|
||||||
var link = this._deserializeLink(child, topic);
|
var attributes = {};
|
||||||
topic.addLink(link);
|
for (var j = 0; j < namedNodeMap.length; j++) {
|
||||||
} else if (child.tagName == "note") {
|
var attribute = namedNodeMap.item(j);
|
||||||
var note = this._deserializeNote(child, topic);
|
attributes[attribute.name] = attribute.value;
|
||||||
topic.addNote(note);
|
}
|
||||||
|
|
||||||
|
// Has text node ?.
|
||||||
|
var textAttr = this._deserializeTextAttr(child);
|
||||||
|
if (textAttr) {
|
||||||
|
attributes['text'] = textAttr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new element ....
|
||||||
|
var featureType = child.tagName;
|
||||||
|
var feature = mindplot.TopicFeature.createModel(featureType, topic, attributes);
|
||||||
|
topic.addFeature(feature);
|
||||||
|
|
||||||
} else if (child.tagName == "text") {
|
} else if (child.tagName == "text") {
|
||||||
var nodeText = this._deserializeNodeText(child);
|
var nodeText = this._deserializeNodeText(child);
|
||||||
topic.setText(nodeText);
|
topic.setText(nodeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return topic;
|
return topic;
|
||||||
},
|
},
|
||||||
|
|
||||||
_deserializeIcon : function(domElem, topic) {
|
_deserializeTextAttr : function(domElem) {
|
||||||
var icon = domElem.getAttribute("id");
|
|
||||||
icon = icon.replace("images/", "icons/legacy/");
|
|
||||||
return topic.createIcon(icon);
|
|
||||||
},
|
|
||||||
|
|
||||||
_deserializeLink : function(domElem, topic) {
|
|
||||||
return topic.createLink(domElem.getAttribute("url"));
|
|
||||||
},
|
|
||||||
|
|
||||||
_deserializeNote : function(domElem, topic) {
|
|
||||||
var value = domElem.getAttribute("text");
|
var value = domElem.getAttribute("text");
|
||||||
if (!$defined(value)) {
|
if (!$defined(value)) {
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
@ -373,11 +373,10 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return topic.createNote(value);
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
_deserializeNodeText: function(domElem) {
|
_deserializeNodeText: function(domElem) {
|
||||||
|
|
||||||
var children = domElem.childNodes;
|
var children = domElem.childNodes;
|
||||||
var value = null;
|
var value = null;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
@ -415,4 +414,4 @@ mindplot.XMLMindmapSerializer_Pela = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE = 'map';
|
mindplot.persistence.XMLSerializer_Pela.MAP_ROOT_NODE = 'map';
|
@ -16,6 +16,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.XMLMindmapSerializer_Tango = new Class({
|
mindplot.persistence.XMLSerializer_Tango = new Class({
|
||||||
Extends: mindplot.XMLMindmapSerializer_Pela
|
Extends: mindplot.persistence.XMLSerializer_Pela
|
||||||
});
|
});
|
@ -16,24 +16,35 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
mindplot.util.FadeEffect = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends: Fx,
|
||||||
initialize: function(topicIds, iconModel) {
|
initialize: function(elements, isVisible) {
|
||||||
$assert($defined(topicIds), 'topicIds can not be null');
|
this.parent({duration:3000,frames:15,transition:'linear'});
|
||||||
$assert(iconModel, 'iconModel can not be null');
|
this._isVisible = isVisible;
|
||||||
this._topicsIds = topicIds;
|
this._element = elements;
|
||||||
this._iconModel = iconModel;
|
|
||||||
|
|
||||||
|
this.addEvent('complete', function() {
|
||||||
|
this._element.forEach(function(elem) {
|
||||||
|
if(elem){
|
||||||
|
elem.setVisibility(isVisible);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
start: function(){
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
this.parent(this._isVisible ? 0 : 1, this._isVisible ? 1 : 0);
|
||||||
topic.removeIcon(this._iconModel);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
set: function(now) {
|
||||||
var topic = commandContext.findTopics(this._topicsIds)[0];
|
this._element.forEach(function(elem) {
|
||||||
var iconType = this._iconModel.getIconType();
|
if(elem){
|
||||||
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
elem.setOpacity(now);
|
||||||
this._iconModel = iconImg.getModel();
|
}
|
||||||
|
});
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -22,7 +22,7 @@ mindplot.widget.ColorPalettePanel = new Class({
|
|||||||
initialize : function(buttonId, model, baseUrl) {
|
initialize : function(buttonId, model, baseUrl) {
|
||||||
this._baseUrl = baseUrl;
|
this._baseUrl = baseUrl;
|
||||||
this.parent(buttonId, model);
|
this.parent(buttonId, model);
|
||||||
$assert(baseUrl, "baseUrl can not be null");
|
$assert($defined(baseUrl), "baseUrl can not be null");
|
||||||
},
|
},
|
||||||
|
|
||||||
_load : function() {
|
_load : function() {
|
||||||
|
@ -34,6 +34,12 @@ mindplot.widget.IMenu = new Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
discard: function() {
|
||||||
|
var persistenceManager = mindplot.PersistenceManager.getInstance();
|
||||||
|
var mindmap = designer.getMindmap();
|
||||||
|
persistenceManager.discard(mindmap.getId());
|
||||||
|
},
|
||||||
|
|
||||||
save:function (saveElem, designer, saveHistory) {
|
save:function (saveElem, designer, saveHistory) {
|
||||||
// Load map content ...
|
// Load map content ...
|
||||||
var mindmap = designer.getMindmap();
|
var mindmap = designer.getMindmap();
|
||||||
@ -59,9 +65,9 @@ mindplot.widget.IMenu = new Class({
|
|||||||
onError: function() {
|
onError: function() {
|
||||||
if (saveHistory) {
|
if (saveHistory) {
|
||||||
saveElem.setStyle('cursor', 'pointer');
|
saveElem.setStyle('cursor', 'pointer');
|
||||||
$notify("Save could not be completed. Try latter");
|
$notify("Save could not be completed. Try latter.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
@ -19,10 +19,11 @@
|
|||||||
mindplot.widget.Menu = new Class({
|
mindplot.widget.Menu = new Class({
|
||||||
Extends: mindplot.widget.IMenu,
|
Extends: mindplot.widget.IMenu,
|
||||||
|
|
||||||
initialize : function(designer, containerId, mapId, readOnly) {
|
initialize : function(designer, containerId, mapId, readOnly, baseUrl) {
|
||||||
this.parent(designer, containerId, mapId);
|
this.parent(designer, containerId, mapId);
|
||||||
|
|
||||||
var baseUrl = "../css/widget";
|
baseUrl = !$defined(baseUrl) ? "" : baseUrl;
|
||||||
|
var widgetsBaseUrl = baseUrl + "css/widget";
|
||||||
|
|
||||||
// Stop event propagation ...
|
// Stop event propagation ...
|
||||||
$(this._containerId).addEvent('click', function(event) {
|
$(this._containerId).addEvent('click', function(event) {
|
||||||
@ -130,7 +131,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
designer.changeBackgroundColor(hex);
|
designer.changeBackgroundColor(hex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, baseUrl));
|
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl));
|
||||||
|
|
||||||
// Border color item ...
|
// Border color item ...
|
||||||
var borderColorModel =
|
var borderColorModel =
|
||||||
@ -152,7 +153,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
designer.changeBorderColor(hex);
|
designer.changeBorderColor(hex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, baseUrl));
|
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl));
|
||||||
|
|
||||||
// Font color item ...
|
// Font color item ...
|
||||||
var fontColorModel =
|
var fontColorModel =
|
||||||
@ -177,7 +178,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl));
|
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl));
|
||||||
|
|
||||||
this._addButton('export', false, false, function() {
|
this._addButton('export', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('../c/export.htm?mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/export.htm?mapId=' + mapId, null,
|
||||||
{'class': 'exportModalDialog',
|
{'class': 'exportModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
@ -265,21 +266,15 @@ mindplot.widget.Menu = new Class({
|
|||||||
var discardElem = $('discard');
|
var discardElem = $('discard');
|
||||||
if (discardElem) {
|
if (discardElem) {
|
||||||
this._addButton('discard', false, false, function() {
|
this._addButton('discard', false, false, function() {
|
||||||
|
this.discard();
|
||||||
if (!readOnly) {
|
window.location.reload();
|
||||||
displayLoading();
|
}.bind(this));
|
||||||
window.document.location = "mymaps.htm";
|
|
||||||
} else {
|
|
||||||
displayLoading();
|
|
||||||
window.document.location = "home.htm";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagElem = $('tagIt');
|
var tagElem = $('tagIt');
|
||||||
if (tagElem) {
|
if (tagElem) {
|
||||||
this._addButton('tagIt', false, false, function() {
|
this._addButton('tagIt', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('../c/tags.htm?mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/tags.htm?mapId=' + mapId, null,
|
||||||
{'class': 'tagItModalDialog',
|
{'class': 'tagItModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
@ -296,7 +291,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
var shareElem = $('shareIt');
|
var shareElem = $('shareIt');
|
||||||
if (shareElem) {
|
if (shareElem) {
|
||||||
this._addButton('shareIt', false, false, function() {
|
this._addButton('shareIt', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('../c/mymaps.htm?action=collaborator&userEmail=paulo%40pveiga.com.ar&mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/mymaps.htm?action=collaborator&mapId=' + mapId, null,
|
||||||
{'class': 'shareItModalDialog',
|
{'class': 'shareItModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
@ -314,7 +309,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
var publishElem = $('publishIt');
|
var publishElem = $('publishIt');
|
||||||
if (publishElem) {
|
if (publishElem) {
|
||||||
this._addButton('publishIt', false, false, function() {
|
this._addButton('publishIt', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('../c/publish.htm?mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/publish.htm?mapId=' + mapId, null,
|
||||||
{'class': 'publishModalDialog',
|
{'class': 'publishModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
@ -333,7 +328,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
if (historyElem) {
|
if (historyElem) {
|
||||||
|
|
||||||
this._addButton('history', false, false, function() {
|
this._addButton('history', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('../c/history.htm?action=list&goToMindmapList&mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/history.htm?action=list&goToMindmapList&mapId=' + mapId, null,
|
||||||
{'class': 'historyModalDialog',
|
{'class': 'historyModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
|
@ -26,10 +26,10 @@ mindplot.widget.TopicShapePanel = new Class({
|
|||||||
|
|
||||||
var content = new Element("div", {'class':'toolbarPanel','id':'topicShapePanel'});
|
var content = new Element("div", {'class':'toolbarPanel','id':'topicShapePanel'});
|
||||||
content.innerHTML = '' +
|
content.innerHTML = '' +
|
||||||
'<div id="rectagle" model="rectagle"><img src="../images/shape-rectangle.png" alt="Rectangle"></div>' +
|
'<div id="rectagle" model="rectagle"><img src="images/shape-rectangle.png" alt="Rectangle"></div>' +
|
||||||
'<div id="rounded_rectagle" model="rounded rectagle" ><img src="../images/shape-rectangle-round.png" alt="Rounded Rectangle"></div>' +
|
'<div id="rounded_rectagle" model="rounded rectagle" ><img src="images/shape-rectangle-round.png" alt="Rounded Rectangle"></div>' +
|
||||||
'<div id="line" model="line"><img src="../images/shape-line.png" alt="Line"></div>' +
|
'<div id="line" model="line"><img src="images/shape-line.png" alt="Line"></div>' +
|
||||||
'<div id="elipse" model="elipse"><img src="../images/shape-circle.png"></div>';
|
'<div id="elipse" model="elipse"><img src="images/shape-circle.png"></div>';
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@ TestCase("Model Migration Tests",{
|
|||||||
ids=[];
|
ids=[];
|
||||||
var domDocument = core.Utils.createDocumentFromText(mapXml);
|
var domDocument = core.Utils.createDocumentFromText(mapXml);
|
||||||
|
|
||||||
var betaSerializer = new mindplot.XMLMindmapSerializer_Beta();
|
var betaSerializer = new mindplot.persistence.XMLSerializer_Beta();
|
||||||
var betaMap = betaSerializer.loadFromDom(domDocument);
|
var betaMap = betaSerializer.loadFromDom(domDocument);
|
||||||
|
|
||||||
var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
|
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(domDocument);
|
||||||
var mindmap = serializer.loadFromDom(domDocument);
|
var mindmap = serializer.loadFromDom(domDocument);
|
||||||
|
|
||||||
//Assert that the new model is Pela
|
//Assert that the new model is Pela
|
||||||
assertEquals(mindplot.ModelCodeName.PELA, mindmap.getVersion());
|
assertEquals(mindplot.persistence.ModelCodeName.PELA, mindmap.getVersion());
|
||||||
|
|
||||||
//Assert same number of branches
|
//Assert same number of branches
|
||||||
var betaBranches = betaMap.getBranches();
|
var betaBranches = betaMap.getBranches();
|
||||||
|
@ -178,6 +178,13 @@
|
|||||||
|
|
||||||
<h3>testBalancedFreePredict:</h3>
|
<h3>testBalancedFreePredict:</h3>
|
||||||
<div id="testBalancedFreePredict1" class="col"></div>
|
<div id="testBalancedFreePredict1" class="col"></div>
|
||||||
|
|
||||||
|
<h3>testFreeReorder:</h3>
|
||||||
|
<div id="testFreeReorder1" class="col"></div>
|
||||||
|
|
||||||
|
<h3>testFreeOverlap:</h3>
|
||||||
|
<div id="testFreeOverlap1" class="col"></div>
|
||||||
|
<div id="testFreeOverlap2" class="col"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -27,6 +27,8 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
this.testSiblingOverlapping();
|
this.testSiblingOverlapping();
|
||||||
this.testRootNodeChildrenPositioning();
|
this.testRootNodeChildrenPositioning();
|
||||||
this.testBalancedFreePredict();
|
this.testBalancedFreePredict();
|
||||||
|
this.testFreeReorder();
|
||||||
|
this.testFreeOverlap();
|
||||||
},
|
},
|
||||||
|
|
||||||
testFreePosition: function() {
|
testFreePosition: function() {
|
||||||
@ -362,6 +364,76 @@ mindplot.layout.FreeTestSuite = new Class({
|
|||||||
console.log("OK!\n\n");
|
console.log("OK!\n\n");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testFreeReorder: function() {
|
||||||
|
console.log("testFreeReorder:");
|
||||||
|
var position = {x:0,y:0};
|
||||||
|
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||||
|
|
||||||
|
// Prepare a sample graph ...
|
||||||
|
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,1,0);
|
||||||
|
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,4,0);
|
||||||
|
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,5,1);
|
||||||
|
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,6,2);
|
||||||
|
|
||||||
|
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,2,2);
|
||||||
|
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,7,0);
|
||||||
|
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,8,1);
|
||||||
|
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,9,2);
|
||||||
|
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,10,3);
|
||||||
|
|
||||||
|
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,3,4);
|
||||||
|
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,11,0);
|
||||||
|
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,12,1);
|
||||||
|
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,13,2);
|
||||||
|
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,14,3);
|
||||||
|
manager.addNode(15, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,15,4);
|
||||||
|
manager.addNode(16, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,16,5);
|
||||||
|
|
||||||
|
manager.layout();
|
||||||
|
manager.moveNode(14, {x:270, y:-160});
|
||||||
|
manager.layout();
|
||||||
|
manager.plot("testFreeReorder1", {width:800, height:1200});
|
||||||
|
$assert(manager.find(14).getPosition().y > manager.find(10).getPosition().y, "Node 14 should be below branch 2");
|
||||||
|
|
||||||
|
console.log("OK!\n\n");
|
||||||
|
},
|
||||||
|
|
||||||
|
testFreeOverlap: function() {
|
||||||
|
console.log("testFreeOverlap:");
|
||||||
|
var position = {x:0,y:0};
|
||||||
|
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||||
|
|
||||||
|
// Prepare a sample graph ...
|
||||||
|
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,1,0);
|
||||||
|
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,4,0);
|
||||||
|
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,5,1);
|
||||||
|
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(1,6,2);
|
||||||
|
|
||||||
|
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,2,2);
|
||||||
|
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,7,0);
|
||||||
|
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,8,1);
|
||||||
|
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,9,2);
|
||||||
|
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(2,10,3);
|
||||||
|
|
||||||
|
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(0,3,4);
|
||||||
|
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,11,0);
|
||||||
|
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,12,1);
|
||||||
|
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,13,2);
|
||||||
|
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,14,3);
|
||||||
|
manager.addNode(15, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,15,4);
|
||||||
|
manager.addNode(16, mindplot.layout.TestSuite.NODE_SIZE, position).connectNode(3,16,5);
|
||||||
|
|
||||||
|
manager.layout();
|
||||||
|
manager.plot("testFreeOverlap1", {width:800, height:1200});
|
||||||
|
|
||||||
|
manager.moveNode(14, {x:270, y:7});
|
||||||
|
manager.layout();
|
||||||
|
manager.plot("testFreeOverlap2", {width:800, height:1200});
|
||||||
|
$assert(manager.find(2).getPosition().y > manager.find(1).getPosition().y, "Branches 1 and 2 are overlapping");
|
||||||
|
|
||||||
|
console.log("OK!\n\n");
|
||||||
|
},
|
||||||
|
|
||||||
_assertFreePosition: function(manager, id, position) {
|
_assertFreePosition: function(manager, id, position) {
|
||||||
if (id != null && position.x != null && position.y != null) {
|
if (id != null && position.x != null && position.y != null) {
|
||||||
var node = manager.find(id);
|
var node = manager.find(id);
|
||||||
|
115
pom.xml
115
pom.xml
@ -33,16 +33,53 @@
|
|||||||
|
|
||||||
<organization>
|
<organization>
|
||||||
<name>WiseMapping</name>
|
<name>WiseMapping</name>
|
||||||
<url>http://www.wisemapping.com</url>
|
<url>http://www.wisemapping.org/</url>
|
||||||
</organization>
|
</organization>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>3.0</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||||
|
<artifactId>maven-jaxb2-plugin</artifactId>
|
||||||
|
<version>0.8.1</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<inherited>true</inherited>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>2.5</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -53,20 +90,10 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.5</source>
|
<source>1.6</source>
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<inherited>true</inherited>
|
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
||||||
<version>2.8</version>
|
|
||||||
<configuration>
|
|
||||||
<configLocation>config/maven_checks.xml</configLocation>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
@ -77,9 +104,69 @@
|
|||||||
</descriptors>
|
</descriptors>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<reportPlugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jxr-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<aggregate>true</aggregate>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<reports>
|
||||||
|
<report>analyze-report</report>
|
||||||
|
</reports>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<configuration>
|
||||||
|
<linkXref>true</linkXref>
|
||||||
|
<sourceEncoding>utf-8</sourceEncoding>
|
||||||
|
<minimumTokens>100</minimumTokens>
|
||||||
|
<targetJdk>1.6</targetJdk>
|
||||||
|
<excludeRoots>
|
||||||
|
<excludeRoot>target/</excludeRoot>
|
||||||
|
</excludeRoots>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<reports>
|
||||||
|
<report>index</report>
|
||||||
|
<report>summary</report>
|
||||||
|
<report>dependency-management</report>
|
||||||
|
<report>license</report>
|
||||||
|
<report>modules</report>
|
||||||
|
</reports>
|
||||||
|
</plugin>
|
||||||
|
</reportPlugins>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<site>
|
||||||
|
<id>www.wisemapping.org</id>
|
||||||
|
<url>scp://www.wisemapping.org/docs/project/</url>
|
||||||
|
</site>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<!-- Module Dependencies -->
|
<!-- Module Dependencies -->
|
||||||
<modules>
|
<modules>
|
||||||
<module>web2d</module>
|
<module>web2d</module>
|
||||||
|
@ -87,6 +87,10 @@ web2d.Element = new Class({
|
|||||||
this._peer.addEvent(type, listener);
|
this._peer.addEvent(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fireEvent : function(type, event) {
|
||||||
|
this._peer.fireEvent(type, event);
|
||||||
|
},
|
||||||
|
|
||||||
cloneEvents : function(from) {
|
cloneEvents : function(from) {
|
||||||
this._peer.cloneEvents(from);
|
this._peer.cloneEvents(from);
|
||||||
},
|
},
|
||||||
|
@ -123,5 +123,10 @@ web2d.Group = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._peer._native.appendChild(DomElement);
|
this._peer._native.appendChild(DomElement);
|
||||||
|
},
|
||||||
|
|
||||||
|
setOpacity:function(value){
|
||||||
|
this._peer.setOpacity(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
@ -66,7 +66,7 @@ web2d.Workspace = new Class({
|
|||||||
_createDivContainer : function(domElement) {
|
_createDivContainer : function(domElement) {
|
||||||
var container = window.document.createElement("div");
|
var container = window.document.createElement("div");
|
||||||
container.id = "workspaceContainer";
|
container.id = "workspaceContainer";
|
||||||
container.style.overflow = "hidden";
|
// container.style.overflow = "hidden";
|
||||||
container.style.position = "relative";
|
container.style.position = "relative";
|
||||||
container.style.top = "0px";
|
container.style.top = "0px";
|
||||||
container.style.left = "0px";
|
container.style.left = "0px";
|
||||||
|
@ -85,6 +85,10 @@ web2d.peer.svg.ElementPeer = new Class({
|
|||||||
this._native.addEvent(type, listener);
|
this._native.addEvent(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fireEvent : function(type) {
|
||||||
|
this._native.fireEvent(type, event);
|
||||||
|
},
|
||||||
|
|
||||||
cloneEvents : function(from) {
|
cloneEvents : function(from) {
|
||||||
this._native.cloneEvents(from);
|
this._native.cloneEvents(from);
|
||||||
},
|
},
|
||||||
|
@ -73,6 +73,10 @@ web2d.peer.svg.GroupPeer = new Class({
|
|||||||
this._native.setAttribute("transform", "translate(" + cx + "," + cy + ") scale(" + sx + "," + sy + ")");
|
this._native.setAttribute("transform", "translate(" + cx + "," + cy + ") scale(" + sx + "," + sy + ")");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setOpacity : function(value) {
|
||||||
|
this._native.setAttribute("opacity", value);
|
||||||
|
},
|
||||||
|
|
||||||
setCoordOrigin : function(x, y) {
|
setCoordOrigin : function(x, y) {
|
||||||
var change = x != this._coordOrigin.x || y != this._coordOrigin.y;
|
var change = x != this._coordOrigin.x || y != this._coordOrigin.y;
|
||||||
if ($defined(x)) {
|
if ($defined(x)) {
|
||||||
|
@ -23,6 +23,7 @@ web2d.peer.svg.ImagePeer = new Class({
|
|||||||
this.parent(svgElement);
|
this.parent(svgElement);
|
||||||
this._position = {x:0,y:0};
|
this._position = {x:0,y:0};
|
||||||
this._href = "";
|
this._href = "";
|
||||||
|
this._native.setAttribute("preserveAspectRatio", "none");
|
||||||
},
|
},
|
||||||
|
|
||||||
setPosition : function(x, y) {
|
setPosition : function(x, y) {
|
||||||
|
@ -155,14 +155,25 @@ web2d.peer.svg.TextPeer = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getWidth : function () {
|
getWidth : function () {
|
||||||
var computedWidth = this._native.getBBox().width;
|
// Firefox hack for this issue:http://stackoverflow.com/questions/6390065/doing-ajax-updates-in-svg-breaks-getbbox-is-there-a-workaround
|
||||||
|
try {
|
||||||
|
var computedWidth = this._native.getBBox().width;
|
||||||
|
} catch(e) {
|
||||||
|
computedWidth = 10;
|
||||||
|
}
|
||||||
|
|
||||||
var width = parseInt(computedWidth);
|
var width = parseInt(computedWidth);
|
||||||
width = width + this._font.getWidthMargin();
|
width = width + this._font.getWidthMargin();
|
||||||
return width;
|
return width;
|
||||||
},
|
},
|
||||||
|
|
||||||
getHeight : function () {
|
getHeight : function () {
|
||||||
var computedHeight = this._native.getBBox().height;
|
// Firefox hack for this issue:http://stackoverflow.com/questions/6390065/doing-ajax-updates-in-svg-breaks-getbbox-is-there-a-workaround
|
||||||
|
try {
|
||||||
|
var computedHeight = this._native.getBBox().height;
|
||||||
|
} catch(e) {
|
||||||
|
computedHeight = 10;
|
||||||
|
}
|
||||||
return parseInt(computedHeight);
|
return parseInt(computedHeight);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 658 B |
@ -1,24 +1,18 @@
|
|||||||
<div class="modalDialog">
|
<div class="modalDialog">
|
||||||
<!-- Header can be customized -->
|
<h1>Export</h1>
|
||||||
|
|
||||||
|
|
||||||
<h1>
|
|
||||||
Export
|
|
||||||
'sss'</h1>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<form method="post" id="exportForm" name="exportForm" action="export.bin" style="height:100%;">
|
<form method="POST" id="exportForm" name="exportForm" action="http://localhost:8080/service/transform"
|
||||||
<input type="hidden" name="action" value="export">
|
style="height:100%;" enctype="application/x-www-form-urlencoded">
|
||||||
<input type="hidden" name="mapId" value="3">
|
<input name="svgXml" value="" type="hidden"/>
|
||||||
<input type="hidden" name="mapSvg" value="">
|
<input name="mapXml" value="" type="hidden"/>
|
||||||
|
<input name="filename" value="welcome" type="hidden"/>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" id="svg" name="exportFormat" value="SVG">
|
<input type="radio" id="svg" name="exportFormat" value="svg">
|
||||||
<b>
|
<b> Scalable Vector Graphics (SVG)</b>
|
||||||
Scalable Vector Graphics (SVG)
|
|
||||||
</b>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Scalable Vector Graphics (SVG) is an XML markup language for describing two-dimensional
|
Scalable Vector Graphics (SVG) is an XML markup language for describing two-dimensional
|
||||||
@ -30,9 +24,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" name="exportFormat" value="PDF" id="pdf">
|
<input type="radio" name="exportFormat" value="PDF" id="pdf">
|
||||||
<b>
|
<b>Portable Document Format (PDF)</b>
|
||||||
Portable Document Format (PDF)
|
|
||||||
</b>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Get your map as Portable Document Format(PDF) to share use in your presentations.
|
Get your map as Portable Document Format(PDF) to share use in your presentations.
|
||||||
@ -42,9 +34,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" id="freemind" name="exportFormat" value="FREEMIND" checked="checked">
|
<input type="radio" id="freemind" name="exportFormat" value="FREEMIND" checked="checked">
|
||||||
<b>
|
<b>Freemind (version 0.9.0)</b>
|
||||||
Freemind (version 0.9.0)
|
|
||||||
</b>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
FreeMind is a nice desktop mind mapping application that has the great benefit of being
|
FreeMind is a nice desktop mind mapping application that has the great benefit of being
|
||||||
@ -55,12 +45,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" name="exportFormat" id="img" value="IMG_EXPORT_FORMAT">
|
<input type="radio" name="exportFormat" id="img" value="IMG_EXPORT_FORMAT">
|
||||||
<b>
|
<b>Image File</b>
|
||||||
Image File
|
<select name="imgFormat" id="imgFormat" style="visibility:hidden;margin-left:5px;">
|
||||||
</b><select name="imgFormat" id="imgFormat" style="visibility:hidden;margin-left:5px;">
|
<option>PNG</option>
|
||||||
<option>PNG</option>
|
<option>JPEG</option>
|
||||||
<option>JPEG</option>
|
</select>
|
||||||
</select>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Get a graphic representation of your map including all colors and shapes to reuse in
|
Get a graphic representation of your map including all colors and shapes to reuse in
|
||||||
@ -71,7 +60,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="text-align:center;margin-top:10px;">
|
<td style="text-align:center;margin-top:10px;">
|
||||||
<input type="button" id="ok" value="Ok" class="btn-primary">
|
<input type="button" id="ok" value="Ok" class="btn-primary">
|
||||||
<input type="button" value="Cancel" class="btn-secondary" onclick="MOOdalBox.close();">
|
<input type="button" value="Cancel" class="btn-secondary"
|
||||||
|
onclick="MooDialog.Request.active.close();">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -92,9 +82,36 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('ok').addEvent('click', function(event) {
|
$('ok').addEvent('click', function(event) {
|
||||||
$('exportForm').submit();
|
|
||||||
|
var form = $('exportForm');
|
||||||
|
|
||||||
|
// Look for the selected format and append export suffix...
|
||||||
|
var value = $$('input[name=exportFormat]:checked')[0].get('value');
|
||||||
|
var suffix;
|
||||||
|
if (value == 'IMG_EXPORT_FORMAT') {
|
||||||
|
var selected = $('imgFormat');
|
||||||
|
suffix = selected.options[selected.selectedIndex].value;
|
||||||
|
} else {
|
||||||
|
suffix = value;
|
||||||
|
}
|
||||||
|
suffix = suffix.toLowerCase();
|
||||||
|
form.action = form.action + "." + suffix;
|
||||||
|
|
||||||
|
// Store SVG o native map...
|
||||||
|
if (suffix == "freemind") {
|
||||||
|
var mindmap = designer.getMindmap();
|
||||||
|
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromMindmap(mindmap);
|
||||||
|
var domMap = serializer.toXML(mindmap);
|
||||||
|
form.mapXml.value = core.Utils.innerXML(domMap);
|
||||||
|
} else {
|
||||||
|
form.svgXml.value = $("workspaceContainer").innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, submit map ...
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
|
||||||
MooDialog.Request.active.close();
|
MooDialog.Request.active.close();
|
||||||
});
|
});
|
||||||
document.exportForm.mapSvg.value = $("workspaceContainer").innerHTML;
|
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -1,91 +1,21 @@
|
|||||||
@import "compatibility.less";
|
@import "compatibility.less";
|
||||||
@import "../css/libraries/moodialog/css/MooDialog.css";
|
@import "css/libraries/moodialog/css/MooDialog.css";
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
/* Error Dialog ... */
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
#waitDialog {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
left: 10px;
|
|
||||||
height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#waitingContainer, #errorContainer {
|
|
||||||
position: relative;
|
|
||||||
top: 80px;
|
|
||||||
height: 120px; /*background: whitesmoke;*/
|
|
||||||
background: #FEFEFE;
|
|
||||||
opacity: .99;
|
|
||||||
padding: 15px;
|
|
||||||
width: 100%;
|
|
||||||
border: 1px solid;
|
|
||||||
border-color: #a9a9a9;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#errorContainer {
|
|
||||||
width: 400px;
|
|
||||||
border: 1px solid red;
|
|
||||||
}
|
|
||||||
|
|
||||||
#waitingContainer .loadingText {
|
|
||||||
position: relative;
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -35px;
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
height: 30px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#errorContainer .loadingText {
|
|
||||||
position: relative;
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -80px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: bold;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
height: 30px;
|
|
||||||
float: right;
|
|
||||||
padding-left: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#waitingContainer .loadingIcon {
|
|
||||||
position: relative;
|
|
||||||
background: url(../images/rebota.gif) no-repeat;
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -65px;
|
|
||||||
height: 100px;
|
|
||||||
width: 121px;
|
|
||||||
float: left;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
#errorContainer .loadingIcon {
|
|
||||||
position: relative;
|
|
||||||
background: url(../images/errorIcon.png) no-repeat;
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -65px;
|
|
||||||
height: 100px;
|
|
||||||
width: 121px;
|
|
||||||
float: left;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
/* Header & Toolbar Styles */
|
/* Header & Toolbar Styles */
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
@import "header.less";
|
@import "header.less";
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
|
||||||
div#mindplot {
|
div#mindplot {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height:100%;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../mindplot/src/main/javascript/libraries/moodialog/css/dialog-close.png
|
@ -41,7 +41,7 @@
|
|||||||
This is a simple example of how WiseMapping can be embedded in a page.
|
This is a simple example of how WiseMapping can be embedded in a page.
|
||||||
Embedding WiseMapping editor is such simple as copying this line in your page:
|
Embedding WiseMapping editor is such simple as copying this line in your page:
|
||||||
</p>
|
</p>
|
||||||
<div id="code"><iframe src="embedded.html?confUrl=../html/container.json" width="800" height="600"></iframe></div>
|
<div id="code"><iframe src="embedded.html?confUrl=html/container.json" width="800" height="600"></iframe></div>
|
||||||
<p>
|
<p>
|
||||||
The container.json file contains a set of properties that must be configured. Properties:
|
The container.json file contains a set of properties that must be configured. Properties:
|
||||||
</p>
|
</p>
|
||||||
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
<iframe src="embedded.html?confUrl=../html/container.json" width="800" height="400"></iframe>
|
<iframe src="embedded.html?confUrl=html/container.json" width="800" height="400"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<base href="../">
|
||||||
<title>WiseMapping - Editor </title>
|
<title>WiseMapping - Editor </title>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-type" content="text/html; char
|
||||||
|
set=UTF-8"/>
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<link rel="stylesheet/less" type="text/css" href="../css/editor.less"/>
|
<link rel="stylesheet/less" type="text/css" href="css/editor.less"/>
|
||||||
|
|
||||||
<script type='text/javascript' src='../js/mootools-core.js'></script>
|
<script type='text/javascript' src='js/mootools-core.js'></script>
|
||||||
<script type='text/javascript' src='../js/mootools-more.js'></script>
|
<script type='text/javascript' src='js/mootools-more.js'></script>
|
||||||
<script type='text/javascript' src='../js/core.js'></script>
|
<script type='text/javascript' src='js/core.js'></script>
|
||||||
<script type='text/javascript' src='../js/less.js'></script>
|
<script type='text/javascript' src='js/less.js'></script>
|
||||||
|
|
||||||
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@ -26,17 +29,10 @@
|
|||||||
|
|
||||||
// Load map from XML file persisted on disk...
|
// Load map from XML file persisted on disk...
|
||||||
var persistence = mindplot.PersistenceManager.getInstance();
|
var persistence = mindplot.PersistenceManager.getInstance();
|
||||||
var mindmap;
|
var mindmap = mindmap = persistence.load(mapId);
|
||||||
try {
|
|
||||||
mindmap = persistence.load(mapId);
|
|
||||||
} catch(e) {
|
|
||||||
// If the map could not be loaded, create a new empty map...
|
|
||||||
mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
|
|
||||||
}
|
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -52,72 +48,75 @@
|
|||||||
<div id="editTab" class="tabContent">
|
<div id="editTab" class="tabContent">
|
||||||
<div id="persist" class="buttonContainer">
|
<div id="persist" class="buttonContainer">
|
||||||
<div id="save" class="buttonOn" title="Save">
|
<div id="save" class="buttonOn" title="Save">
|
||||||
<img src="../images/save.png"/>
|
<img src="images/save.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="discard" class="buttonOn" title="Discard">
|
<div id="discard" class="buttonOn" title="Discard">
|
||||||
<img src="../images/discard.png"/>
|
<img src="images/discard.png"/>
|
||||||
|
</div>
|
||||||
|
<div id="export" class="buttonOn" title="Export">
|
||||||
|
<img src="images/export.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="edit" class="buttonContainer">
|
<div id="edit" class="buttonContainer">
|
||||||
<div id="undoEdition" class="buttonOn" title="Undo Edition">
|
<div id="undoEdition" class="buttonOn" title="Undo Edition">
|
||||||
<img src="../images/undo.png"/>
|
<img src="images/undo.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="redoEdition" class="buttonOn" title="Redo Edition">
|
<div id="redoEdition" class="buttonOn" title="Redo Edition">
|
||||||
<img src="../images/redo.png"/>
|
<img src="images/redo.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="zoom" class="buttonContainer">
|
<div id="zoom" class="buttonContainer">
|
||||||
<div id="zoomIn" class="buttonOn" title="Zoom In">
|
<div id="zoomIn" class="buttonOn" title="Zoom In">
|
||||||
<img src="../images/zoom-in.png"/>
|
<img src="images/zoom-in.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="zoomOut" class="buttonOn" title="Zoom Out">
|
<div id="zoomOut" class="buttonOn" title="Zoom Out">
|
||||||
<img src="../images/zoom-out.png"/>
|
<img src="images/zoom-out.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="node" class="buttonContainer">
|
<div id="node" class="buttonContainer">
|
||||||
<div id="topicShape" class="buttonExtOn" title="Topic Shape">
|
<div id="topicShape" class="buttonExtOn" title="Topic Shape">
|
||||||
<img src="../images/topic-shape.png"/>
|
<img src="images/topic-shape.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="addTopic" class="buttonOn" title="Add Topic">
|
<div id="addTopic" class="buttonOn" title="Add Topic">
|
||||||
<img src="../images/topic-add.png"/>
|
<img src="images/topic-add.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="deleteTopic" class="buttonOn" title="Delete">
|
<div id="deleteTopic" class="buttonOn" title="Delete">
|
||||||
<img src="../images/topic-delete.png"/>
|
<img src="images/topic-delete.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicBorder" class="buttonExtOn" title="Border Color">
|
<div id="topicBorder" class="buttonExtOn" title="Border Color">
|
||||||
<img src="../images/topic-border.png"/>
|
<img src="images/topic-border.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicColor" class="buttonExtOn" title="Background Color">
|
<div id="topicColor" class="buttonExtOn" title="Background Color">
|
||||||
<img src="../images/topic-color.png"/>
|
<img src="images/topic-color.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicIcon" class="buttonExtOn" title="Add Icon">
|
<div id="topicIcon" class="buttonExtOn" title="Add Icon">
|
||||||
<img src="../images/topic-icon.png"/>
|
<img src="images/topic-icon.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicNote" class="buttonOn" title="Add Note">
|
<div id="topicNote" class="buttonOn" title="Add Note">
|
||||||
<img src="../images/topic-note.png"/>
|
<img src="images/topic-note.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicLink" class="buttonOn" title="Add Link">
|
<div id="topicLink" class="buttonOn" title="Add Link">
|
||||||
<img src="../images/topic-link.png"/>
|
<img src="images/topic-link.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicRelation" class="buttonOn" title="Add Relationship">
|
<div id="topicRelation" class="buttonOn" title="Add Relationship">
|
||||||
<img src="../images/topic-relation.png"/>
|
<img src="images/topic-relation.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="font" class="buttonContainer">
|
<div id="font" class="buttonContainer">
|
||||||
<div id="fontFamily" class="buttonExtOn" title="Font Style">
|
<div id="fontFamily" class="buttonExtOn" title="Font Style">
|
||||||
<img src="../images/font-type.png"/>
|
<img src="images/font-type.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontSize" class="buttonExtOn" title="Font Size">
|
<div id="fontSize" class="buttonExtOn" title="Font Size">
|
||||||
<img src="../images/font-size.png"/>
|
<img src="images/font-size.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontBold" class="buttonOn" title="Bold Style">
|
<div id="fontBold" class="buttonOn" title="Bold Style">
|
||||||
<img src="../images/font-bold.png"/>
|
<img src="images/font-bold.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontItalic" class="buttonOn" title="Italic Style">
|
<div id="fontItalic" class="buttonOn" title="Italic Style">
|
||||||
<img src="../images/font-italic.png"/>
|
<img src="images/font-italic.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
|
<div id="fontColor" class="buttonExtOn" title="Font Color" style="padding-top:4px">
|
||||||
<img src="../images/font-color.png"/>
|
<img src="images/font-color.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -128,7 +127,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--<div style="position: absolute;align:left;background: gray;width: 100px;height: 300px;z-index: 100" id="dragPanel">-->
|
||||||
|
<!--<div id="dragIcon" style="">-->
|
||||||
|
<!--<img src="images/logo-small.png"/>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
|
<!--<script type="text/javascript">-->
|
||||||
|
<!--$("dragIcon").addEvent('mousedown', function(event) {-->
|
||||||
|
<!--event.preventDefault();-->
|
||||||
|
|
||||||
|
<!--var options = {imageUrl:"images/logo-small.png",-->
|
||||||
|
<!--imageWidth:80,-->
|
||||||
|
<!--imageHeight:43,-->
|
||||||
|
<!--metadata: "{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}"-->
|
||||||
|
<!--};-->
|
||||||
|
<!--designer.addDraggedNode(event, options);-->
|
||||||
|
<!--});-->
|
||||||
|
<!--</script>-->
|
||||||
|
|
||||||
<div id="mindplot"></div>
|
<div id="mindplot"></div>
|
||||||
<script type="text/javascript" src="../js/editor.js"></script>
|
<script type="text/javascript" src="js/editor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -2,20 +2,21 @@
|
|||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<base href="../">
|
||||||
<title>WiseMapping - Editor </title>
|
<title>WiseMapping - Editor </title>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<link rel="stylesheet/less" type="text/css" href="../css/embedded.less"/>
|
<link rel="stylesheet/less" type="text/css" href="css/embedded.less"/>
|
||||||
|
|
||||||
<script type='text/javascript' src='../js/mootools-core.js'></script>
|
<script type='text/javascript' src='js/mootools-core.js'></script>
|
||||||
<script type='text/javascript' src='../js/mootools-more.js'></script>
|
<script type='text/javascript' src='js/mootools-more.js'></script>
|
||||||
<script type='text/javascript' src='../js/core.js'></script>
|
<script type='text/javascript' src='js/core.js'></script>
|
||||||
<script type='text/javascript' src='../js/less.js'></script>
|
<script type='text/javascript' src='js/less.js'></script>
|
||||||
|
|
||||||
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@ -57,72 +58,72 @@
|
|||||||
<div id="editTab" class="tabContent">
|
<div id="editTab" class="tabContent">
|
||||||
<div id="persist" class="buttonContainer">
|
<div id="persist" class="buttonContainer">
|
||||||
<div id="save" class="buttonOn" title="Save">
|
<div id="save" class="buttonOn" title="Save">
|
||||||
<img src="../images/save.png"/>
|
<img src="images/save.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="discard" class="buttonOn" title="Discard">
|
<div id="discard" class="buttonOn" title="Discard">
|
||||||
<img src="../images/discard.png"/>
|
<img src="images/discard.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="edit" class="buttonContainer">
|
<div id="edit" class="buttonContainer">
|
||||||
<div id="undoEdition" class="buttonOn" title="Undo Edition">
|
<div id="undoEdition" class="buttonOn" title="Undo Edition">
|
||||||
<img src="../images/undo.png"/>
|
<img src="images/undo.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="redoEdition" class="buttonOn" title="Redo Edition">
|
<div id="redoEdition" class="buttonOn" title="Redo Edition">
|
||||||
<img src="../images/redo.png"/>
|
<img src="images/redo.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="zoom" class="buttonContainer">
|
<div id="zoom" class="buttonContainer">
|
||||||
<div id="zoomIn" class="buttonOn" title="Zoom In">
|
<div id="zoomIn" class="buttonOn" title="Zoom In">
|
||||||
<img src="../images/zoom-in.png"/>
|
<img src="images/zoom-in.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="zoomOut" class="buttonOn" title="Zoom Out">
|
<div id="zoomOut" class="buttonOn" title="Zoom Out">
|
||||||
<img src="../images/zoom-out.png"/>
|
<img src="images/zoom-out.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="node" class="buttonContainer">
|
<div id="node" class="buttonContainer">
|
||||||
<div id="topicShape" class="buttonExtOn" title="Topic Shape">
|
<div id="topicShape" class="buttonExtOn" title="Topic Shape">
|
||||||
<img src="../images/topic-shape.png"/>
|
<img src="images/topic-shape.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="addTopic" class="buttonOn" title="Add Topic">
|
<div id="addTopic" class="buttonOn" title="Add Topic">
|
||||||
<img src="../images/topic-add.png"/>
|
<img src="images/topic-add.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="deleteTopic" class="buttonOn" title="Delete">
|
<div id="deleteTopic" class="buttonOn" title="Delete">
|
||||||
<img src="../images/topic-delete.png"/>
|
<img src="images/topic-delete.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicBorder" class="buttonOn" title="Border Color">
|
<div id="topicBorder" class="buttonOn" title="Border Color">
|
||||||
<img src="../images/topic-border.png"/>
|
<img src="images/topic-border.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicColor" class="buttonExtOn" title="Background Color">
|
<div id="topicColor" class="buttonExtOn" title="Background Color">
|
||||||
<img src="../images/topic-color.png"/>
|
<img src="images/topic-color.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicIcon" class="buttonExtOn" title="Add Icon">
|
<div id="topicIcon" class="buttonExtOn" title="Add Icon">
|
||||||
<img src="../images/topic-icon.png"/>
|
<img src="images/topic-icon.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicNote" class="buttonOn" title="Add Note">
|
<div id="topicNote" class="buttonOn" title="Add Note">
|
||||||
<img src="../images/topic-note.png"/>
|
<img src="images/topic-note.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicLink" class="buttonOn" title="Add Link">
|
<div id="topicLink" class="buttonOn" title="Add Link">
|
||||||
<img src="../images/topic-link.png"/>
|
<img src="images/topic-link.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="topicRelation" class="buttonOn" title="Add Relationship">
|
<div id="topicRelation" class="buttonOn" title="Add Relationship">
|
||||||
<img src="../images/topic-relation.png"/>
|
<img src="images/topic-relation.png"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="font" class="buttonContainer">
|
<div id="font" class="buttonContainer">
|
||||||
<div id="fontFamily" class="buttonOn" title="Font Style">
|
<div id="fontFamily" class="buttonOn" title="Font Style">
|
||||||
<img src="../images/font-type.png"/>
|
<img src="images/font-type.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontSize" class="buttonExtOn" title="Font Size">
|
<div id="fontSize" class="buttonExtOn" title="Font Size">
|
||||||
<img src="../images/font-size.png"/>
|
<img src="images/font-size.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontBold" class="buttonOn" title="Bold Style">
|
<div id="fontBold" class="buttonOn" title="Bold Style">
|
||||||
<img src="../images/font-bold.png"/>
|
<img src="images/font-bold.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontItalic" class="buttonOn" title="Italic Style">
|
<div id="fontItalic" class="buttonOn" title="Italic Style">
|
||||||
<img src="../images/font-italic.png"/>
|
<img src="images/font-italic.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
|
<div id="fontColor" class="buttonExtOn" title="Fond Color" style="padding-top:4px">
|
||||||
<img src="../images/font-color.png"/>
|
<img src="images/font-color.png"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -135,6 +136,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="mindplot"></div>
|
<div id="mindplot"></div>
|
||||||
<script type="text/javascript" src="../js/editor.js"></script>
|
<script type="text/javascript" src="js/editor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -2,20 +2,21 @@
|
|||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<base href="../">
|
||||||
<title>WiseMapping - Editor </title>
|
<title>WiseMapping - Editor </title>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<link rel="stylesheet/less" type="text/css" href="../css/embedded.less"/>
|
<link rel="stylesheet/less" type="text/css" href="css/embedded.less"/>
|
||||||
|
|
||||||
<script type='text/javascript' src='../js/mootools-core.js'></script>
|
<script type='text/javascript' src='js/mootools-core.js'></script>
|
||||||
<script type='text/javascript' src='../js/mootools-more.js'></script>
|
<script type='text/javascript' src='js/mootools-more.js'></script>
|
||||||
<script type='text/javascript' src='../js/core.js'></script>
|
<script type='text/javascript' src='js/core.js'></script>
|
||||||
<script type='text/javascript' src='../js/less.js'></script>
|
<script type='text/javascript' src='js/less.js'></script>
|
||||||
|
|
||||||
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@ -51,6 +52,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="mindplot"></div>
|
<div id="mindplot"></div>
|
||||||
<script type="text/javascript" src="../js/editor.js"></script>
|
<script type="text/javascript" src="js/editor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
BIN
wise-editor/src/main/webapp/icons/legacy/links.png
Normal file
BIN
wise-editor/src/main/webapp/icons/legacy/links.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 957 B |
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
BIN
wise-editor/src/main/webapp/images/alert-sign.png
Normal file
BIN
wise-editor/src/main/webapp/images/alert-sign.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
@ -1,230 +1,311 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var designer = null;
|
var designer = null;
|
||||||
|
|
||||||
function buildDesigner(options) {
|
function buildDesigner(options) {
|
||||||
|
|
||||||
var container = $(options.container);
|
var container = $(options.container);
|
||||||
$assert(container, 'container could not be null');
|
$assert(container, 'container could not be null');
|
||||||
|
|
||||||
// Register load events ...
|
// Register load events ...
|
||||||
designer = new mindplot.Designer(options, container);
|
designer = new mindplot.Designer(options, container);
|
||||||
designer.addEvent('loadSuccess', function() {
|
designer.addEvent('loadSuccess', function() {
|
||||||
window.waitDialog.close();
|
window.waitDialog.close();
|
||||||
window.waitDialog.destroy();
|
window.waitDialog.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
designer.addEvent('loadError', function(e) {
|
window.onerror = function()
|
||||||
window.waitDialog.close();
|
{
|
||||||
window.waitDialog.destroy();
|
window.waitDialog.close();
|
||||||
console.log(e);
|
window.waitDialog.destroy();
|
||||||
});
|
errorDialog.show();
|
||||||
|
console.log(e);
|
||||||
|
};
|
||||||
// Configure default persistence manager ...
|
|
||||||
var persistence;
|
// Configure default persistence manager ...
|
||||||
if (options.persistenceManager) {
|
var persistence;
|
||||||
persistence = eval("new " + options.persistenceManager + "()");
|
if (options.persistenceManager) {
|
||||||
|
if (options.persistenceManager instanceof String) {
|
||||||
} else {
|
persistence = eval("new " + options.persistenceManager + "()");
|
||||||
persistence = new mindplot.LocalStorageManager();
|
}
|
||||||
}
|
else {
|
||||||
mindplot.PersistenceManager.init(persistence);
|
persistence = options.persistenceManager;
|
||||||
|
}
|
||||||
// Register toolbar event ...
|
|
||||||
if ($('toolbar')) {
|
} else {
|
||||||
var menu = new mindplot.widget.Menu(designer, 'toolbar');
|
persistence = new mindplot.LocalStorageManager();
|
||||||
|
}
|
||||||
// If a node has focus, focus can be move to another node using the keys.
|
mindplot.PersistenceManager.init(persistence);
|
||||||
designer._cleanScreen = function() {
|
|
||||||
menu.clear()
|
// Register toolbar event ...
|
||||||
};
|
if ($('toolbar')) {
|
||||||
}
|
var menu = new mindplot.widget.Menu(designer, 'toolbar', "");
|
||||||
|
|
||||||
return designer;
|
// If a node has focus, focus can be move to another node using the keys.
|
||||||
}
|
designer._cleanScreen = function() {
|
||||||
|
menu.clear()
|
||||||
|
};
|
||||||
function loadDesignerOptions(jsonConf) {
|
}
|
||||||
// Load map options ...
|
|
||||||
if (jsonConf) {
|
return designer;
|
||||||
var request = new Request.JSON({
|
}
|
||||||
url: jsonConf,
|
|
||||||
async:false,
|
|
||||||
onSuccess:
|
function loadDesignerOptions(jsonConf) {
|
||||||
function(options) {
|
// Load map options ...
|
||||||
this.options = options;
|
if (jsonConf) {
|
||||||
|
var request = new Request.JSON({
|
||||||
}.bind(this)
|
url: jsonConf,
|
||||||
}
|
async:false,
|
||||||
);
|
onSuccess:
|
||||||
request.get();
|
function(options) {
|
||||||
result = this.options;
|
this.options = options;
|
||||||
}
|
|
||||||
else {
|
}.bind(this)
|
||||||
// Set workspace screen size as default. In this way, resize issues are solved.
|
}
|
||||||
var containerSize = {
|
);
|
||||||
height: parseInt(screen.height),
|
request.get();
|
||||||
width: parseInt(screen.width)
|
result = this.options;
|
||||||
};
|
}
|
||||||
|
else {
|
||||||
var viewPort = {
|
// Set workspace screen size as default. In this way, resize issues are solved.
|
||||||
height: parseInt(window.innerHeight - 70), // Footer and Header
|
var containerSize = {
|
||||||
width: parseInt(window.innerWidth)
|
height: parseInt(screen.height),
|
||||||
};
|
width: parseInt(screen.width)
|
||||||
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort,container:'mindplot'};
|
};
|
||||||
}
|
|
||||||
return result;
|
var viewPort = {
|
||||||
}
|
height: parseInt(window.innerHeight - 70), // Footer and Header
|
||||||
|
width: parseInt(window.innerWidth)
|
||||||
editor = {};
|
};
|
||||||
editor.WaitDialog = new Class({
|
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort,container:'mindplot'};
|
||||||
Extends:MooDialog,
|
}
|
||||||
initialize : function() {
|
console.log("result:" + JSON.encode(result));
|
||||||
var panel = this._buildPanel();
|
return result;
|
||||||
this.parent({
|
}
|
||||||
closeButton:false,
|
|
||||||
destroyOnClose:true,
|
editor = {};
|
||||||
autoOpen:true,
|
editor.WaitDialog = new Class({
|
||||||
useEscKey:false,
|
Extends:MooDialog,
|
||||||
title:'Loading ...',
|
initialize : function() {
|
||||||
onInitialize: function(wrapper) {
|
var panel = this._buildPanel();
|
||||||
wrapper.setStyle('opacity', 0);
|
this.parent({
|
||||||
this.fx = new Fx.Morph(wrapper, {
|
closeButton:false,
|
||||||
duration: 100,
|
destroyOnClose:true,
|
||||||
transition: Fx.Transitions.Bounce.easeOut
|
autoOpen:true,
|
||||||
});
|
useEscKey:false,
|
||||||
this.overlay = new Overlay(this.options.inject, {
|
title:'Loading ...',
|
||||||
duration: this.options.duration
|
onInitialize: function(wrapper) {
|
||||||
});
|
wrapper.setStyle('opacity', 0);
|
||||||
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
|
this.fx = new Fx.Morph(wrapper, {
|
||||||
}
|
duration: 100,
|
||||||
,
|
transition: Fx.Transitions.Bounce.easeOut
|
||||||
|
});
|
||||||
onBeforeOpen: function() {
|
this.overlay = new Overlay(this.options.inject, {
|
||||||
this.overlay.open();
|
duration: this.options.duration
|
||||||
this.fx.start({
|
});
|
||||||
'margin-top': [-200, -100],
|
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
|
||||||
opacity: [0, 1]
|
},
|
||||||
}).chain(function() {
|
|
||||||
this.fireEvent('show');
|
onBeforeOpen: function() {
|
||||||
}.bind(this));
|
this.overlay.open();
|
||||||
}
|
this.fx.start({
|
||||||
,
|
'margin-top': [-200, -100],
|
||||||
|
opacity: [0, 1]
|
||||||
onBeforeClose: function() {
|
}).chain(function() {
|
||||||
this.fx.start({
|
this.fireEvent('show');
|
||||||
'margin-top': [-100, 0],
|
}.bind(this));
|
||||||
opacity: 0,
|
},
|
||||||
duration: 200
|
|
||||||
}).chain(function() {
|
onBeforeClose: function() {
|
||||||
this.fireEvent('hide');
|
this.fx.start({
|
||||||
}.bind(this));
|
'margin-top': [-100, 0],
|
||||||
this.overlay.close();
|
opacity: 0,
|
||||||
}}
|
duration: 200
|
||||||
)
|
}).chain(function() {
|
||||||
;
|
this.fireEvent('hide');
|
||||||
this.setContent(panel);
|
}.bind(this));
|
||||||
},
|
this.overlay.close();
|
||||||
|
}}
|
||||||
_buildPanel : function () {
|
);
|
||||||
var result = new Element('div');
|
this.setContent(panel);
|
||||||
result.setStyles({
|
},
|
||||||
'text-align':'center',
|
|
||||||
width: '400px'
|
_buildPanel : function () {
|
||||||
});
|
var result = new Element('div');
|
||||||
var img = new Element('img', {'src': '../images/ajax-loader.gif'});
|
result.setStyles({
|
||||||
img.inject(result);
|
'text-align':'center',
|
||||||
return result;
|
width: '400px'
|
||||||
},
|
});
|
||||||
|
var img = new Element('img', {'src': 'images/ajax-loader.gif'});
|
||||||
show : function() {
|
img.inject(result);
|
||||||
this.open();
|
return result;
|
||||||
}
|
},
|
||||||
|
|
||||||
});
|
show : function() {
|
||||||
|
this.open();
|
||||||
editor.Help = {
|
}
|
||||||
buildHelp:function(panel){
|
|
||||||
var container = new Element('div');
|
});
|
||||||
container.setStyles({width:'100%', textAlign:'center'});
|
|
||||||
var content1 = Help.buildContentIcon('../images/black-keyboard.png', 'Keyboard Shortcuts', function(){MOOdalBox.open('keyboard.htm','KeyBoard Shortcuts', '500px 400px', false);panel.hidePanel();});
|
|
||||||
var content2 = Help.buildContentIcon('../images/firstSteps.png', 'Editor First Steps', function(){
|
editor.FatalErrorDialog = new Class({
|
||||||
var wOpen;
|
Extends:MooDialog,
|
||||||
var sOptions;
|
initialize : function() {
|
||||||
|
var panel = this._buildPanel();
|
||||||
sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
|
this.parent({
|
||||||
sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
|
closeButton:false,
|
||||||
sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
|
destroyOnClose:true,
|
||||||
sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
|
autoOpen:true,
|
||||||
|
useEscKey:false,
|
||||||
wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
|
title:'Outch!!. An unexpected error has occurred',
|
||||||
wOpen.focus();
|
onInitialize: function(wrapper) {
|
||||||
wOpen.moveTo( 0, 0 );
|
wrapper.setStyle('opacity', 0);
|
||||||
wOpen.resizeTo( screen.availWidth, screen.availHeight );
|
this.fx = new Fx.Morph(wrapper, {
|
||||||
panel.hidePanel();
|
duration: 100,
|
||||||
});
|
transition: Fx.Transitions.Bounce.easeOut
|
||||||
|
});
|
||||||
container.addEvent('show', function(){
|
this.overlay = new Overlay(this.options.inject, {
|
||||||
content1.effect('opacity',{duration:800}).start(0,100);
|
duration: this.options.duration
|
||||||
var eff = function(){content2.effect('opacity',{duration:800}).start(0,100);};
|
});
|
||||||
eff.delay(150);
|
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
|
||||||
});
|
}
|
||||||
container.addEvent('hide', function(){
|
,
|
||||||
content1.effect('opacity').set(0);
|
|
||||||
content2.effect('opacity').set(0)
|
onBeforeOpen: function() {
|
||||||
});
|
this.overlay.open();
|
||||||
content1.inject(container);
|
this.fx.start({
|
||||||
content2.inject(container);
|
'margin-top': [-200, -100],
|
||||||
return container;
|
opacity: [0, 1]
|
||||||
},
|
}).chain(function() {
|
||||||
buildContentIcon:function(image, text, onClickFn){
|
this.fireEvent('show');
|
||||||
var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'});
|
}.bind(this));
|
||||||
|
}
|
||||||
var icon = new Element('div');
|
,
|
||||||
icon.addEvent('click',onClickFn);
|
|
||||||
var img = new Element('img');
|
onBeforeClose: function() {
|
||||||
img.setProperty('src',image);
|
this.fx.start({
|
||||||
img.inject(icon);
|
'margin-top': [-100, 0],
|
||||||
icon.inject(container);
|
opacity: 0,
|
||||||
|
duration: 200
|
||||||
var textContainer = new Element('div').setStyles({width:'100%', color:'white'});
|
}).chain(function() {
|
||||||
textContainer.innerHTML=text;
|
this.fireEvent('hide');
|
||||||
textContainer.inject(container);
|
}.bind(this));
|
||||||
|
this.overlay.close();
|
||||||
container.addEvent('mouseover', function(event){
|
}}
|
||||||
$(this).setStyle('border-top', '1px solid #BBB4D6');
|
);
|
||||||
$(this).setStyle('border-bottom', '1px solid #BBB4D6');
|
this.setContent(panel);
|
||||||
}.bindWithEvent(container));
|
},
|
||||||
container.addEvent('mouseout', function(event){
|
|
||||||
$(this).setStyle('border-top', '1px solid transparent');
|
_buildPanel : function () {
|
||||||
$(this).setStyle('border-bottom', '1px solid transparent');
|
var result = new Element('div');
|
||||||
|
result.setStyles({
|
||||||
}.bindWithEvent(container));
|
'text-align':'center',
|
||||||
return container;
|
width: '400px'
|
||||||
}
|
});
|
||||||
};
|
var p = new Element('p', {'text': 'We\'re sorry, an error has occurred and we can not process your request. Please try again, or go to the home page.'});
|
||||||
|
p.inject(result);
|
||||||
|
|
||||||
// Show loading dialog ...
|
var img = new Element('img', {'src': 'images/alert-sign.png'});
|
||||||
waitDialog = new editor.WaitDialog();
|
img.inject(result);
|
||||||
waitDialog.show();
|
|
||||||
|
return result;
|
||||||
// Loading libraries ...
|
},
|
||||||
Asset.javascript("../js/mindplot-min.js");
|
|
||||||
|
show : function() {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
editor.Help = {
|
||||||
|
buildHelp:function(panel) {
|
||||||
|
var container = new Element('div');
|
||||||
|
container.setStyles({width:'100%', textAlign:'center'});
|
||||||
|
var content1 = Help.buildContentIcon('images/black-keyboard.png', 'Keyboard Shortcuts', function() {
|
||||||
|
MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false);
|
||||||
|
panel.hidePanel();
|
||||||
|
});
|
||||||
|
var content2 = Help.buildContentIcon('images/firstSteps.png', 'Editor First Steps', function() {
|
||||||
|
var wOpen;
|
||||||
|
var sOptions;
|
||||||
|
|
||||||
|
sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
|
||||||
|
sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
|
||||||
|
sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
|
||||||
|
sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
|
||||||
|
|
||||||
|
wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
|
||||||
|
wOpen.focus();
|
||||||
|
wOpen.moveTo(0, 0);
|
||||||
|
wOpen.resizeTo(screen.availWidth, screen.availHeight);
|
||||||
|
panel.hidePanel();
|
||||||
|
});
|
||||||
|
|
||||||
|
container.addEvent('show', function() {
|
||||||
|
content1.effect('opacity', {duration:800}).start(0, 100);
|
||||||
|
var eff = function() {
|
||||||
|
content2.effect('opacity', {duration:800}).start(0, 100);
|
||||||
|
};
|
||||||
|
eff.delay(150);
|
||||||
|
});
|
||||||
|
container.addEvent('hide', function() {
|
||||||
|
content1.effect('opacity').set(0);
|
||||||
|
content2.effect('opacity').set(0)
|
||||||
|
});
|
||||||
|
content1.inject(container);
|
||||||
|
content2.inject(container);
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
buildContentIcon:function(image, text, onClickFn) {
|
||||||
|
var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'});
|
||||||
|
|
||||||
|
var icon = new Element('div');
|
||||||
|
icon.addEvent('click', onClickFn);
|
||||||
|
var img = new Element('img');
|
||||||
|
img.setProperty('src', image);
|
||||||
|
img.inject(icon);
|
||||||
|
icon.inject(container);
|
||||||
|
|
||||||
|
var textContainer = new Element('div').setStyles({width:'100%', color:'white'});
|
||||||
|
textContainer.innerHTML = text;
|
||||||
|
textContainer.inject(container);
|
||||||
|
|
||||||
|
container.addEvent('mouseover', function() {
|
||||||
|
$(this).setStyle('border-top', '1px solid #BBB4D6');
|
||||||
|
$(this).setStyle('border-bottom', '1px solid #BBB4D6');
|
||||||
|
}.bindWithEvent(container));
|
||||||
|
container.addEvent('mouseout', function() {
|
||||||
|
$(this).setStyle('border-top', '1px solid transparent');
|
||||||
|
$(this).setStyle('border-bottom', '1px solid transparent');
|
||||||
|
|
||||||
|
}.bindWithEvent(container));
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Show loading dialog ...
|
||||||
|
waitDialog = new editor.WaitDialog();
|
||||||
|
waitDialog.show();
|
||||||
|
errorDialog = new editor.FatalErrorDialog();
|
||||||
|
|
||||||
|
// Loading libraries ...
|
||||||
|
Asset.javascript("js/mindplot-min.js");
|
||||||
|
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>
|
@ -77,6 +77,24 @@
|
|||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-beans</artifactId>
|
||||||
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-tx</artifactId>
|
||||||
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
@ -94,10 +112,32 @@
|
|||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.0.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jsr173_api</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
|
<artifactId>fop</artifactId>
|
||||||
|
<version>0.94</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-oxm</artifactId>
|
<artifactId>spring-oxm</artifactId>
|
||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>antlr</groupId>
|
<groupId>antlr</groupId>
|
||||||
@ -133,19 +173,25 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-web</artifactId>
|
<artifactId>spring-security-web</artifactId>
|
||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-core</artifactId>
|
||||||
|
<version>${org.springframework.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-config</artifactId>
|
<artifactId>spring-security-config</artifactId>
|
||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.transaction</groupId>
|
<groupId>javax.transaction</groupId>
|
||||||
<artifactId>jta</artifactId>
|
<artifactId>jta</artifactId>
|
||||||
<version>1.0.1B</version>
|
<version>1.0.1B</version>
|
||||||
<scope>compile</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.octo.captcha</groupId>
|
<groupId>com.octo.captcha</groupId>
|
||||||
@ -157,37 +203,25 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-entitymanager</artifactId>
|
<artifactId>hibernate-entitymanager</artifactId>
|
||||||
<version>3.6.0.Final</version>
|
<version>3.6.0.Final</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
|
||||||
<artifactId>batik-codec</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.directwebremoting</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>dwr</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
<version>2.0.3</version>
|
<version>3.6.0.Final</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
<groupId>aopalliance</groupId>
|
||||||
<artifactId>batik-svg-dom</artifactId>
|
<artifactId>aopalliance</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>xalan</groupId>
|
|
||||||
<artifactId>xalan</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
@ -211,7 +245,7 @@
|
|||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>jstl</artifactId>
|
<artifactId>jstl</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
<scope>runtime</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.mail</groupId>
|
<groupId>javax.mail</groupId>
|
||||||
@ -245,9 +279,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<!-- Only for test purposes -->
|
<!-- Only for test purposes -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
<version>1.8.0.10</version>
|
<version>2.2.8</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -260,24 +294,31 @@
|
|||||||
<groupId>org.codehaus.jackson</groupId>
|
<groupId>org.codehaus.jackson</groupId>
|
||||||
<artifactId>jackson-mapper-asl</artifactId>
|
<artifactId>jackson-mapper-asl</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>1.9.4</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.thoughtworks.xstream</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>xstream</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.6.4</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xerces</groupId>
|
||||||
|
<artifactId>xercesImpl</artifactId>
|
||||||
|
<version>2.10.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>sql-maven-plugin</artifactId>
|
<artifactId>sql-maven-plugin</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.5</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<driver>org.hsqldb.jdbcDriver</driver>
|
<driver>org.hsqldb.jdbc.JDBCDriver</driver>
|
||||||
<url>jdbc:hsqldb:file:${basedir}/target/db/wisemapping</url>
|
<url>jdbc:hsqldb:file:${basedir}/target/db/wisemapping</url>
|
||||||
<username>sa</username>
|
<username>sa</username>
|
||||||
<!--all executions are ignored if -Dmaven.test.skipDB=true
|
<!--all executions are ignored if -Dmaven.test.skipDB=true
|
||||||
@ -293,9 +334,9 @@
|
|||||||
<version>5.1.5</version>
|
<version>5.1.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
<version>1.8.0.1</version>
|
<version>2.2.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@ -317,6 +358,7 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
|
||||||
<execution>
|
<execution>
|
||||||
<id>create-schema</id>
|
<id>create-schema</id>
|
||||||
<phase>test</phase>
|
<phase>test</phase>
|
||||||
@ -419,25 +461,94 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.7.2</version>
|
|
||||||
<configuration>
|
|
||||||
<parallel>true</parallel>
|
|
||||||
<suiteXmlFiles>
|
|
||||||
<suiteXmlFile>testng.xml</suiteXmlFile>
|
|
||||||
</suiteXmlFiles>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.mortbay.jetty</groupId>
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
<version>8.1.0.v20120127</version>
|
<version>8.1.0.v20120127</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<stopKey>foo</stopKey>
|
||||||
|
<stopPort>9999</stopPort>
|
||||||
<war>${project.build.directory}/wisemapping.war</war>
|
<war>${project.build.directory}/wisemapping.war</war>
|
||||||
<reload>automatic</reload>
|
<reload>automatic</reload>
|
||||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
<!--<scanIntervalSeconds>10</scanIntervalSeconds>-->
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run-war</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
|
<daemon>true</daemon>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-jetty</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||||
|
<artifactId>maven-jaxb2-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>mindmap-generate</id>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<schemaDirectory>src/main/resources/</schemaDirectory>
|
||||||
|
<schemaIncludes>
|
||||||
|
<include>mindmap.xsd</include>
|
||||||
|
</schemaIncludes>
|
||||||
|
<bindingDirectory>src/main/resources/</bindingDirectory>
|
||||||
|
<bindingIncludes>
|
||||||
|
<include>mindmap.xjb</include>
|
||||||
|
</bindingIncludes>
|
||||||
|
<generatePackage>com.wisemapping.jaxb.wisemap</generatePackage>
|
||||||
|
<generateDirectory>${project.build.directory}/generated-sources/xjc1</generateDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>freemind-generate</id>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<schemaDirectory>src/main/resources/</schemaDirectory>
|
||||||
|
<schemaIncludes>
|
||||||
|
<include>freemind_0.9.0.xsd</include>
|
||||||
|
</schemaIncludes>
|
||||||
|
<bindingDirectory>src/main/resources/</bindingDirectory>
|
||||||
|
<bindingIncludes>
|
||||||
|
<include>freemind_0.9.0.xjb</include>
|
||||||
|
</bindingIncludes>
|
||||||
|
<generatePackage>com.wisemapping.jaxb.freemind</generatePackage>
|
||||||
|
<generateDirectory>${project.build.directory}/generated-sources/xjc2</generateDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
@ -43,7 +43,7 @@ public class ActivationController
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final String code = request.getParameter("code");
|
final String code = request.getParameter("code");
|
||||||
userService.activateAcount(Long.parseLong(code));
|
userService.activateAccount(Long.parseLong(code));
|
||||||
modelAndView = new ModelAndView("activationAccountConfirmation");
|
modelAndView = new ModelAndView("activationAccountConfirmation");
|
||||||
}
|
}
|
||||||
catch (Throwable exc)
|
catch (Throwable exc)
|
||||||
|
@ -48,7 +48,7 @@ public class EmbeddedViewController extends BaseMultiActionController {
|
|||||||
if (userAgent.isBrowserSupported()) {
|
if (userAgent.isBrowserSupported()) {
|
||||||
view = new ModelAndView("embeddedView");
|
view = new ModelAndView("embeddedView");
|
||||||
view.addObject("mindmap", mindmap);
|
view.addObject("mindmap", mindmap);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||||
view.addObject("mapXml", xmlMap);
|
view.addObject("mapXml", xmlMap);
|
||||||
|
|
||||||
final String zoomStr = httpServletRequest.getParameter("zoom");
|
final String zoomStr = httpServletRequest.getParameter("zoom");
|
||||||
|
@ -1,214 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.wisemapping.controller;
|
|
||||||
|
|
||||||
import com.wisemapping.exporter.ExportException;
|
|
||||||
import com.wisemapping.exporter.ExportFormat;
|
|
||||||
import com.wisemapping.exporter.ExporterFactory;
|
|
||||||
import com.wisemapping.model.MindMap;
|
|
||||||
import com.wisemapping.service.MindmapService;
|
|
||||||
import com.wisemapping.view.MindMapBean;
|
|
||||||
import com.wisemapping.exporter.ExportProperties;
|
|
||||||
import com.wisemapping.filter.UserAgent;
|
|
||||||
import org.apache.batik.transcoder.TranscoderException;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import javax.xml.stream.XMLStreamException;
|
|
||||||
import javax.xml.transform.TransformerException;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
public class ExportController extends BaseMultiActionController {
|
|
||||||
private static final String IMG_EXPORT_FORMAT = "IMG_EXPORT_FORMAT";
|
|
||||||
private static final String MAP_ID_PARAMETER = "mapId";
|
|
||||||
private static final String MAP_SVG_PARAMETER = "mapSvg";
|
|
||||||
private static final String EXPORT_FORMAT_PARAMETER = "exportFormat";
|
|
||||||
private static final String IMG_SIZE_PARAMETER = "imgSize";
|
|
||||||
private static final String MAP_XML_PARAM = "mapXml";
|
|
||||||
|
|
||||||
|
|
||||||
public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
|
|
||||||
logger.info("Mindmap Controller: EXPORT action");
|
|
||||||
final MindMap mindmap = getMindmapFromRequest(httpServletRequest);
|
|
||||||
return new ModelAndView("mindmapExport", "mindmap", new MindMapBean(mindmap));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelAndView export(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
|
|
||||||
logger.info("Export Controller: exporting WiseMap action");
|
|
||||||
|
|
||||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
|
||||||
if (mapIdStr != null) {
|
|
||||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
|
||||||
try {
|
|
||||||
|
|
||||||
int mindmapId = Integer.parseInt(mapIdStr);
|
|
||||||
|
|
||||||
logger.debug("SVG Map to export:" + mapSvg);
|
|
||||||
if (mapSvg == null || mapSvg.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("SVG map could not be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
String formatStr = request.getParameter(EXPORT_FORMAT_PARAMETER);
|
|
||||||
if (IMG_EXPORT_FORMAT.endsWith(formatStr)) {
|
|
||||||
formatStr = request.getParameter("imgFormat");
|
|
||||||
}
|
|
||||||
|
|
||||||
final MindmapService service = getMindmapService();
|
|
||||||
final MindMap mindMap = service.getMindmapById(mindmapId);
|
|
||||||
|
|
||||||
// Build format properties ...
|
|
||||||
final ExportFormat format = ExportFormat.valueOf(formatStr);
|
|
||||||
final ExportProperties properties = ExportProperties.create(format);
|
|
||||||
if (properties instanceof ExportProperties.ImageProperties) {
|
|
||||||
final String sizeStr = request.getParameter(IMG_SIZE_PARAMETER);
|
|
||||||
final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
|
|
||||||
if (sizeStr != null) {
|
|
||||||
final ExportProperties.ImageProperties.Size size = ExportProperties.ImageProperties.Size.valueOf(sizeStr);
|
|
||||||
imageProperties.setSize(size);
|
|
||||||
} else {
|
|
||||||
imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
||||||
|
|
||||||
// Change image link URL.
|
|
||||||
setBaseBaseImgUrl(format, properties);
|
|
||||||
ExporterFactory.export(properties, mindMap.getUnzippedXml(), bos, mapSvg);
|
|
||||||
|
|
||||||
// If the export goes ok, write the map to the stream ...
|
|
||||||
|
|
||||||
// Set format content type...
|
|
||||||
final String contentType = format.getContentType();
|
|
||||||
response.setContentType(contentType);
|
|
||||||
|
|
||||||
// Set file name...
|
|
||||||
final String fileName = mindMap.getTitle() + "." + format.getFileExtension();
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
||||||
|
|
||||||
// Write content ...
|
|
||||||
final ServletOutputStream outputStream = response.getOutputStream();
|
|
||||||
outputStream.write(bos.toByteArray());
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
logger.error("Unexpexted error during export process", e);
|
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
|
||||||
logger.error("map: " + mapSvg);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.warn("mapIdStr is null.Image could not be imported. UserAgent:" + request.getHeaders(UserAgent.USER_AGENT_HEADER));
|
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBaseBaseImgUrl(@NotNull ExportFormat format, @NotNull ExportProperties properties) {
|
|
||||||
|
|
||||||
final String baseUrl;
|
|
||||||
if (format == ExportFormat.SVG) {
|
|
||||||
baseUrl = "http://www.wisemapping.com/images";
|
|
||||||
} else {
|
|
||||||
final ServletContext servletContext = this.getServletContext();
|
|
||||||
baseUrl = "file://" + servletContext.getRealPath("/icons/") + "/";
|
|
||||||
}
|
|
||||||
properties.setBaseImagePath(baseUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelAndView print(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
|
|
||||||
logger.info("Export Controller: printing WiseMap action");
|
|
||||||
|
|
||||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
|
||||||
int mindmapId = Integer.parseInt(mapIdStr);
|
|
||||||
final MindmapService service = getMindmapService();
|
|
||||||
final MindMap mindmap = service.getMindmapById(mindmapId);
|
|
||||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
|
||||||
|
|
||||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
||||||
try {
|
|
||||||
exportImage(response, mapSvg, bos, false);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
logger.error("Unexpexted error generating the image", e);
|
|
||||||
logger.error("map: " + mapSvg);
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE64Encoder encoder = new BASE64Encoder();
|
|
||||||
String content = encoder.encode(bos.toByteArray());
|
|
||||||
final String exportContent = "data:image/png;base64," + content;
|
|
||||||
bos.close();
|
|
||||||
|
|
||||||
ModelAndView view = new ModelAndView("mindmapPrint", "mindmap", new MindMapBean(mindmap));
|
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
|
||||||
view.addObject(MAP_XML_PARAM, xmlMap);
|
|
||||||
view.addObject(MAP_SVG_PARAMETER, exportContent);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelAndView image(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
|
|
||||||
logger.info("Export Controller: generating image WiseMap action");
|
|
||||||
|
|
||||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
|
||||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
|
||||||
try {
|
|
||||||
final ServletOutputStream outputStream = response.getOutputStream();
|
|
||||||
|
|
||||||
exportImage(response, mapSvg, outputStream, true);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
logger.error("Unexpexted error generating the image", e);
|
|
||||||
logger.error("map: " + mapSvg);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exportImage(HttpServletResponse response, String mapSvg, OutputStream outputStream, boolean setOutput) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
|
||||||
|
|
||||||
//Image Format
|
|
||||||
ExportFormat imageFormat = ExportFormat.PNG;
|
|
||||||
|
|
||||||
// Build format properties ...
|
|
||||||
final ExportProperties.ImageProperties imageProperties = new ExportProperties.ImageProperties(imageFormat);
|
|
||||||
imageProperties.setSize(ExportProperties.ImageProperties.Size.XMEDIUM);
|
|
||||||
|
|
||||||
// Change image link URL.
|
|
||||||
setBaseBaseImgUrl(imageFormat, imageProperties);
|
|
||||||
|
|
||||||
// Set format content type...
|
|
||||||
if (setOutput)
|
|
||||||
response.setContentType(imageFormat.getContentType());
|
|
||||||
|
|
||||||
// Write content ...
|
|
||||||
ExporterFactory.export(imageProperties, null, outputStream, mapSvg);
|
|
||||||
}
|
|
||||||
}
|
|
@ -50,8 +50,8 @@ public class MindmapCooker extends BaseMultiActionController {
|
|||||||
final int mapId = Integer.parseInt(mindmapId);
|
final int mapId = Integer.parseInt(mindmapId);
|
||||||
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
||||||
|
|
||||||
String nativeXml = httpServletRequest.getParameter("nativeXml");
|
String xml = httpServletRequest.getParameter("xml");
|
||||||
mindmap.setNativeXml(nativeXml);
|
mindmap.setXmlStr(xml);
|
||||||
|
|
||||||
getMindmapService().updateMindmap(mindmap, false);
|
getMindmapService().updateMindmap(mindmap, false);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class MindmapEditorController extends BaseMultiActionController {
|
|||||||
view.addObject("editorTryMode", false);
|
view.addObject("editorTryMode", false);
|
||||||
final boolean showHelp = isWelcomeMap(mindmap);
|
final boolean showHelp = isWelcomeMap(mindmap);
|
||||||
view.addObject("showHelp", showHelp);
|
view.addObject("showHelp", showHelp);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||||
view.addObject(MAP_XML_PARAM, xmlMap);
|
view.addObject(MAP_XML_PARAM, xmlMap);
|
||||||
view.addObject("user", Utils.getUser());
|
view.addObject("user", Utils.getUser());
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public class MindmapSharingController extends BaseMultiActionController {
|
|||||||
final ColaborationEmail email = new ColaborationEmail();
|
final ColaborationEmail email = new ColaborationEmail();
|
||||||
email.setSubject(request.getParameter("subject"));
|
email.setSubject(request.getParameter("subject"));
|
||||||
email.setMessage(request.getParameter("message"));
|
email.setMessage(request.getParameter("message"));
|
||||||
getMindmapService().addColaborators(mindMap, emails, role, email);
|
getMindmapService().addCollaborators(mindMap, emails, role, email);
|
||||||
|
|
||||||
return new MindMapBean(mindMap);
|
return new MindMapBean(mindMap);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user