First edit node implementation...
This commit is contained in:
132
mindplot/pom.xml
132
mindplot/pom.xml
@@ -48,7 +48,6 @@
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${basedir}/target/classes"/>
|
||||
<!-- Generated for debug -->
|
||||
<concat destfile="${basedir}/target/tmp/mindplot.js" append="false">
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="header.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="EventBus.js"/>
|
||||
@@ -97,7 +96,8 @@
|
||||
<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="BubbleTip.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="Tip.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/widget/" files="EditNoteDialog.js"/>
|
||||
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="Icon.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="LinkIcon.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="Note.js"/>
|
||||
@@ -197,12 +197,9 @@
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="footer.js"/>
|
||||
</concat>
|
||||
|
||||
<concat destfile="${basedir}/target/classes/mindplot.svg.js" append="false">
|
||||
|
||||
<filelist dir="${basedir}/../web2d/target/classes/"
|
||||
files="web2d.svg-min.js"/>
|
||||
<filelist dir="${basedir}/target/tmp/"
|
||||
files="mindplot.js"/>
|
||||
<concat destfile="${basedir}/target/classes/mindplot.js" append="false">
|
||||
<filelist dir="${basedir}/../web2d/target/classes/" files="web2d.svg-min.js"/>
|
||||
<filelist dir="${basedir}/target/tmp/" files="mindplot.js"/>
|
||||
</concat>
|
||||
</tasks>
|
||||
</configuration>
|
||||
@@ -219,126 +216,15 @@
|
||||
<goal>compress</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>src/main/javascript/</sourceDirectory>
|
||||
<outputDirectory>target/tmp/</outputDirectory>
|
||||
<sourceDirectory>${basedir}/target/tmp/</sourceDirectory>
|
||||
<outputDirectory>${basedir}/target/classes/</outputDirectory>
|
||||
|
||||
<aggregations>
|
||||
<aggregation>
|
||||
<output>${basedir}/target/tmp/mindplot-min.js</output>
|
||||
<includes>
|
||||
<include>header-min.js</include>
|
||||
<include>EventBus-min.js</include>
|
||||
<include>model/Mindmap-min.js</include>
|
||||
<include>model/NodeModel-min.js</include>
|
||||
<include>model/RelationshipModel-min.js</include>
|
||||
<include>ActionDispatcher-min.js</include>
|
||||
<include>BrixActionDispatcher-min.js</include>
|
||||
<include>LocalActionDispatcher-min.js</include>
|
||||
<include>MindmapDesigner-min.js</include>
|
||||
<include>ScreenManager-min.js</include>
|
||||
<include>Workspace-min.js</include>
|
||||
<include>ShrinkConnector-min.js</include>
|
||||
<include>NodeGraph-min.js</include>
|
||||
<include>Topic-min.js</include>
|
||||
<include>CentralTopic-min.js</include>
|
||||
<include>MainTopic-min.js</include>
|
||||
<include>DragTopic-min.js</include>
|
||||
<include>DragManager-min.js</include>
|
||||
<include>DragPivot-min.js</include>
|
||||
<include>CentralTopicBoard-min.js</include>
|
||||
<include>MainTopicBoard-min.js</include>
|
||||
<include>ConnectionLine-min.js</include>
|
||||
<include>RelationshipLine-min.js</include>
|
||||
<include>DragTopicPositioner-min.js</include>
|
||||
<include>Board-min.js</include>
|
||||
<include>TextEditor-min.js</include>
|
||||
<include>RichTextEditor-min.js</include>
|
||||
<include>TextEditorFactory-min.js</include>
|
||||
<include>VariableDistanceBoard-min.js</include>
|
||||
<include>util/Shape-min.js</include>
|
||||
<include>FixedDistanceBoard-min.js</include>
|
||||
<include>BoardEntry-min.js</include>
|
||||
<include>ModelCodeName-min.js</include>
|
||||
<include>XMLMindmapSerializer_Beta-min.js</include>
|
||||
<include>XMLMindmapSerializer_Pela-min.js</include>
|
||||
<include>Beta2PelaMigrator-min.js</include>
|
||||
<include>XMLMindmapSerializerFactory-min.js</include>
|
||||
<include>PersistanceManager-min.js</include>
|
||||
<include>EditorProperties-min.js</include>
|
||||
<include>IconGroup-min.js</include>
|
||||
<include>BubbleTip-min.js</include>
|
||||
<include>Tip-min.js</include>
|
||||
<include>Icon-min.js</include>
|
||||
<include>LinkIcon-min.js</include>
|
||||
<include>Note-min.js</include>
|
||||
<include>ActionIcon-min.js</include>
|
||||
<include>ImageIcon-min.js</include>
|
||||
<include>model/IconModel-min.js</include>
|
||||
<include>model/LinkModel-min.js</include>
|
||||
<include>model/NoteModel-min.js</include>
|
||||
<include>EditorOptions-min.js</include>
|
||||
|
||||
<include>Command-min.js</include>
|
||||
<include>DesignerActionRunner-min.js</include>
|
||||
<include>DesignerUndoManager-min.js</include>
|
||||
|
||||
<include>commands/GenericFunctionCommand-min.js</include>
|
||||
<include>commands/DeleteTopicCommand-min.js</include>
|
||||
<include>commands/DragTopicCommand-min.js</include>
|
||||
<include>commands/AddTopicCommand-min.js</include>
|
||||
<include>commands/AddLinkToTopicCommand-min.js</include>
|
||||
<include>commands/RemoveLinkFromTopicCommand-min.js</include>
|
||||
<include>commands/AddIconToTopicCommand-min.js</include>
|
||||
<include>commands/RemoveIconFromTopicCommand-min.js</include>
|
||||
<include>commands/AddNoteToTopicCommand-min.js</include>
|
||||
<include>commands/RemoveNoteFromTopicCommand-min.js</include>
|
||||
<include>commands/AddRelationshipCommand-min.js</include>
|
||||
<include>commands/MoveControlPointCommand-min.js</include>
|
||||
<include>commands/freeMind/DragTopicCommand-min.js</include>
|
||||
<include>commands/freeMind/ReconnectTopicCommand-min.js</include>
|
||||
|
||||
<include>layout/boards/Board-min.js</include>
|
||||
<include>layout/boards/freemind/Board-min.js</include>
|
||||
<include>layout/boards/freemind/Entry-min.js</include>
|
||||
<include>layout/boards/freemind/CentralTopicBoard-min.js</include>
|
||||
<include>layout/boards/freemind/MainTopicBoard-min.js</include>
|
||||
<include>layout/BaseLayoutManager-min.js</include>
|
||||
<include>layout/OriginalLayoutManager-min.js</include>
|
||||
<include>layout/FreeMindLayoutManager-min.js</include>
|
||||
<include>layout/LayoutManagerFactory-min.js</include>
|
||||
|
||||
<include>collaboration/CollaborationManager-min.js</include>
|
||||
<include>collaboration/frameworks/AbstractCollaborativeFramework-min.js
|
||||
</include>
|
||||
<include>collaboration/frameworks/AbstractCollaborativeModelFactory-min.js
|
||||
</include>
|
||||
<include>collaboration/frameworks/brix/model/NodeModel-min.js</include>
|
||||
<include>collaboration/frameworks/brix/model/Mindmap-min.js</include>
|
||||
<include>collaboration/frameworks/brix/BrixCollaborativeModelFactory-min.js
|
||||
</include>
|
||||
<include>collaboration/frameworks/brix/BrixFramework-min.js</include>
|
||||
|
||||
<include>widget/IconPanel-min.js</include>
|
||||
<include>widget/ListToolbarPanel-min.js</include>
|
||||
<include>widget/FontFamilyPanel-min.js</include>
|
||||
<include>widget/FontSizePanel-min.js</include>
|
||||
<include>widget/TopicShapePanel-min.js</include>
|
||||
<include>widget/Menu-min.js</include>
|
||||
|
||||
<include>footer-min.js</include>
|
||||
|
||||
</includes>
|
||||
</aggregation>
|
||||
<aggregation>
|
||||
<output>${basedir}/target/classes/mindplot.svg-min.js</output>
|
||||
<includes>
|
||||
<include>${basedir}/../web2d/target/classes/web2d.svg-min.js</include>
|
||||
<include>${basedir}/target/tmp/mindplot-min.js</include>
|
||||
</includes>
|
||||
<output>${basedir}/target/classes/mindplot-min.js</output>
|
||||
</aggregation>
|
||||
</aggregations>
|
||||
<nomunge>true</nomunge>
|
||||
<jswarn>false</jswarn>
|
||||
<jswarn>true</jswarn>
|
||||
<force>true</force>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@@ -29,6 +29,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
|
||||
// Try with the keyboard ..
|
||||
var model = designer.getModel();
|
||||
var keyboardEvents = {
|
||||
'backspace':function(event) {
|
||||
event.preventDefault();
|
||||
@@ -36,7 +37,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'space' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
var model = topic.getModel();
|
||||
var isShrink = !model.areChildrenShrinked();
|
||||
@@ -45,7 +46,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'f2' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
node.showTextEditor();
|
||||
}
|
||||
@@ -129,7 +130,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
},
|
||||
|
||||
'right' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToSideChild(designer, node, 'RIGHT');
|
||||
@@ -149,7 +150,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'left' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToSideChild(designer, node, 'LEFT');
|
||||
@@ -169,7 +170,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'up' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToBrother(designer, node, 'UP');
|
||||
@@ -181,7 +182,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'down' : function() {
|
||||
var node = this._getSelectedNode(designer);
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
this._goToBrother(designer, node, 'DOWN');
|
||||
@@ -320,11 +321,6 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
// Give focus to the selected node....
|
||||
node.setOnFocus(true);
|
||||
},
|
||||
|
||||
_getSelectedNode : function(designer) {
|
||||
var nodes = designer.getModel().filterSelectedTopics();
|
||||
return (nodes.length > 0) ? nodes[0] : null;
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -84,7 +84,7 @@ mindplot.DesignerModel = new Class({
|
||||
var result = [];
|
||||
var topics = this.filterSelectedTopics();
|
||||
|
||||
if (topics.length==0) {
|
||||
if (topics.length == 0) {
|
||||
core.Monitor.getInstance().logMessage('At least one element must be selected to execute this operation.');
|
||||
} else {
|
||||
var isValid = true;
|
||||
@@ -131,6 +131,11 @@ mindplot.DesignerModel = new Class({
|
||||
|
||||
getRelationshipsById : function() {
|
||||
return this._relationships;
|
||||
},
|
||||
|
||||
selectedTopic : function() {
|
||||
var topics = this.filterSelectedTopics();
|
||||
return (topics.length > 0) ? topics[0] : null;
|
||||
}
|
||||
|
||||
});
|
@@ -50,6 +50,11 @@ mindplot.Icon = new Class({
|
||||
|
||||
addEvent : function(type, fnc) {
|
||||
this._image.addEvent(type, fnc);
|
||||
},
|
||||
|
||||
remove : function()
|
||||
{
|
||||
throw "Unsupported operation";
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -220,8 +220,7 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
// Register events ...
|
||||
var widget = this._buildWeb2d();
|
||||
widget.addEvent('click', function() {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.removeIconFromTopic(topicId, icon._iconModel);
|
||||
icon.remove();
|
||||
});
|
||||
|
||||
widget.addEvent('mouseover', function() {
|
||||
|
@@ -104,6 +104,11 @@ mindplot.ImageIcon = new Class({
|
||||
|
||||
getUiId : function() {
|
||||
return this._uiId;
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.removeIconFromTopic(this._topic.getModel(), this._iconModel);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -744,6 +744,7 @@ mindplot.MindmapDesigner = new Class({
|
||||
}
|
||||
return result;
|
||||
}.bind(this);
|
||||
|
||||
var dialog = mindplot.LinkIcon.buildDialog(this, okFunction, okButtonId);
|
||||
dialog.adopt(msg).show();
|
||||
|
||||
@@ -757,51 +758,11 @@ mindplot.MindmapDesigner = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
addNote2Node : function(text) {
|
||||
var topicsIds = this.getModel().filterTopicsIds();
|
||||
if (topicsIds.length > 0) {
|
||||
this._actionDispatcher.addNoteToTopic(topicsIds[0], text);
|
||||
}
|
||||
},
|
||||
|
||||
addNote : function() {
|
||||
var selectedTopics = this.getModel().filterSelectedTopics();
|
||||
var topic = null;
|
||||
if (selectedTopics.length > 0) {
|
||||
topic = selectedTopics[0];
|
||||
if (!$defined(topic._hasNote)) {
|
||||
var msg = new Element('div');
|
||||
var text = new Element('div').inject(msg);
|
||||
var formElem = new Element('form', {'action': 'none', 'id':'noteFormId'});
|
||||
var textInput = new Element('textarea').setStyles({'width':280, 'height':50});
|
||||
textInput.inject(formElem);
|
||||
formElem.inject(msg);
|
||||
|
||||
var okButtonId = "noteOkButtonId";
|
||||
formElem.addEvent('submit', function(e) {
|
||||
$(okButtonId).fireEvent('click', e);
|
||||
e = new Event(e);
|
||||
e.stop();
|
||||
});
|
||||
|
||||
|
||||
var okFunction = function() {
|
||||
var text = textInput.value;
|
||||
var result = false;
|
||||
if ("" != text.trim()) {
|
||||
this.addNote2Node(text);
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}.bind(this);
|
||||
var dialog = mindplot.Note.buildDialog(this, okFunction, okButtonId);
|
||||
dialog.adopt(msg).show();
|
||||
|
||||
// IE doesn't like too much this focus action...
|
||||
if (!core.UserAgent.isIE()) {
|
||||
textInput.focus();
|
||||
}
|
||||
}
|
||||
var model = this.getModel();
|
||||
var topic = model.selectedTopic();
|
||||
if (topic!=null) {
|
||||
topic.showNoteEditor();
|
||||
} else {
|
||||
core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.');
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ mindplot.NodeGraph = new Class({
|
||||
this._mouseEvents = true;
|
||||
this.setModel(nodeModel);
|
||||
this._onFocus = false;
|
||||
this._textEditor = new mindplot.TextEditor(this);
|
||||
},
|
||||
|
||||
getType : function() {
|
||||
@@ -126,14 +125,6 @@ mindplot.NodeGraph = new Class({
|
||||
getPosition : function() {
|
||||
var model = this.getModel();
|
||||
return model.getPosition();
|
||||
},
|
||||
|
||||
showTextEditor : function(text) {
|
||||
this._textEditor.show(text);
|
||||
},
|
||||
|
||||
closeEditors : function() {
|
||||
this._textEditor.close(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -18,100 +18,22 @@
|
||||
|
||||
mindplot.Note = new Class({
|
||||
Extends: mindplot.Icon,
|
||||
initialize : function(textModel, topic, designer) {
|
||||
var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
|
||||
var bubbleTip = mindplot.BubbleTip.getInstance(divContainer);
|
||||
initialize : function(topic, noteModel) {
|
||||
this.parent(mindplot.Note.IMAGE_URL);
|
||||
this._noteModel = textModel;
|
||||
this._noteModel = noteModel;
|
||||
this._topic = topic;
|
||||
this._designer = designer;
|
||||
var image = this.getImage();
|
||||
var imgContainer = new Element('div').setStyles({textAlign:'center'});
|
||||
this._textElem = new Element('div').setStyles({'max-height':100,'max-width':300, 'overflow':'auto'});
|
||||
var text = unescape(textModel.getText());
|
||||
text = text.replace(/\n/ig, "<br/>");
|
||||
text = text.replace(/<script/ig, "<script");
|
||||
text = text.replace(/<\/script/ig, "<\/script");
|
||||
this._textElem.innerHTML = text;
|
||||
this._text = textModel.getText();
|
||||
|
||||
this._textElem.inject(imgContainer);
|
||||
this._registerEvents();
|
||||
},
|
||||
|
||||
var container = new Element('div');
|
||||
_registerEvents : function() {
|
||||
this._image.setCursor('pointer');
|
||||
|
||||
imgContainer.inject(container);
|
||||
|
||||
if (!$defined(designer._readOnly) || ($defined(designer._readOnly) && !designer._readOnly)) {
|
||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
|
||||
var editBtn = new Element('input', {type:'button', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer);
|
||||
var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer);
|
||||
|
||||
editBtn.setStyle("margin-right", "3px");
|
||||
removeBtn.setStyle("margin-left", "3px");
|
||||
|
||||
removeBtn.addEvent('click', function(event) {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.removeNoteFromTopic(this._topic.getId());
|
||||
|
||||
bubbleTip.forceClose();
|
||||
}.bindWithEvent(this));
|
||||
|
||||
var okButtonId = 'okNoteButtonId';
|
||||
editBtn.addEvent('click', function(event) {
|
||||
var topic = this._topic;
|
||||
var designer = this._designer;
|
||||
var note = this;
|
||||
|
||||
var msg = new Element('div');
|
||||
var textarea = new Element('div').inject(msg);
|
||||
textarea.innerHTML = "Text";
|
||||
|
||||
var formElem = new Element('form', {'action': 'none', 'id':'noteFormId'});
|
||||
var text = textModel.getText();
|
||||
text = unescape(text);
|
||||
var textInput = new Element('textarea', {'value':text}).setStyles({'width':280, 'height':50});
|
||||
textInput.inject(formElem);
|
||||
formElem.inject(msg);
|
||||
|
||||
var okFunction = function(e) {
|
||||
var result = true;
|
||||
var text = textInput.value;
|
||||
text = escape(text);
|
||||
note._noteModel.setText(text);
|
||||
return result;
|
||||
};
|
||||
|
||||
formElem.addEvent('submit', function(e) {
|
||||
$(okButtonId).fireEvent('click', e);
|
||||
e = new Event(e);
|
||||
e.stop();
|
||||
});
|
||||
|
||||
|
||||
var dialog = mindplot.Note.buildDialog(designer, okFunction, okButtonId);
|
||||
dialog.adopt(msg).show();
|
||||
|
||||
}.bindWithEvent(this));
|
||||
buttonContainer.inject(container);
|
||||
}
|
||||
|
||||
var note = this;
|
||||
image.addEvent('mouseover', function(event) {
|
||||
var text = textModel.getText();
|
||||
text = unescape(text);
|
||||
text = text.replace(/\n/ig, "<br/>");
|
||||
text = text.replace(/<script/ig, "<script");
|
||||
text = text.replace(/<\/script/ig, "<\/script");
|
||||
this._textElem.innerHTML = text;
|
||||
|
||||
bubbleTip.open(event, container, note);
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function(event) {
|
||||
this._topic.showNoteEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
image.addEvent('mousemove', function(event) {
|
||||
bubbleTip.updatePosition(event);
|
||||
});
|
||||
image.addEvent('mouseout', function(event) {
|
||||
bubbleTip.close(event);
|
||||
});
|
||||
},
|
||||
|
||||
getText: function() {
|
||||
@@ -122,37 +44,9 @@ mindplot.Note = new Class({
|
||||
return this._noteModel;
|
||||
},
|
||||
|
||||
buildDialog : function(designer, okFunction, okButtonId) {
|
||||
var windoo = new Windoo({
|
||||
title: 'Write note',
|
||||
theme: Windoo.Themes.wise,
|
||||
modal:true,
|
||||
buttons:{'menu':false, 'close':false, 'minimize':false, 'roll':false, 'maximize':false},
|
||||
destroyOnClose:true,
|
||||
height:130
|
||||
});
|
||||
|
||||
var cancel = new Element('input', {'type': 'button', 'class':'btn-primary', 'value': 'Cancel','class':'btn-primary'}).setStyle('margin-right', "5px");
|
||||
cancel.setStyle('margin-left', "5px");
|
||||
cancel.addEvent('click', function(event) {
|
||||
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||
windoo.close();
|
||||
}.bindWithEvent(this));
|
||||
|
||||
var ok = new Element('input', {'type': 'button', 'class':'btn-primary', 'value': 'Ok','class':'btn-primary','id':okButtonId}).setStyle('marginRight', 10);
|
||||
ok.addEvent('click', function(event) {
|
||||
var couldBeUpdated = okFunction.attempt();
|
||||
if (couldBeUpdated) {
|
||||
$(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
|
||||
windoo.close();
|
||||
}
|
||||
}.bindWithEvent(this));
|
||||
|
||||
var panel = new Element('div', {'styles': {'padding-top': 10, 'text-align': 'right'}}).adopt(ok, cancel);
|
||||
|
||||
windoo.addPanel(panel);
|
||||
$(document).removeEvents('keydown');
|
||||
return windoo;
|
||||
remove : function() {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
actionDispatcher.removeNoteFromTopic(this._topic.getId());
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -21,6 +21,8 @@ mindplot.Topic = new Class({
|
||||
Extends:mindplot.NodeGraph,
|
||||
initialize : function(model) {
|
||||
this.parent(model);
|
||||
this._textEditor = new mindplot.TextEditor(this);
|
||||
|
||||
this._children = [];
|
||||
this._parent = null;
|
||||
this._relationships = [];
|
||||
@@ -283,7 +285,7 @@ mindplot.Topic = new Class({
|
||||
var notes = model.getNotes();
|
||||
for (var i = 0; i < notes.length; i++) {
|
||||
this._hasNote = true;
|
||||
this._note = new mindplot.Note(notes[i], this, designer);
|
||||
this._note = new mindplot.Note(this, notes[i]);
|
||||
result.addIcon(this._note);
|
||||
}
|
||||
|
||||
@@ -300,13 +302,14 @@ mindplot.Topic = new Class({
|
||||
this._hasLink = true;
|
||||
},
|
||||
|
||||
addNote : function(text, designer) {
|
||||
addNote : function(text) {
|
||||
var iconGroup = this.getOrBuildIconGroup();
|
||||
var model = this.getModel();
|
||||
text = escape(text);
|
||||
var noteModel = model.createNote(text)
|
||||
|
||||
var noteModel = model.createNote(text);
|
||||
model.addNote(noteModel);
|
||||
this._note = new mindplot.Note(noteModel, this, designer);
|
||||
|
||||
this._note = new mindplot.Note(this, noteModel);
|
||||
iconGroup.addIcon(this._note);
|
||||
this._hasNote = true;
|
||||
},
|
||||
@@ -379,6 +382,10 @@ mindplot.Topic = new Class({
|
||||
this._hasNote = false;
|
||||
},
|
||||
|
||||
hasNote : function() {
|
||||
return this._hasNote;
|
||||
},
|
||||
|
||||
addRelationship : function(relationship) {
|
||||
this._relationships.push(relationship);
|
||||
},
|
||||
@@ -729,7 +736,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
handleMouseOver : function(event) {
|
||||
handleMouseOver : function() {
|
||||
var outerShape = this.getOuterShape();
|
||||
outerShape.setOpacity(1);
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOverEvent, [this]);
|
||||
@@ -743,6 +750,44 @@ mindplot.Topic = new Class({
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOutEvent, [this]);
|
||||
},
|
||||
|
||||
showTextEditor : function(text) {
|
||||
this._textEditor.show(text);
|
||||
},
|
||||
|
||||
showNoteEditor : function() {
|
||||
|
||||
var topicId = this.getId();
|
||||
var model = this.getModel();
|
||||
var editorModel = {
|
||||
getValue : function() {
|
||||
var notes = model.getNotes();
|
||||
var result;
|
||||
if (notes.length > 0)
|
||||
result = notes[0].getText();
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
setValue : function(value) {
|
||||
if ("" != value.trim()) {
|
||||
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
// Only one note is supported ...
|
||||
if (model.getNotes().length > 0)
|
||||
dispatcher.removeNoteFromTopic(topicId);
|
||||
|
||||
dispatcher.addNoteToTopic(topicId, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var editor = new mindplot.widget.EditNoteDialog(editorModel);
|
||||
editor.show();
|
||||
},
|
||||
|
||||
closeEditors : function() {
|
||||
this._textEditor.close(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Point: references the center of the rect shape.!!!
|
||||
*/
|
||||
@@ -867,7 +912,7 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
_setRelationshipLinesVisibility : function(value) {
|
||||
this._relationships.forEach(function(relationship, index) {
|
||||
this._relationships.forEach(function(relationship) {
|
||||
relationship.setVisibility(value);
|
||||
});
|
||||
},
|
||||
@@ -1138,7 +1183,6 @@ mindplot.Topic = new Class({
|
||||
var textShape = this.getTextShape();
|
||||
var sizeWidth = textShape.getWidth();
|
||||
var sizeHeight = textShape.getHeight();
|
||||
var font = textShape.getFont();
|
||||
var iconOffset = this.getIconOffset();
|
||||
var height = sizeHeight + this._offset;
|
||||
var width = sizeWidth + this._offset * 2 + iconOffset + 2;
|
||||
|
@@ -27,7 +27,7 @@ mindplot.commands.AddNoteToTopicCommand = new Class({
|
||||
execute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.addNote(this._text, commandContext._designer);
|
||||
topic.addNote(this._text);
|
||||
topic.updateNode();
|
||||
}.bind(this);
|
||||
updated.delay(0);
|
||||
|
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Alert
|
||||
description: Creates an Alert dialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: MooDialog
|
||||
provides: MooDialog.Alert
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.Alert = new Class({
|
||||
|
||||
Extends: MooDialog,
|
||||
|
||||
options: {
|
||||
okText: 'Ok',
|
||||
focus: true,
|
||||
textPClass: 'MooDialogAlert'
|
||||
},
|
||||
|
||||
initialize: function(msg, options){
|
||||
this.parent(options);
|
||||
|
||||
var okButton = new Element('input[type=button]', {
|
||||
events: {
|
||||
click: this.close.bind(this)
|
||||
},
|
||||
value: this.options.okText
|
||||
});
|
||||
|
||||
this.setContent(
|
||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
||||
new Element('div.buttons').adopt(okButton)
|
||||
);
|
||||
if (this.options.autoOpen) this.open();
|
||||
|
||||
if (this.options.focus) this.addEvent('show', function(){
|
||||
okButton.focus()
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Confirm
|
||||
description: Creates an Confirm Dialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: MooDialog
|
||||
provides: [MooDialog.Confirm, Element.confirmLinkClick, Element.confirmFormSubmit]
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.Confirm = new Class({
|
||||
|
||||
Extends: MooDialog,
|
||||
|
||||
options: {
|
||||
okText: 'Ok',
|
||||
cancelText: 'Cancel',
|
||||
focus: true,
|
||||
textPClass: 'MooDialogConfirm'
|
||||
},
|
||||
|
||||
initialize: function(msg, fn, fn1, options){
|
||||
this.parent(options);
|
||||
var emptyFn = function(){},
|
||||
self = this;
|
||||
|
||||
var buttons = [
|
||||
{fn: fn || emptyFn, txt: this.options.okText},
|
||||
{fn: fn1 || emptyFn, txt: this.options.cancelText}
|
||||
].map(function(button){
|
||||
return new Element('input[type=button]', {
|
||||
events: {
|
||||
click: function(){
|
||||
button.fn();
|
||||
self.close();
|
||||
}
|
||||
},
|
||||
value: button.txt
|
||||
});
|
||||
});
|
||||
|
||||
this.setContent(
|
||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
||||
new Element('div.buttons').adopt(buttons)
|
||||
);
|
||||
if (this.options.autoOpen) this.open();
|
||||
|
||||
if(this.options.focus) this.addEvent('show', function(){
|
||||
buttons[1].focus();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Element.implement({
|
||||
|
||||
confirmLinkClick: function(msg, options){
|
||||
this.addEvent('click', function(e){
|
||||
e.stop();
|
||||
new MooDialog.Confirm(msg, function(){
|
||||
location.href = this.get('href');
|
||||
}.bind(this), null, options)
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
confirmFormSubmit: function(msg, options){
|
||||
this.addEvent('submit', function(e){
|
||||
e.stop();
|
||||
new MooDialog.Confirm(msg, function(){
|
||||
this.submit();
|
||||
}.bind(this), null, options)
|
||||
}.bind(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Error
|
||||
description: Creates an Error dialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: MooDialog
|
||||
provides: MooDialog.Error
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.Error = new Class({
|
||||
|
||||
Extends: MooDialog.Alert,
|
||||
|
||||
options: {
|
||||
textPClass: 'MooDialogError'
|
||||
}
|
||||
|
||||
});
|
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Fx
|
||||
description: Overwrite the default events so the Dialogs are using Fx on open and close
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: [Cores/Fx.Tween, Overlay]
|
||||
provides: MooDialog.Fx
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.implement('options', {
|
||||
|
||||
duration: 400,
|
||||
closeOnOverlayClick: true,
|
||||
|
||||
onInitialize: function(wrapper){
|
||||
this.fx = new Fx.Tween(wrapper, {
|
||||
property: 'opacity',
|
||||
duration: this.options.duration
|
||||
}).set(0);
|
||||
this.overlay = new Overlay(this.options.inject, {
|
||||
duration: this.options.duration
|
||||
});
|
||||
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
|
||||
},
|
||||
|
||||
onBeforeOpen: function(wrapper){
|
||||
this.overlay.open();
|
||||
this.fx.start(1).chain(function(){
|
||||
this.fireEvent('show');
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onBeforeClose: function(wrapper){
|
||||
this.overlay.close();
|
||||
this.fx.start(0).chain(function(){
|
||||
this.fireEvent('hide');
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
});
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.IFrame
|
||||
description: Opens an IFrame in a MooDialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: MooDialog
|
||||
provides: MooDialog.IFrame
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.Iframe = new Class({
|
||||
|
||||
Extends: MooDialog,
|
||||
|
||||
options: {
|
||||
useScrollBar: true
|
||||
},
|
||||
|
||||
initialize: function(url, options){
|
||||
this.parent(options);
|
||||
|
||||
this.setContent(
|
||||
new Element('iframe', {
|
||||
src: url,
|
||||
frameborder: 0,
|
||||
scrolling: this.options.useScrollBar ? 'auto' : 'no'
|
||||
})
|
||||
);
|
||||
if (this.options.autoOpen) this.open();
|
||||
}
|
||||
});
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Prompt
|
||||
description: Creates a Prompt dialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: MooDialog
|
||||
provides: MooDialog.Prompt
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
MooDialog.Prompt = new Class({
|
||||
|
||||
Extends: MooDialog,
|
||||
|
||||
options: {
|
||||
okText: 'Ok',
|
||||
focus: true,
|
||||
textPClass: 'MooDialogPrompt'
|
||||
},
|
||||
|
||||
initialize: function(msg, fn, options){
|
||||
this.parent(options);
|
||||
if (!fn) fn = function(){};
|
||||
|
||||
var textInput = new Element('input.textInput', {type: 'text'}),
|
||||
submitButton = new Element('input[type=submit]', {value: this.options.okText}),
|
||||
formEvents = {
|
||||
submit: function(e){
|
||||
e.stop();
|
||||
fn(textInput.get('value'));
|
||||
this.close();
|
||||
}.bind(this)
|
||||
};
|
||||
|
||||
this.setContent(
|
||||
new Element('p.' + this.options.textPClass, {text: msg}),
|
||||
new Element('form.buttons', {events: formEvents}).adopt(textInput, submitButton)
|
||||
);
|
||||
if (this.options.autoOpen) this.open();
|
||||
|
||||
if (this.options.focus) this.addEvent('show', function(){
|
||||
textInput.focus();
|
||||
});
|
||||
}
|
||||
});
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog.Request
|
||||
description: Loads Data into a Dialog with Request
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: [MooDialog, Core/Request.HTML]
|
||||
provides: MooDialog.Request
|
||||
...
|
||||
*/
|
||||
|
||||
MooDialog.Request = new Class({
|
||||
|
||||
Extends: MooDialog,
|
||||
|
||||
initialize: function(url, requestOptions, options){
|
||||
this.parent(options);
|
||||
this.requestOptions = requestOptions || {};
|
||||
|
||||
this.addEvent('open', function(){
|
||||
var request = new Request.HTML(this.requestOptions).addEvent('success', function(text){
|
||||
this.setContent(text);
|
||||
}.bind(this)).send({
|
||||
url: url
|
||||
});
|
||||
}.bind(this));
|
||||
|
||||
if (this.options.autoOpen) this.open();
|
||||
|
||||
},
|
||||
|
||||
setRequestOptions: function(options){
|
||||
this.requestOptions = Object.merge(this.requestOptions, options);
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
136
mindplot/src/main/javascript/libraries/moodialog/MooDialog.js
Normal file
136
mindplot/src/main/javascript/libraries/moodialog/MooDialog.js
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
---
|
||||
name: MooDialog
|
||||
description: The base class of MooDialog
|
||||
authors: Arian Stolwijk
|
||||
license: MIT-style license
|
||||
requires: [Core/Class, Core/Element, Core/Element.Styles, Core/Element.Event]
|
||||
provides: [MooDialog, Element.MooDialog]
|
||||
...
|
||||
*/
|
||||
|
||||
|
||||
var MooDialog = new Class({
|
||||
|
||||
Implements: [Options, Events],
|
||||
|
||||
options: {
|
||||
'class': 'MooDialog',
|
||||
title: null,
|
||||
scroll: true, // IE
|
||||
forceScroll: false,
|
||||
useEscKey: true,
|
||||
destroyOnHide: true,
|
||||
autoOpen: true,
|
||||
closeButton: true,
|
||||
onInitialize: function(){
|
||||
this.wrapper.setStyle('display', 'none');
|
||||
},
|
||||
onBeforeOpen: function(){
|
||||
this.wrapper.setStyle('display', 'block');
|
||||
this.fireEvent('show');
|
||||
},
|
||||
onBeforeClose: function(){
|
||||
this.wrapper.setStyle('display', 'none');
|
||||
this.fireEvent('hide');
|
||||
}/*,
|
||||
onOpen: function(){},
|
||||
onClose: function(){},
|
||||
onShow: function(){},
|
||||
onHide: function(){}*/
|
||||
},
|
||||
|
||||
initialize: function(options){
|
||||
this.setOptions(options);
|
||||
this.options.inject = this.options.inject || document.body;
|
||||
options = this.options;
|
||||
|
||||
var wrapper = this.wrapper = new Element('div.' + options['class'].replace(' ', '.')).inject(options.inject);
|
||||
this.content = new Element('div.content').inject(wrapper);
|
||||
|
||||
if (options.title){
|
||||
this.title = new Element('div.title').set('text', options.title).inject(wrapper);
|
||||
wrapper.addClass('MooDialogTitle');
|
||||
}
|
||||
|
||||
if (options.closeButton){
|
||||
this.closeButton = new Element('a.close', {
|
||||
events: {click: this.close.bind(this)}
|
||||
}).inject(wrapper);
|
||||
}
|
||||
|
||||
|
||||
/*<ie6>*/// IE 6 scroll
|
||||
if ((options.scroll && Browser.ie6) || options.forceScroll){
|
||||
wrapper.setStyle('position', 'absolute');
|
||||
var position = wrapper.getPosition(options.inject);
|
||||
window.addEvent('scroll', function(){
|
||||
var scroll = document.getScroll();
|
||||
wrapper.setPosition({
|
||||
x: position.x + scroll.x,
|
||||
y: position.y + scroll.y
|
||||
});
|
||||
});
|
||||
}
|
||||
/*</ie6>*/
|
||||
|
||||
if (options.useEscKey){
|
||||
// Add event for the esc key
|
||||
document.addEvent('keydown', function(e){
|
||||
if (e.key == 'esc') this.close();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.addEvent('hide', function(){
|
||||
if (options.destroyOnHide) this.destroy();
|
||||
}.bind(this));
|
||||
|
||||
this.fireEvent('initialize', wrapper);
|
||||
},
|
||||
|
||||
setContent: function(){
|
||||
var content = Array.from(arguments);
|
||||
if (content.length == 1) content = content[0];
|
||||
|
||||
this.content.empty();
|
||||
|
||||
var type = typeOf(content);
|
||||
if (['string', 'number'].contains(type)) this.content.set('text', content);
|
||||
else this.content.adopt(content);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
open: function(){
|
||||
this.fireEvent('beforeOpen', this.wrapper).fireEvent('open');
|
||||
this.opened = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
close: function(){
|
||||
this.fireEvent('beforeClose', this.wrapper).fireEvent('close');
|
||||
this.opened = false;
|
||||
return this;
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
this.wrapper.destroy();
|
||||
},
|
||||
|
||||
toElement: function(){
|
||||
return this.wrapper;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
Element.implement({
|
||||
|
||||
MooDialog: function(options){
|
||||
this.store('MooDialog',
|
||||
new MooDialog(options).setContent(this).open()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
135
mindplot/src/main/javascript/libraries/moodialog/Overlay.js
Normal file
135
mindplot/src/main/javascript/libraries/moodialog/Overlay.js
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
---
|
||||
|
||||
name: Overlay
|
||||
|
||||
authors:
|
||||
- David Walsh (http://davidwalsh.name)
|
||||
|
||||
license:
|
||||
- MIT-style license
|
||||
|
||||
requires: [Core/Class, Core/Element.Style, Core/Element.Event, Core/Element.Dimensions, Core/Fx.Tween]
|
||||
|
||||
provides:
|
||||
- Overlay
|
||||
...
|
||||
*/
|
||||
|
||||
var Overlay = new Class({
|
||||
|
||||
Implements: [Options, Events],
|
||||
|
||||
options: {
|
||||
id: 'overlay',
|
||||
color: '#000',
|
||||
duration: 500,
|
||||
opacity: 0.5,
|
||||
zIndex: 5000/*,
|
||||
onClick: $empty,
|
||||
onClose: $empty,
|
||||
onHide: $empty,
|
||||
onOpen: $empty,
|
||||
onShow: $empty
|
||||
*/
|
||||
},
|
||||
|
||||
initialize: function(container, options){
|
||||
this.setOptions(options);
|
||||
this.container = document.id(container);
|
||||
|
||||
this.bound = {
|
||||
'window': {
|
||||
resize: this.resize.bind(this),
|
||||
scroll: this.scroll.bind(this)
|
||||
},
|
||||
overlayClick: this.overlayClick.bind(this),
|
||||
tweenStart: this.tweenStart.bind(this),
|
||||
tweenComplete: this.tweenComplete.bind(this)
|
||||
};
|
||||
|
||||
this.build().attach();
|
||||
},
|
||||
|
||||
build: function(){
|
||||
this.overlay = new Element('div', {
|
||||
id: this.options.id,
|
||||
opacity: 0,
|
||||
styles: {
|
||||
position: (Browser.ie6) ? 'absolute' : 'fixed',
|
||||
background: this.options.color,
|
||||
left: 0,
|
||||
top: 0,
|
||||
'z-index': this.options.zIndex
|
||||
}
|
||||
}).inject(this.container);
|
||||
this.tween = new Fx.Tween(this.overlay, {
|
||||
duration: this.options.duration,
|
||||
link: 'cancel',
|
||||
property: 'opacity'
|
||||
});
|
||||
return this;
|
||||
}.protect(),
|
||||
|
||||
attach: function(){
|
||||
window.addEvents(this.bound.window);
|
||||
this.overlay.addEvent('click', this.bound.overlayClick);
|
||||
this.tween.addEvents({
|
||||
onStart: this.bound.tweenStart,
|
||||
onComplete: this.bound.tweenComplete
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
detach: function(){
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
args.each(function(item){
|
||||
if(item == 'window') window.removeEvents(this.bound.window);
|
||||
if(item == 'overlay') this.overlay.removeEvent('click', this.bound.overlayClick);
|
||||
}, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
overlayClick: function(){
|
||||
this.fireEvent('click');
|
||||
return this;
|
||||
},
|
||||
|
||||
tweenStart: function(){
|
||||
this.overlay.setStyles({
|
||||
width: '100%',
|
||||
height: this.container.getScrollSize().y
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
tweenComplete: function(){
|
||||
this.fireEvent(this.overlay.get('opacity') == this.options.opacity ? 'show' : 'hide');
|
||||
return this;
|
||||
},
|
||||
|
||||
open: function(){
|
||||
this.fireEvent('open');
|
||||
this.tween.start(this.options.opacity);
|
||||
return this;
|
||||
},
|
||||
|
||||
close: function(){
|
||||
this.fireEvent('close');
|
||||
this.tween.start(0);
|
||||
return this;
|
||||
},
|
||||
|
||||
resize: function(){
|
||||
this.fireEvent('resize');
|
||||
this.overlay.setStyle('height', this.container.getScrollSize().y);
|
||||
return this;
|
||||
},
|
||||
|
||||
scroll: function(){
|
||||
this.fireEvent('scroll');
|
||||
if (Browser.ie6) this.overlay.setStyle('left', window.getScroll().x);
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
@@ -0,0 +1,95 @@
|
||||
/* Created by Arian Stolwijk <http://www.aryweb.nl> */
|
||||
|
||||
.MooDialog {
|
||||
/* position: fixed;*/
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
position: fixed;
|
||||
margin: -150px 0 0 -150px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 50000;
|
||||
|
||||
background: #eef5f8;
|
||||
color: black;
|
||||
padding: 10px;
|
||||
border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
-webkit-border-radius: 7px;
|
||||
border-radius: 7px;
|
||||
-moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
|
||||
-webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
|
||||
box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
.MooDialogTitle {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.MooDialog .content {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.MooDialog .title {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 3px 20px;
|
||||
background: #b7c4dc;
|
||||
border-bottom: 1px solid #a1aec5;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
color: black;
|
||||
border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
-webkit-border-radius: 7px;
|
||||
}
|
||||
|
||||
.MooDialog .close {
|
||||
background: url(dialog-close.png) no-repeat;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
top: -5px;
|
||||
left: -5px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.MooDialog .buttons {
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.MooDialog .iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.MooDialog .textInput {
|
||||
width: 200px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.MooDialog .MooDialogAlert,
|
||||
.MooDialog .MooDialogConfirm,
|
||||
.MooDialog .MooDialogPrompt,
|
||||
.MooDialog .MooDialogError {
|
||||
background: url(dialog-warning.png) no-repeat;
|
||||
padding-left: 40px;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.MooDialog .MooDialogConfirm,
|
||||
.MooDialog .MooDialogPromt {
|
||||
background: url(dialog-question.png) no-repeat;
|
||||
}
|
||||
|
||||
.MooDialog .MooDialogError {
|
||||
background: url(dialog-error.png) no-repeat;
|
||||
}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 689 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
76
mindplot/src/main/javascript/widget/EditNoteDialog.js
Normal file
76
mindplot/src/main/javascript/widget/EditNoteDialog.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.widget.EditNoteDialog = new Class({
|
||||
Extends:MooDialog,
|
||||
initialize : function(model) {
|
||||
$assert(model, "model can not be null");
|
||||
var panel = this._buildPanel(model);
|
||||
this.parent({closeButton:false,destroyOnClose:true,title:'Note'});
|
||||
this.setContent(panel);
|
||||
},
|
||||
|
||||
_buildPanel : function (model) {
|
||||
var result = new Element('div');
|
||||
var text = new Element('div').inject(result);
|
||||
var form = new Element('form', {'action': 'none', 'id':'noteFormId'});
|
||||
|
||||
// Add textarea ...
|
||||
var textArea = new Element('textarea', {placeholder: 'Add your note here ...'});
|
||||
if (model.getValue() != null)
|
||||
textArea.value = model.getValue();
|
||||
|
||||
textArea.setStyles({'width':280, 'height':70});
|
||||
textArea.inject(form);
|
||||
|
||||
// Add buttons ...
|
||||
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
|
||||
|
||||
// Create accept button ...
|
||||
var okButton = new Element('input', {type:'button', value:'Accept','class':'btn-primary'});
|
||||
okButton.addClass('button');
|
||||
okButton.addEvent('click', function() {
|
||||
model.setValue(textArea.value);
|
||||
this.close();
|
||||
}.bind(this));
|
||||
okButton.inject(buttonContainer);
|
||||
|
||||
// Create move button ...
|
||||
var rmButton = new Element('input', {type:'button', value:'Cancel','class':'btn-primary'});
|
||||
rmButton.setStyle('margin', '5px');
|
||||
rmButton.addClass('button');
|
||||
rmButton.inject(buttonContainer);
|
||||
rmButton.addEvent('click', function() {
|
||||
this.close();
|
||||
}.bind(this));
|
||||
|
||||
buttonContainer.inject(form);
|
||||
|
||||
result.addEvent('keydown', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
form.inject(result);
|
||||
return result;
|
||||
},
|
||||
|
||||
show : function() {
|
||||
this.open();
|
||||
}
|
||||
|
||||
});
|
@@ -1,145 +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.widget.Tip = new Class({
|
||||
initialize:function(divContainer) {
|
||||
this.options = {
|
||||
panel:null,
|
||||
container:null,
|
||||
divContainer:divContainer,
|
||||
content:null,
|
||||
onShowComplete:Class.empty,
|
||||
onHideComplete:Class.empty,
|
||||
width:null,
|
||||
height:null,
|
||||
form:null
|
||||
};
|
||||
this.buildTip();
|
||||
this._isMouseOver = false;
|
||||
this._open = false;
|
||||
},
|
||||
|
||||
buildTip : function() {
|
||||
var opts = this.options;
|
||||
var panel = new Element('div').addClass('bubbleContainer');
|
||||
if ($defined(opts.height))
|
||||
panel.setStyle('height', opts.height);
|
||||
if ($defined(opts.width))
|
||||
panel.setStyle('width', opts.width);
|
||||
if (!$defined(opts.divContainer)) {
|
||||
opts.divContainer = document.body;
|
||||
}
|
||||
panel.injectTop(opts.divContainer);
|
||||
opts.panel = $(panel);
|
||||
opts.panel.setStyle('opacity', 0);
|
||||
opts.panel.addEvent('mouseover', function() {
|
||||
this._isMouseOver = true;
|
||||
}.bind(this));
|
||||
opts.panel.addEvent('mouseleave', function(event) {
|
||||
this.close(event);
|
||||
}.bindWithEvent(this));//this.close.bindWithEvent(this)
|
||||
|
||||
},
|
||||
|
||||
click : function(event, el) {
|
||||
return this.open(event, el);
|
||||
},
|
||||
|
||||
open : function(event, content, source) {
|
||||
this._isMouseOver = true;
|
||||
this._evt = new Event(event);
|
||||
this.doOpen.delay(500, this, [content,source]);
|
||||
},
|
||||
|
||||
doOpen : function(content, source) {
|
||||
if ($defined(this._isMouseOver) && !$defined(this._open) && !$defined(this._opening)) {
|
||||
this._opening = true;
|
||||
var container = new Element('div');
|
||||
$(content).inject(container);
|
||||
this.options.content = content;
|
||||
this.options.container = container;
|
||||
$(this.options.container).inject(this.options.panel);
|
||||
this.init(this._evt, source);
|
||||
$(this.options.panel).effect('opacity', {duration:500, onComplete:function() {
|
||||
this._open = true;
|
||||
this._opening = false;
|
||||
}.bind(this)}).start(0, 100);
|
||||
}
|
||||
},
|
||||
|
||||
updatePosition : function(event) {
|
||||
this._evt = new Event(event);
|
||||
},
|
||||
|
||||
close : function(event) {
|
||||
this._isMouseOver = false;
|
||||
this.doClose.delay(50, this, new Event(event));
|
||||
},
|
||||
|
||||
doClose : function(event) {
|
||||
|
||||
if (!$defined(this._isMouseOver) && $defined(this._opening))
|
||||
this.doClose.delay(500, this, this._evt);
|
||||
|
||||
if (!$defined(this._isMouseOver) && $defined(this._open)) {
|
||||
this.forceClose();
|
||||
}
|
||||
},
|
||||
|
||||
forceClose : function() {
|
||||
this.options.panel.effect('opacity', {duration:100, onComplete:function() {
|
||||
this._open = false;
|
||||
$(this.options.panel).setStyles({left:0,top:0});
|
||||
$(this.options.container).dispose();
|
||||
}.bind(this)}).start(100, 0);
|
||||
},
|
||||
|
||||
init : function(event, source) {
|
||||
var opts = this.options;
|
||||
var coordinates = $(opts.panel).getCoordinates();
|
||||
var width = coordinates.width; //not total width, but close enough
|
||||
var height = coordinates.height; //not total height, but close enough
|
||||
|
||||
var offset = designer.getWorkSpace().getScreenManager().getWorkspaceIconPosition(source);
|
||||
|
||||
var containerCoords = $(opts.divContainer).getCoordinates();
|
||||
var screenWidth = containerCoords.width;
|
||||
var screenHeight = containerCoords.height;
|
||||
|
||||
$(this.options.panel).dispose();
|
||||
this.buildTip();
|
||||
$(this.options.container).inject(this.options.panel);
|
||||
this.moveTopic(offset, $(opts.panel).getCoordinates().height);
|
||||
},
|
||||
|
||||
moveTopic : function(offset, panelHeight) {
|
||||
var opts = this.options;
|
||||
var width = $(opts.panel).getCoordinates().width;
|
||||
$(opts.panel).setStyles({left:offset.x - (width / 2), top:offset.y - (panelHeight * 2) + 35});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
mindplot.widget.Tip.getInstance = function(divContainer) {
|
||||
var result = mindplot.Tip.instance;
|
||||
if (!$defined(result)) {
|
||||
mindplot.Tip.instance = new mindplot.Tip(divContainer);
|
||||
result = mindplot.Tip.instance;
|
||||
}
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user