1 /** 2 * @author Gillis Haasnoot <gillis.haasnoot@gmail.com> 3 * @package Banana.Controls 4 * @summary Date picker. using jquery ui datapicker 5 */ 6 7 goog.provide('Banana.Controls.DataControls.Image'); 8 9 goog.require('Banana.Controls.DataControls.DataControl'); 10 11 /** @namespace Banana.Controls.Image */ 12 namespace('Banana.Controls').Image = Banana.Controls.DataControl.extend( 13 /** @lends Banana.Controls.Image.prototype */ 14 { 15 /** 16 * Creates a image. use setImage to set the source and setTitle for the title attribute 17 * @constructs 18 * @extends Banana.Controls.DataControl 19 */ 20 init : function() 21 { 22 this._super(); 23 } 24 }); 25 26 /** 27 * sets image source 28 * @param {String} image 29 * @return {this} 30 */ 31 Banana.Controls.Image.prototype.setImage = function(image) 32 { 33 this.setAttribute('src',image); 34 return this; 35 }; 36 37 /** 38 * sets titlte 39 * @param {String} title 40 * @return {this} 41 */ 42 Banana.Controls.Image.prototype.setTitle = function(title) 43 { 44 this.setAttribute('title', title); 45 return this; 46 }; 47 48 /** 49 * @return {String} 50 */ 51 Banana.Controls.Image.prototype.getTagName = function() 52 { 53 return 'img'; 54 }; 55 56 /** 57 * @ignore 58 */ 59 Banana.Controls.Image.prototype.setDomData = function(data) 60 { 61 jQuery('#'+this.getClientId()).attr({'src':data}); 62 };