Ext.ns('Sight');

Sight.ToolbarPanel = Ext.extend(Ext.Panel, {                                
     handlers:{
     	addActionHandler:function(){        	                         
     		alert('add button called!');
     	}// eo handler function
     	,updateActionHandler:function(){
     		alert('update button called!');
     	}// eo handler function 
     	,deleteActionHandler:function(){        	                         
     		alert('remove button called!');
     	}// eo handler function
     	,settingsActionHandler:function(){        	                         
     		alert('settings button called!');
     	}// eo handler function     	
     	,helpActionHandler:function(){        	                         
     		alert('help button called!');
     	}// eo handler function         
     	,aboutActionHandler:function(){        	                         
     		alert('about button called!');
     	}// eo handler function     	
     }
    ,filters:{
    	addActionFilter:true,
    	updateActionFilter:true,
    	deleteActionFilter:true,
    	archiveActionFilter:true,
    	shareActionFilter:true,
    	importActionFilter:true,
    	settingsActionFilter:true,
    	helpActionFilter:true,
    	aboutActionFilter:true,
    	backActionFilter:true
    }
    ,initComponent:function() {            	    	    	    	
    	
    	if (!this.contentEl) {
    		
    		var myFilterTb = [];
    		
    		// The add action    
			if (this.filters['addActionFilter']) {
				var addAction = new Ext.Action({
        			text: '<span class="label-element">Add</span>',                		
        			iconCls: 'sight-add',
        			handler: this.handlers['addActionHandler']       		
    			});
    			myFilterTb.push(addAction);
    		}
    		
    		// The update action    
			if (this.filters['updateActionFilter']) {
				var updateAction = new Ext.Action({
        			text: '<span class="label-element">Update</span>',
        			iconCls: 'sight-update',
        			handler: this.handlers['updateActionHandler']       
    			});
    			myFilterTb.push(updateAction);
    		}
    		 
    		// The delete action
    		if (this.filters['deleteActionFilter']) {    
				var deleteAction = new Ext.Action({
        			text: '<span class="label-element">Delete</span>',
        			iconCls: 'sight-delete',
        			handler: this.handlers['deleteActionHandler']       
    			});
    			myFilterTb.push(deleteAction);
    		}
    		        		
    		// The settings action    
    		if (this.filters['settingsActionFilter']) {
				var settingsAction = new Ext.Action({
        			text: '<span class="label-element">Settings</span>',
        			iconCls: 'sight-settings',
        			handler: this.handlers['settingsActionHandler']        
    			});
    			myFilterTb.push(settingsAction);
    		}
    		    		    		   
    		// The help action    
    		if (this.filters['helpActionFilter']) {
				var helpAction = new Ext.Action({
        			text: '<span class="label-element">Help</span>',
        			iconCls: 'sight-help',
        			handler: this.handlers['helpActionHandler']        
    			});
    			myFilterTb.push(helpAction);
    		}    
    		
    		// The about action
    		if (this.filters['aboutActionFilter']) {    
				var aboutAction = new Ext.Action({
        			text: '<span class="label-element">About</span>',
        			iconCls: 'sight-about',
        			handler: this.handlers['aboutActionHandler']        
    			});
    			myFilterTb.push(aboutAction);
    		}
    		    		   			    		    	    	    		    											 			       		
    	} // eo if
    	
    	Ext.apply(this, {
    		width:'100%',
     		height:21,
     		margins:'0 0 0 0',
     		border:false,
     		tbar:myFilterTb 	
    	});
    	    	    		   	
    	Sight.ToolbarPanel.superclass.initComponent.apply(this, arguments);
    	    					
    } // eo function initComponent
 
    ,onRender:function() {        
        Sight.ToolbarPanel.superclass.onRender.apply(this, arguments);
    } // eo function onRender
});
 
Ext.reg('toolbarpanel',Sight.ToolbarPanel);
