require('./style.scss');

module.exports = new Class({
	Extends: Htk.Column
	,Tag: 'htk-column-image'
	,Properties: {
		/**
		 * The directory where the images are allocated.
		 */
		directory:{
			type: String
			,value: null
		},
		/**
		 * The subdirectory where the images are allocated.
		 */
		subdir:{
			type: String
			,value: null
		},
		/**
		 * Subdirectory where full images are allocated.
		 */
		fullDir:{
			type: String
			,value: null
		},
		/**
		 * The REST connection used to upload the image.
		 */
		conn:{
			type: Vn.JsonConnection
		}
	}
	
	,initialize(props) {
		this._cssClass = 'cell-image';
		Htk.Column.prototype.initialize.call(this, props);
	}

	,render(tr) {
		var image = new Htk.Image({
			 directory: this.directory
			,subdir: this.subdir
			,fullDir: this.fullDir
			,value: this.value
			,conn: this.conn
			,doc: this.doc
		});

		var td = Htk.Column.prototype.render.call(this, tr);
		td.appendChild(image.node);
		return td;
	}
});
