function GamakaSelector() 
{
    /**
     * {@link EventListener} interface implementation
     */
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_SWARA_SELECTED ) {
	    if( data.isPause() ) {
		this.fGamaka = null;
		this.update();
		this.setEnabled(false);
	    }
	    else {
		this.fGamaka = data.getGamaka();
		this.update();
		this.setEnabled(true);
	    }
	}
	else  {
	    this.fGamaka = null;
	    this.update();
	}
	if( evt == EventManager.EVENT_MENU_CLOSED )
	    this.setSelected(false);
    }

    /**
     * called when a certain gamaka is selected (used in testing also)
     * @private
     */
    this.onGamaka = function(gamaka) {
	this.fGamaka = gamaka;
	this.update();
	EventManager.postEvent(EventManager.EVENT_SWARATOOLBAR_GAMAKACHANGED, this, this.fGamaka);
    }


    /**
     * {@link ActionHandler} interface implementation
     */
    this.doAction = function(src, actionID) {
	if( src == this ) {
	    var obj = src.getContent();
	    var x = LookAndFeel.findPosX(obj);
	    var y = LookAndFeel.findPosY(obj) + obj.offsetHeight;
	    this.fGamakaMenu.show(x,y);
	}
	else {
	    this.onGamaka(actionID);
	}
    }

    /**
     * override of base class method to provide real content
     */
    this.provideContent = function() {
	var table = document.createElement("table");
	var tr = table.insertRow(0);

	var div = document.createElement("div");
	div.style.height = "100%";
	div.style.fontSize = "85%";	// need to to this to match toolbar font
	div.style.fontWeight = "bold";	// need to to this to match toolbar font
	div.style.width = "100%";
	var lbl = "None";
	if( this.fGamaka ) 
	    lbl = this.fGamaka.getName() + ": ";
	this.fLabelView = document.createTextNode(lbl);
	div.appendChild(this.fLabelView);
	this.fTableCell = Utils.addTableCell(tr, div, 1);

	this.fGamakaContainer = document.createElement("div");
	if( this.fGamaka ) {
	    this.fGamaka.render(this.fGamakaContainer);
	}
	Utils.addTableCell(tr, this.fGamakaContainer, 1);

	this.fArrow = document.createElement("img");
	this.fArrow.src = LookAndFeel.srcurl("but_arrow.png");
	Utils.addTableCell(tr, this.fArrow, 1);

	return table;
    }

    this.update = function() {
	var td = this.fGamakaContainer.parentNode;
	td.removeChild(this.fGamakaContainer);
	this.fGamakaContainer = document.createElement("div");
	var txt = "None";
	if( this.fGamaka ) {
	    this.fGamakaContainer.appendChild(this.fGamaka.render());
	    this.fGamakaContainer.style.border = "thin solid";
	    this.fGamakaContainer.style.background = "white";
	    this.fGamakaContainer.style.padding = "2 2 2 2";
	    txt = this.fGamaka.getName() + " :";
	}
	else
	    this.fGamakaContainer.style.border = "none";
	this.fLabelView.nodeValue = txt;
	td.appendChild(this.fGamakaContainer);
    }

    this.fGamaka     = null;

    this.fGamakaMenu = new GamakaMenu();
    this.fGamakaMenu.initMenu();
    this.fGamakaMenu.init(this);
    this.initButton(this, null);

    EventManager.addListener(EventManager.EVENT_SWARA_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NEWSWARASPACER_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_MENU_CLOSED, this);

}
/**
 * @class
 * gamaka selector, which is part of the swara tool bar. It also
 * implements the @{link EventListener} and @{link ActionHandler} interfaces
 */
