- 1 :
/**
- 2 :
* Embedder provides a way to embed a web page into your Voyant Tools experience.
- 3 :
*
- 4 :
* @class Embedder
- 5 :
* @tutorial embedder
- 6 :
* @memberof Tools
- 7 :
*/
- 8 :
Ext.define('Voyant.panel.Embedder', {
- 9 :
extend: 'Ext.Panel',
- 10 :
mixins: ['Voyant.panel.Panel'],
- 11 :
alias: 'widget.embedder',
- 12 :
statics: {
- 13 :
i18n: {
- 14 :
title: 'Embedder',
- 15 :
url: 'URL',
- 16 :
go: 'Go',
- 17 :
help: 'Embedder provides a way to embed a web page into your Voyant Tools experience.',
- 18 :
helpTip: 'Embedder provides a way to embed a web page into your Voyant Tools experience.'
- 19 :
},
- 20 :
api: {
- 21 :
/**
- 22 :
* @memberof Tools.Embedder
- 23 :
* @instance
- 24 :
* @property {String} url The URL of the web page to embed.
- 25 :
*/
- 26 :
url: undefined
- 27 :
},
- 28 :
glyph: 'xf0c1@FontAwesome'
- 29 :
},
- 30 :
constructor: function(config) {
- 31 :
this.mixins['Voyant.util.Api'].constructor.apply(this, arguments);
- 32 :
this.setApiParam('url', config.url);
- 33 :
- 34 :
this.callParent(arguments);
- 35 :
- 36 :
this.mixins['Voyant.panel.Panel'].constructor.apply(this, arguments);
- 37 :
},
- 38 :
initComponent: function() {
- 39 :
Ext.apply(this, {
- 40 :
title: this.localize('title'),
- 41 :
layout: {
- 42 :
type: 'fit'
- 43 :
},
- 44 :
items: {
- 45 :
xtype: 'uxiframe',
- 46 :
src: this.getApiParam('url')
- 47 :
},
- 48 :
tbar: [{
- 49 :
xtype: 'textfield',
- 50 :
value: this.getApiParam('url'),
- 51 :
emptyText: this.localize('url'),
- 52 :
listeners: {
- 53 :
specialkey: function(field, e){
- 54 :
if (e.getKey() == e.ENTER) {
- 55 :
field.up('panel').down('uxiframe').load(field.getValue());
- 56 :
}
- 57 :
}
- 58 :
}
- 59 :
},{
- 60 :
xtype: 'button',
- 61 :
text: this.localize('go'),
- 62 :
handler: function(btn) {
- 63 :
var url = btn.prev('textfield').getValue();
- 64 :
btn.up('panel').down('uxiframe').load(url);
- 65 :
}
- 66 :
}]
- 67 :
});
- 68 :
- 69 :
this.callParent();
- 70 :
},
- 71 :
loadUrl: function(url) {
- 72 :
this.down('uxiframe').load(url);
- 73 :
}
- 74 :
});