function AlignmentSelector() 
{
    /**
     * implementation of @{link EventHandler} interface
     */
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_HEADING_SELECTED ) {
	    this.fHeadingView = src;
	    this.update();
	}
	else if( evt == EventManager.EVENT_MENU_CLOSED )
	    this.setSelected(false);
    }

    /**
     * called when a certain alignment is selected (used in testing also)
     * @private
     */
    this.onAlignment = function(alignment) {
	if( !this.fHeadingView ) return;
	this.fHeadingView.setAlignment(alignment);
	this.update();
    }
    
    /**
     * implementation of @{link ActionHandler} interface
     */
    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.fAlignmentMenu.show(x,y);
	}
	else {
	    // menu item is selected, actionID == alignment
	    this.onAlignment(actionID);
	}
    }

    /**
     * override of base-class method to provide real content
     */
    this.provideContent = function() {
	var div = document.createElement("div");
	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%";
	if( !Utils.isIE() )		// IE doesnt support table
	    div.style.display  = "table";	// very important for firefox so that arrow
					// div below has a chance to occupy same
					// height as others (and draw at the bottom)
	div.style.height   = "1.5em";	// give some height
	div.style.width    = "5.75em";


	var div2 = document.createElement("div");
	div2.style.cssFloat = "left";
	div2.style.display  = "inline";
	div2.style.height = "100%";
	div2.style.width  = "4em";
	this.fLabelView = document.createTextNode(this._getAlignment());
	div2.appendChild(this.fLabelView);
	div.appendChild(div2);

	var arrow = document.createElement("div");
	arrow.style.width = "1.75em";
	arrow.style.height = "100%";
	arrow.style.background = LookAndFeel.url("but_arrow.png") + " center right no-repeat";	
	arrow.style.cssFloat = "right";
	arrow.style.display  = "inline";
	div.appendChild(arrow);

	return div;
    }

    /**
     * internal method to get stringized form of the octave/stayi
     * @return get stringized form of the current octave/stayi
     * @type String
     * @private
     */
    this._getAlignment = function() {
	var alignment = ALIGN_CENTER;
	if(this.fHeadingView) {
	     alignment = this.fHeadingView.getModel().fAlignment;
	}
	var str = "";
	if( alignment == ALIGN_LEFT ) str += "left";
	else if( alignment == ALIGN_CENTER ) str += "center";
	else  {
	    str +=  "right";
	}
	return str;
    }

    /**
     * internal method to update display
     * @private
     */
    this.update = function() {
	this.fLabelView.nodeValue = this._getAlignment();
    }

    /**
     * the alignment menu which is popped-up when the selector is selected
     * @type Menu
     * @private
     */
    this.fAlignmentMenu = new Menu();
    this.fAlignmentMenu.initMenu();
    this.fAlignmentMenu.addTextItem( "Left", this, ALIGN_LEFT);
    this.fAlignmentMenu.addTextItem( "Center", this, ALIGN_CENTER);
    this.fAlignmentMenu.addTextItem( "Right", this, ALIGN_RIGHT);

    this.initButton(this, null);
    EventManager.addListener(EventManager.EVENT_HEADING_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_MENU_CLOSED, this);

    /**
     * current heading view being modified
     * @type HeadingView
     * @private
     */
    this.fHeadingView = null;
}
/**
 * @class
 * text alignment selector, which is part of the heading tool bar. It also
 * implements the @{link EventListener} and @{link ActionHandler} interfaces
 */
