Minor fix.

This commit is contained in:
Paulo Veiga 2011-10-07 01:30:55 -03:00
parent c472b95b20
commit 52587c0eaa
7 changed files with 172 additions and 61 deletions

View File

@ -187,6 +187,7 @@
<filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarItem.js"/> <filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarItem.js"/>
<filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarPaneItem.js"/> <filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarPaneItem.js"/>
<filelist dir="${basedir}/src/main/javascript/widget/" files="NoteEditor.js"/> <filelist dir="${basedir}/src/main/javascript/widget/" files="NoteEditor.js"/>
<filelist dir="${basedir}/src/main/javascript/widget/" files="LinkEditor.js"/>
<filelist dir="${basedir}/src/main/javascript/widget/" files="FloatingTip.js"/> <filelist dir="${basedir}/src/main/javascript/widget/" files="FloatingTip.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"

View File

@ -660,66 +660,16 @@ mindplot.Designer = new Class({
} }
}, },
addLink2Node : function(url) {
var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) {
this._actionDispatcher.addLinkToTopic(topicsIds[0], url);
}
},
addLink : function() { addLink : function() {
var selectedTopics = this.getModel().filterSelectedTopics(); var model = this.getModel();
var topic = null; var topic = model.selectedTopic();
if (selectedTopics.length > 0) { topic.showLinkEditor();
topic = selectedTopics[0];
if (!$defined(topic._hasLink)) {
var msg = new Element('div');
var urlText = new Element('div').inject(msg);
urlText.innerHTML = "URL:";
var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'});
var urlInput = new Element('input', {'type': 'text', 'size':30});
urlInput.inject(formElem);
formElem.inject(msg);
var okButtonId = "linkOkButtonId";
formElem.addEvent('submit', function(e) {
$(okButtonId).fireEvent('click', e);
e = new Event(e);
e.stop();
});
var okFunction = function() {
var url = urlInput.value;
var result = false;
if ("" != url.trim()) {
this.addLink2Node(url);
result = true;
}
return result;
}.bind(this);
var dialog = mindplot.LinkIcon.buildDialog(this, okFunction, okButtonId);
dialog.adopt(msg).show();
// IE doesn't like too much this focus action...
if (!Browser.ie) {
urlInput.focus();
}
}
} else {
core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.');
}
}, },
addNote : function() { addNote : function() {
var model = this.getModel(); var model = this.getModel();
var topic = model.selectedTopic(); var topic = model.selectedTopic();
if (topic != null) {
topic.showNoteEditor(); topic.showNoteEditor();
} else {
core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.');
}
}, },
goToNode : function(node) { goToNode : function(node) {

View File

@ -41,6 +41,7 @@ mindplot.Note = new Class({
// Content can also be a function of the target element! // Content can also be a function of the target element!
content: function() { content: function() {
var result = new Element('div'); var result = new Element('div');
result.setStyles({padding:'5px'});
var title = new Element('div', {text:'Note'}); var title = new Element('div', {text:'Note'});
title.setStyles({ title.setStyles({
@ -63,9 +64,10 @@ mindplot.Note = new Class({
return result; return result;
}.bind(this), }.bind(this),
html: true, html: true,
position: 'bottom', // Bottom positioned position: 'bottom',
center: true, // Place the tip aligned with target arrowOffset : 10,
arrowSize: 6, // A bigger arrow! ); // Title attribute will be used as tip. center: true,
arrowSize: 15,
offset : {x:10,y:20} offset : {x:10,y:20}
}); });
}, },

View File

@ -753,6 +753,37 @@ mindplot.Topic = new Class({
editor.show(); editor.show();
}, },
showLinkEditor : 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) {
// var dispatcher = mindplot.ActionDispatcher.getInstance();
// if (!$defined(value)) {
// dispatcher.removeNoteFromTopic(topicId);
// }
// else {
// dispatcher.changeNoteToTopic(topicId, value);
// }
}
};
this.closeEditors();
var editor = new mindplot.widget.LinkEditor(editorModel);
editor.show();
},
closeEditors : function() { closeEditors : function() {
this._textEditor.close(true); this._textEditor.close(true);
}, },

View File

@ -0,0 +1,124 @@
/*
* 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.LinkEditor = new Class({
Extends:MooDialog,
initialize : function(model) {
$assert(model, "model can not be null");
var panel = this._buildPanel(model);
this.parent({
closeButton:true,
destroyOnClose:true,
title:'Link',
onInitialize: function(wrapper) {
wrapper.setStyle('opacity', 0);
this.fx = new Fx.Morph(wrapper, {
duration: 600,
transition: Fx.Transitions.Bounce.easeOut
});
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() {
this.overlay.open();
this.fx.start({
'margin-top': [-200, -100],
opacity: [0, 1]
}).chain(function() {
this.fireEvent('show');
}.bind(this));
},
onBeforeClose: function() {
this.fx.start({
'margin-top': [-100, 0],
opacity: 0
}).chain(function() {
this.fireEvent('hide');
}.bind(this));
this.overlay.close();
}
});
this.setContent(panel);
},
_buildPanel : function (model) {
var result = new Element('div');
var form = new Element('form', {'action': 'none', 'id':'linkFormId'});
// Add textarea ...
var textArea = new Element('textarea', {placeholder: 'Write your note here ...'});
if (model.getValue() != null)
textArea.value = model.getValue();
textArea.setStyles({'width':'100%', 'height':80,resize: 'none'
});
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 remove button ...
if ($defined(model.getValue())) {
var rmButton = new Element('input', {type:'button', value:'Remove','class':'btn-primary'});
rmButton.setStyle('margin', '5px');
rmButton.addClass('button');
rmButton.inject(buttonContainer);
rmButton.addEvent('click', function() {
model.setValue(null);
this.close();
}.bind(this));
buttonContainer.inject(form);
}
// Create cancel button ...
var cButton = new Element('input', {type:'button', value:'Cancel','class':'btn-primary'});
cButton.setStyle('margin', '5px');
cButton.addClass('button');
cButton.inject(buttonContainer);
cButton.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();
}
});

View File

@ -644,4 +644,5 @@ div.installCFG h2{
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
} }

View File

@ -593,13 +593,15 @@ div.installCFG h2 {
top: 0; top: 0;
margin: 0; margin: 0;
} }
.floating-tip { .floating-tip {
background-color: #dfcf3c; background-color: #dfcf3c;
padding: 5px 15px; padding: 5px 15px;
color: #666666; color: #666666;
font-weight: bold; /*font-weight: bold;*/
font-size: 11px; /*width: 100px;*/
font-size: 13px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
} box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);