Finally viewmode.html render.

This commit is contained in:
Paulo Gustavo Veiga
2014-03-05 00:14:28 -03:00
parent 255f50eda8
commit e5186688ab
33 changed files with 158 additions and 159 deletions

View File

@@ -21,8 +21,9 @@ mindplot.widget.ColorPalettePanel = new Class({
initialize:function (buttonId, model, baseUrl) {
this._baseUrl = baseUrl;
this.parent(buttonId, model);
$assert($defined(baseUrl), "baseUrl can not be null");
console.error("mindplot.widget.ColorPalettePanel must be implemented...");
// this.parent(buttonId, model);
// $assert($defined(baseUrl), "baseUrl can not be null");
},
_load:function () {

View File

@@ -17,31 +17,31 @@
*/
mindplot.widget.FloatingTip = new Class({
Implements:[Options, Events],
Implements: [Options, Events],
options:{
position:'top',
center:true,
content:'title',
html:false,
balloon:true,
arrowSize:6,
arrowOffset:6,
distance:7,
motion:40,
motionOnShow:true,
motionOnHide:true,
showOn:'mouseenter',
hideOn:'mouseleave',
showDelay:500,
hideDelay:250,
className:'floating-tip',
offset:{x:0, y:0},
preventHideOnOver:true,
fx:{ 'duration':'short' }
options: {
position: 'top',
center: true,
content: 'title',
html: false,
balloon: true,
arrowSize: 6,
arrowOffset: 6,
distance: 7,
motion: 40,
motionOnShow: true,
motionOnHide: true,
showOn: 'mouseenter',
hideOn: 'mouseleave',
showDelay: 500,
hideDelay: 250,
className: 'floating-tip',
offset: {x: 0, y: 0},
preventHideOnOver: true,
fx: { 'duration': 'short' }
},
initialize:function (element, options) {
initialize: function (element, options) {
this.setOptions(options);
this.boundShow = function () {
this.show(element);
@@ -56,18 +56,18 @@ mindplot.widget.FloatingTip = new Class({
this.attach(element);
},
attach:function (element) {
if (element.retrieve('hasEvents') !== null) {
attach: function (element) {
if (element.data('hasEvents') !== null) {
return;
}
element.addEvent(this.options.showOn, this.boundShow);
element.addEvent(this.options.hideOn, this.boundHide);
element.store('hasEvents', true);
element.bind(this.options.showOn, this.boundShow);
element.bind(this.options.hideOn, this.boundHide);
element.data('hasEvents', true);
},
show:function (element) {
show: function (element) {
var old = document.id(element).retrieve('floatingtip');
if (old){
if (old) {
if (old.getStyle('opacity') == 1) {
clearTimeout(old.retrieve('timeout'));
return this;
@@ -89,7 +89,7 @@ mindplot.widget.FloatingTip = new Class({
return this;
},
hide:function (element) {
hide: function (element) {
var tip = element.retrieve('floatingtip');
if (!tip) {
if (this.options.position == 'inside') {
@@ -109,7 +109,7 @@ mindplot.widget.FloatingTip = new Class({
return this;
},
_create:function (elem) {
_create: function (elem) {
var o = this.options;
var oc = o.content;
@@ -124,7 +124,7 @@ mindplot.widget.FloatingTip = new Class({
var cnt = (typeof(oc) == 'string' ? elem.get(oc) : oc(elem));
var cwr = new Element('div').addClass(o.className).setStyle('margin', 0);
var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin':0, 'padding':0, 'z-index':cwr.getStyle('z-index') }).adopt(cwr);
var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin': 0, 'padding': 0, 'z-index': cwr.getStyle('z-index') }).adopt(cwr);
if (cnt) {
if (o.html)
@@ -136,12 +136,12 @@ mindplot.widget.FloatingTip = new Class({
}
var body = document.id(document.body);
tip.setStyles({ 'position':'absolute', 'opacity':0, 'top':0, 'left':0 }).inject(body);
tip.setStyles({ 'position': 'absolute', 'opacity': 0, 'top': 0, 'left': 0 }).inject(body);
if (o.balloon && !Browser.ie6) {
var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin':0, 'padding':0 });
var trgSt = { 'border-color':cwr.getStyle('background-color'), 'border-width':o.arrowSize, 'border-style':'solid', 'width':0, 'height':0 };
var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin': 0, 'padding': 0 });
var trgSt = { 'border-color': cwr.getStyle('background-color'), 'border-width': o.arrowSize, 'border-style': 'solid', 'width': 0, 'height': 0 };
switch (opos) {
case 'inside':
@@ -195,12 +195,12 @@ mindplot.widget.FloatingTip = new Class({
trgC.height = !$defined(trgC.height) ? 0 : trgC.height;
trgC.width = !$defined(trgC.width) ? 0 : trgC.width;
var pos = { x:trgC.left + o.offset.x, y:trgC.top + o.offset.y };
var pos = { x: trgC.left + o.offset.x, y: trgC.top + o.offset.y };
if (opos == 'inside') {
tip.setStyles({ 'width':tip.getStyle('width'), 'height':tip.getStyle('height') });
tip.setStyles({ 'width': tip.getStyle('width'), 'height': tip.getStyle('height') });
elem.setStyle('position', 'relative').adopt(tip);
pos = { x:o.offset.x, y:o.offset.y };
pos = { x: o.offset.x, y: o.offset.y };
} else {
switch (opos) {
case 'top':
@@ -236,19 +236,19 @@ mindplot.widget.FloatingTip = new Class({
}
tip.set('morph', o.fx).store('position', pos);
tip.setStyles({ 'top':pos.y, 'left':pos.x });
tip.setStyles({ 'top': pos.y, 'left': pos.x });
return tip;
},
_animate:function (tip, d) {
_animate: function (tip, d) {
clearTimeout(tip.retrieve('timeout'));
tip.store('timeout', (function (t) {
var o = this.options, din = (d == 'in');
var m = { 'opacity':din ? 1 : 0 };
var m = { 'opacity': din ? 1 : 0 };
if ((o.motionOnShow && din) || (o.motionOnHide && !din)) {
var pos = t.retrieve('position');

View File

@@ -24,8 +24,8 @@ mindplot.widget.FontSizePanel = new Class({
buildPanel: function() {
var content = new Element("div", {'class':'toolbarPanel','id':'fontSizePanel'});
content.innerHTML = '' +
var content = $("<div class='toolbarPanel' id='fontSizePanel'></div>");
content[0].innerHTML = '' +
'<div id="small" model="6" style="font-size:8px">Small</div>' +
'<div id="normal" model="8" style="font-size:12px">Normal</div>' +
'<div id="large" model="10" style="font-size:15px">Large</div>' +

View File

@@ -19,7 +19,8 @@
mindplot.widget.IconPanel = new Class({
Extends:mindplot.widget.ToolbarPaneItem,
initialize:function (buttonId, model) {
this.parent(buttonId, model);
console.error("mindplot.widget.IconPanel");
// this.parent(buttonId, model);
},
_updateSelectedItem:function () {

View File

@@ -24,31 +24,32 @@ mindplot.widget.KeyboardShortcutTooltip = new Class({
$assert(text, "text can not be null");
this._text = text;
var children = buttonElem.getChildren();
var tipElemId = buttonElem.id + "Tip";
var tipDiv = new Element('div', {id:tipElemId});
children[0].inject(tipDiv);
tipDiv.inject(buttonElem);
this.parent(tipDiv, {
// Content can also be a function of the target element!
content: this._buildContent.pass(buttonElem, this),
html: true,
position: 'bottom',
arrowOffset : 10,
center: true,
arrowSize: 3,
offset : {x:0,y:-2},
className: 'keyboardShortcutTip',
preventHideOnOver : false,
motionOnShow:false,
motionOnHide:false,
fx: { 'duration': '100' }
});
tipDiv.addEvent('click', function(e) {
tipDiv.fireEvent('mouseleave', e);
});
console.error("mindplot.widget.KeyboardShortcutTooltip must be implemented ...");
// var children = buttonElem.children();
// var tipElemId = buttonElem.id + "Tip";
// var tipDiv = new Element('div', {id:tipElemId});
// children[0].inject(tipDiv);
// tipDiv.inject(buttonElem);
//
// this.parent(tipDiv, {
// // Content can also be a function of the target element!
// content: this._buildContent.pass(buttonElem, this),
// html: true,
// position: 'bottom',
// arrowOffset : 10,
// center: true,
// arrowSize: 3,
// offset : {x:0,y:-2},
// className: 'keyboardShortcutTip',
// preventHideOnOver : false,
// motionOnShow:false,
// motionOnHide:false,
// fx: { 'duration': '100' }
// });
//
// tipDiv.addEvent('click', function(e) {
// tipDiv.fireEvent('mouseleave', e);
// });
},
_buildContent : function() {

View File

@@ -21,7 +21,7 @@ mindplot.widget.LinkIconTooltip = new Class({
initialize:function (linkIcon) {
$assert(linkIcon, "linkIcon can not be null");
this.parent(linkIcon.getImage()._peer._native, {
this.parent($(linkIcon.getImage()._peer._native), {
// Content can also be a function of the target element!
content:this._buildContent.pass(linkIcon, this),
html:true,

View File

@@ -18,32 +18,28 @@
mindplot.widget.ListToolbarPanel = new Class({
Extends: mindplot.widget.ToolbarPaneItem,
initialize : function(buttonId, model) {
initialize: function (buttonId, model) {
this.parent(buttonId, model);
this._initPanel();
},
_initPanel: function () {
// Register on toolbar elements ...
var menuElems = this.getPanelElem().getElements('div');
menuElems.each(function(elem) {
elem.addEvent('click', function(event) {
event.stopPropagation();
this.hide();
var value = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
this.getModel().setValue(value);
}.bind(this));
}.bind(this));
this.getPanelElem().children('div').bind('click', function (event) {
event.stopPropagation();
this.hide();
var value = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
this.getModel().setValue(value);
});
},
_updateSelectedItem : function() {
_updateSelectedItem: function () {
var panelElem = this.getPanelElem();
var menuElems = panelElem.getElements('div');
var value = this.getModel().getValue();
menuElems.each(function(elem) {
menuElems.each(function (elem) {
var elemValue = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
$assert(elemValue,"elemValue can not be null");
$assert(elemValue, "elemValue can not be null");
if (elemValue == value)
elem.className = "toolbarPanelLinkSelectedLink";
else

View File

@@ -326,7 +326,7 @@ mindplot.widget.Menu = new Class({
if (!readOnly) {
// To prevent the user from leaving the page with changes ...
Element.NativeEvents.unload = 1;
// Element.NativeEvents.unload = 1;
$(window).bind('unload', function () {
if (this.isSaveRequired()) {
this.save(saveElem, designer, false, true);

View File

@@ -65,11 +65,11 @@ mindplot.widget.ToolbarPaneItem = new Class({
offset: {x:-4,y:0}
});
this._tip.bind('hide', function() {
this._tip.addEvent('hide', function() {
this._visible = false
}.bind(this));
this._tip.bind('show', function() {
this._tip.addEvent('show', function() {
this._visible = true
}.bind(this));

View File

@@ -17,15 +17,15 @@
*/
mindplot.widget.TopicShapePanel = new Class({
Extends : mindplot.widget.ListToolbarPanel,
initialize : function(buttonId, model) {
Extends: mindplot.widget.ListToolbarPanel,
initialize: function (buttonId, model) {
this.parent(buttonId, model);
},
buildPanel: function() {
buildPanel: function () {
var content = new Element("div", {'class':'toolbarPanel','id':'topicShapePanel'});
content.innerHTML = '' +
var content = $("<div class='toolbarPanel' id='topicShapePanel'></div>");
content[0].innerHTML = '' +
'<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="line" model="line"><img src="images/shape-line.png" alt="Line"></div>' +