@class
text alignment selector, which is part of the heading tool bar. It also
implements the @{link EventListener} and @{link ActionHandler} interfaces
@class text alignment selector which is part of the heading tool bar . It also implements the @ { link EventListener } and @ { link ActionHandler } interfaces
function AlignmentSelector() 
{
    this.onEvent = function(evt, src, data) {
	if( evt == EventManager.EVENT_HEADING_SELECTED ) {
	    this.fHeadingView = src;
	    this.update();
	}
	else if( evt == EventManager.EVENT_MENU_CLOSED )
	    this.setSelected(false);
    }
    this.onAlignment = function(alignment) {
	if( !this.fHeadingView ) return;
	this.fHeadingView.setAlignment(alignment);
	this.update();
    }
    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.fAlignmentMenu.show(x,y);
	}
	else {
	    this.onAlignment(actionID);
	}
    }
    this.provideContent = function() {
	var div = document.createElement("div");
	div.style.fontSize   = "85%";	
	div.style.fontWeight = "bold";	
	div.style.width      = "100%";
	if( !Utils.isIE() )		
	    div.style.display  = "table";	
	div.style.height   = "1.5em";	
	div.style.width    = "5.75em";
	var div2 = document.createElement("div");
	div2.style.cssFloat = "left";
	div2.style.display  = "inline";
	div2.style.height = "100%";
	div2.style.width  = "4em";
	this.fLabelView = document.createTextNode(this._getAlignment());
	div2.appendChild(this.fLabelView);
	div.appendChild(div2);
	var arrow = document.createElement("div");
	arrow.style.width = "1.75em";
	arrow.style.height = "100%";
	arrow.style.background = LookAndFeel.url("but_arrow.png") + " center right no-repeat";	
	arrow.style.cssFloat = "right";
	arrow.style.display  = "inline";
	div.appendChild(arrow);
	return div;
    }
    this._getAlignment = function() {
	var alignment = ALIGN_CENTER;
	if(this.fHeadingView) {
	     alignment = this.fHeadingView.getModel().fAlignment;
	}
	var str = "";
	if( alignment == ALIGN_LEFT ) str += "left";
	else if( alignment == ALIGN_CENTER ) str += "center";
	else  {
	    str +=  "right";
	}
	return str;
    }
    this.update = function() {
	this.fLabelView.nodeValue = this._getAlignment();
    }
    this.fAlignmentMenu = new Menu();
    this.fAlignmentMenu.initMenu();
    this.fAlignmentMenu.addTextItem( "Left", this, ALIGN_LEFT);
    this.fAlignmentMenu.addTextItem( "Center", this, ALIGN_CENTER);
    this.fAlignmentMenu.addTextItem( "Right", this, ALIGN_RIGHT);
    this.initButton(this, null);
    EventManager.addListener(EventManager.EVENT_HEADING_SELECTED, this);
    EventManager.addListener(EventManager.EVENT_MENU_CLOSED, this);
    this.fHeadingView = null;
}
function AlignmentSelector ( ) { this . onEvent = function ( evt , src , data ) { if ( evt == EventManager . EVENT_HEADING_SELECTED ) { this . fHeadingView = src ; this . update ( ) ; } else if ( evt == EventManager . EVENT_MENU_CLOSED ) this . setSelected ( false ) ; } this . onAlignment = function ( alignment ) { if ( ! this . fHeadingView ) return ; this . fHeadingView . setAlignment ( alignment ) ; this . update ( ) ; } 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 . fAlignmentMenu . show ( x , y ) ; } else { this . onAlignment ( actionID ) ; } } this . provideContent = function ( ) { var div = document . createElement ( "div" ) ; div . style . fontSize = "85%" ; div . style . fontWeight = "bold" ; div . style . width = "100%" ; if ( ! Utils . isIE ( ) ) div . style . display = "table" ; div . style . height = "1.5em" ; div . style . width = "5.75em" ; var div2 = document . createElement ( "div" ) ; div2 . style . cssFloat = "left" ; div2 . style . display = "inline" ; div2 . style . height = "100%" ; div2 . style . width = "4em" ; this . fLabelView = document . createTextNode ( this . _getAlignment ( ) ) ; div2 . appendChild ( this . fLabelView ) ; div . appendChild ( div2 ) ; var arrow = document . createElement ( "div" ) ; arrow . style . width = "1.75em" ; arrow . style . height = "100%" ; arrow . style . background = LookAndFeel . url ( "but_arrow.png" ) + " center right no-repeat" ; arrow . style . cssFloat = "right" ; arrow . style . display = "inline" ; div . appendChild ( arrow ) ; return div ; } this . _getAlignment = function ( ) { var alignment = ALIGN_CENTER ; if ( this . fHeadingView ) { alignment = this . fHeadingView . getModel ( ) . fAlignment ; } var str = "" ; if ( alignment == ALIGN_LEFT ) str += "left" ; else if ( alignment == ALIGN_CENTER ) str += "center" ; else { str += "right" ; } return str ; } this . update = function ( ) { this . fLabelView . nodeValue = this . _getAlignment ( ) ; } this . fAlignmentMenu = new Menu ( ) ; this . fAlignmentMenu . initMenu ( ) ; this . fAlignmentMenu . addTextItem ( "Left" , this , ALIGN_LEFT ) ; this . fAlignmentMenu . addTextItem ( "Center" , this , ALIGN_CENTER ) ; this . fAlignmentMenu . addTextItem ( "Right" , this , ALIGN_RIGHT ) ; this . initButton ( this , null ) ; EventManager . addListener ( EventManager . EVENT_HEADING_SELECTED , this ) ; EventManager . addListener ( EventManager . EVENT_MENU_CLOSED , this ) ; this . fHeadingView = null ; }
@class
 text alignment selector, which is part of the heading tool bar.
@class text alignment selector which is part of the heading tool bar .
/**
     * implementation of @{link EventHandler} interface
     */ /**
     * called when a certain alignment is selected (used in testing also)
     * @private
     */ /**
     * implementation of @{link ActionHandler} interface
     */ // menu item is selected, actionID == alignment
 /**
     * 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
 // IE doesnt support table
 // very important for firefox so that arrow
 // div below has a chance to occupy same
 // height as others (and draw at the bottom)
 // give some height
 /**
     * internal method to get stringized form of the octave/stayi
     * @return get stringized form of the current octave/stayi
     * @type String
     * @private
     */ /**
     * internal method to update display
     * @private
     */ /**
     * the alignment menu which is popped-up when the selector is selected
     * @type Menu
     * @private
     */ /**
     * current heading view being modified
     * @type HeadingView
     * @private
     */