rem: Ext.Gemma.AnnotationToolBar.superclass.constructor.call( this, div );  
add: /* according to the docs, we shouldn't have to call this method, but * if we don't, we're left with the empty placeholder toolbar above * our new toolbar... */ Ext.Gemma.AnnotationToolBar.superclass.constructor.call( this, { autoHeight : true, renderTo : annotationGrid.tbar } ); 
context: Ext.Gemma.AnnotationToolBar = function ( div, annotationGrid, config ) {		var createHandler = config.createHandler; delete config.createHandler;	var deleteHandler = config.deleteHandler; delete config.deleteHandler;	var saveHandler = config.saveHandler; delete config.saveHandler;	if ( annotationGrid.editable && !saveHandler ) {		saveHandler = CharacteristicBrowserController.updateCharacteristics;	}	var charComboOpts = { };	if ( config.charComboWidth ) {		charComboOpts.width = config.charComboWidth; delete config.charComboWidth;	}	var mgedComboOpts = {		emptyText : "Select a class"	};	if ( config.mgedComboWidth ) {		mgedComboOpts.width = config.mgedComboWidth; delete config.mgedComboWidth;	}		Ext.Gemma.AnnotationToolBar.superclass.constructor.call( this, div );			var charCombo = new Ext.Gemma.CharacteristicCombo( charComboOpts );		var mgedCombo = new Ext.Gemma.MGEDCombo( mgedComboOpts );	mgedCombo.on( "select", function ( combo, record, index ) {		charCombo.setCategory( record.data.term, record.data.uri );		createButton.enable();	} );		var descriptionField = new Ext.form.TextField( {		allowBlank : true,		invalidText : "Enter a description",		blankText : "Add a simple description",		emptyText : "Description",		width : 75	} );		if ( createHandler ) {		var createButton = new Ext.Toolbar.Button( {			text : "create",			tooltip : "Adds the new annotation",			disabled : true,			handler : function() {				var characteristic = charCombo.getCharacteristic();				if ( config.addDescription ) {					characteristic.description = descriptionField.getValue();				}				createHandler( characteristic, annotationGrid.refresh.bind( annotationGrid ) );				mgedCombo.reset();				charCombo.reset();				descriptionField.reset();							createButton.disable();			}		} );	}		if ( deleteHandler ) {		var deleteButton = new Ext.Toolbar.Button( {			text : "delete",			tooltip : "Removes the selected annotation",			disabled : true,			handler : function() {				deleteHandler( annotationGrid.getSelectedIds(), annotationGrid.refresh.bind( annotationGrid ) );				deleteButton.disable();			}		} );		annotationGrid.getSelectionModel().on( "selectionchange", function( model ) {			var selected = model.getSelections();			if ( selected.length > 0 )				deleteButton.enable();			else				deleteButton.disable();		} );	}		if ( saveHandler ) {		var saveButton = new Ext.Toolbar.Button( {			text : "save",			tooltip : "Saves the updated annotations",			disabled : true,			handler : function() {				saveHandler( annotationGrid.getEditedCharacteristics(), annotationGrid.refresh.bind( annotationGrid ) );				saveButton.disable();	}		} );		annotationGrid.on( "afteredit", function( model ) {			saveButton.enable();		} );	}		this.addField( mgedCombo );	this.addSpacer();	this.addField( charCombo );	this.addSpacer();		if ( config.addDescription ) {		this.addField( descriptionField );		this.addSpacer();	}		if ( createHandler ) { this.addField( createButton ); }	if ( createHandler && ( deleteHandler || saveHandler ) ) { this.addSeparator(); }	if ( deleteHandler ) { this.addField( deleteButton ); }	if ( ( createHandler || deleteHandler ) && saveHandler ) { this.addSeparator(); }	if ( saveHandler ) { this.addField( saveButton ); }	}
meta: 2891	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/2891/d109eea1e59fbb030ac98e95f181f72da9611a48/AnnotationToolBar.js/buggy/gemma-web/src/main/webapp/scripts/ajax/annotation/AnnotationToolBar.js