@class
gamaka selector, which is part of the swara tool bar. It also
implements the @{link EventListener} and @{link ActionHandler} interfaces
@class gamaka selector which is part of the swara tool bar . It also implements the @ { link EventListener } and @ { link ActionHandler } interfaces
function GamakaSelector() 
{
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_SWARA_SELECTED ) {
	    if( data.isPause() ) {
		this.fGamaka = null;
		this.update();
		this.setEnabled(false);
	    }
	    else {
		this.fGamaka = data.getGamaka();
		this.update();
		this.setEnabled(true);
	    }
	}
	else  {
	    this.fGamaka = null;
	    this.update();
	}
	if( evt == EventManager.EVENT_MENU_CLOSED )
	    this.setSelected(false);
    }
    this.onGamaka = function(gamaka) {
	this.fGamaka = gamaka;
	this.update();
	EventManager.postEvent(EventManager.EVENT_SWARATOOLBAR_GAMAKACHANGED, this, this.fGamaka);
    }
    this.doAction = function(src, actionID) {
	if( src == this ) {
	    var obj = src.getContent();
	    var x = LookAndFeel.findPosX(obj);
	    var y = LookAndFeel.findPosY(obj) + obj.offsetHeight;
	    this.fGamakaMenu.show(x,y);
	}
	else {
	    this.onGamaka(actionID);
	}
    }
    this.provideContent = function() {
	var table = document.createElement("table");
	var tr = table.insertRow(0);
	var div = document.createElement("div");
	div.style.height = "100%";
	div.style.fontSize = "85%";	
	div.style.fontWeight = "bold";	
	div.style.width = "100%";
	var lbl = "None";
	if( this.fGamaka ) 
	    lbl = this.fGamaka.getName() + ": ";
	this.fLabelView = document.createTextNode(lbl);
	div.appendChild(this.fLabelView);
	this.fTableCell = Utils.addTableCell(tr, div, 1);
	this.fGamakaContainer = document.createElement("div");
	if( this.fGamaka ) {
	    this.fGamaka.render(this.fGamakaContainer);
	}
	Utils.addTableCell(tr, this.fGamakaContainer, 1);
	this.fArrow = document.createElement("img");
	this.fArrow.src = LookAndFeel.srcurl("but_arrow.png");
	Utils.addTableCell(tr, this.fArrow, 1);
	return table;
    }
    this.update = function() {
	var td = this.fGamakaContainer.parentNode;
	td.removeChild(this.fGamakaContainer);
	this.fGamakaContainer = document.createElement("div");
	var txt = "None";
	if( this.fGamaka ) {
	    this.fGamakaContainer.appendChild(this.fGamaka.render());
	    this.fGamakaContainer.style.border = "thin solid";
	    this.fGamakaContainer.style.background = "white";
	    this.fGamakaContainer.style.padding = "2 2 2 2";
	    txt = this.fGamaka.getName() + " :";
	}
	else
	    this.fGamakaContainer.style.border = "none";
	this.fLabelView.nodeValue = txt;
	td.appendChild(this.fGamakaContainer);
    }
    this.fGamaka     = null;
    this.fGamakaMenu = new GamakaMenu();
    this.fGamakaMenu.initMenu();
    this.fGamakaMenu.init(this);
    this.initButton(this, null);
    EventManager.addListener(EventManager.EVENT_SWARA_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_NEWSWARASPACER_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_MENU_CLOSED, this);
}
function GamakaSelector ( ) { this . onEvent = function ( evt , src , data ) { if ( evt == EventManager . EVENT_SWARA_SELECTED ) { if ( data . isPause ( ) ) { this . fGamaka = null ; this . update ( ) ; this . setEnabled ( false ) ; } else { this . fGamaka = data . getGamaka ( ) ; this . update ( ) ; this . setEnabled ( true ) ; } } else { this . fGamaka = null ; this . update ( ) ; } if ( evt == EventManager . EVENT_MENU_CLOSED ) this . setSelected ( false ) ; } this . onGamaka = function ( gamaka ) { this . fGamaka = gamaka ; this . update ( ) ; EventManager . postEvent ( EventManager . EVENT_SWARATOOLBAR_GAMAKACHANGED , this , this . fGamaka ) ; } this . doAction = function ( src , actionID ) { if ( src == this ) { var obj = src . getContent ( ) ; var x = LookAndFeel . findPosX ( obj ) ; var y = LookAndFeel . findPosY ( obj ) + obj . offsetHeight ; this . fGamakaMenu . show ( x , y ) ; } else { this . onGamaka ( actionID ) ; } } this . provideContent = function ( ) { var table = document . createElement ( "table" ) ; var tr = table . insertRow ( 0 ) ; var div = document . createElement ( "div" ) ; div . style . height = "100%" ; div . style . fontSize = "85%" ; div . style . fontWeight = "bold" ; div . style . width = "100%" ; var lbl = "None" ; if ( this . fGamaka ) lbl = this . fGamaka . getName ( ) + ": " ; this . fLabelView = document . createTextNode ( lbl ) ; div . appendChild ( this . fLabelView ) ; this . fTableCell = Utils . addTableCell ( tr , div , 1 ) ; this . fGamakaContainer = document . createElement ( "div" ) ; if ( this . fGamaka ) { this . fGamaka . render ( this . fGamakaContainer ) ; } Utils . addTableCell ( tr , this . fGamakaContainer , 1 ) ; this . fArrow = document . createElement ( "img" ) ; this . fArrow . src = LookAndFeel . srcurl ( "but_arrow.png" ) ; Utils . addTableCell ( tr , this . fArrow , 1 ) ; return table ; } this . update = function ( ) { var td = this . fGamakaContainer . parentNode ; td . removeChild ( this . fGamakaContainer ) ; this . fGamakaContainer = document . createElement ( "div" ) ; var txt = "None" ; if ( this . fGamaka ) { this . fGamakaContainer . appendChild ( this . fGamaka . render ( ) ) ; this . fGamakaContainer . style . border = "thin solid" ; this . fGamakaContainer . style . background = "white" ; this . fGamakaContainer . style . padding = "2 2 2 2" ; txt = this . fGamaka . getName ( ) + " :" ; } else this . fGamakaContainer . style . border = "none" ; this . fLabelView . nodeValue = txt ; td . appendChild ( this . fGamakaContainer ) ; } this . fGamaka = null ; this . fGamakaMenu = new GamakaMenu ( ) ; this . fGamakaMenu . initMenu ( ) ; this . fGamakaMenu . init ( this ) ; this . initButton ( this , null ) ; EventManager . addListener ( EventManager . EVENT_SWARA_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_NEWSWARASPACER_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_MENU_CLOSED , this ) ; }
@class
 gamaka selector, which is part of the swara tool bar.
@class gamaka selector which is part of the swara tool bar .
/**
     * {@link EventListener} interface implementation
     */ /**
     * called when a certain gamaka is selected (used in testing also)
     * @private
     */ /**
     * {@link ActionHandler} interface implementation
     */ /**
     * override of base class method to provide real content
     */ // need to to this to match toolbar font
 // need to to this to match toolbar font
