function AddFontForm() 
{
    /**
     * implementation of {@link Form#onShow}
     */
    this.onShow = function() {
	this.fFontTextBox.focus();
    }

    /**
     * implementation of {@link ActionHandler} interface
     */
    this.doAction = function(src, actionID) {
	if( actionID == "ok" ) {
	    if( this.fFontTextBox.value == "" )
		alert("Please specify a font");
	    else {
		var fonts = new Array();
		fonts[fonts.length] = new Font( this.fFontTextBox.value, Font.prototype.INSTALLED_DONTKNOW);
		FontManager.updateFontStates(this.getContent(), fonts, null);
		if( fonts[0].fInstalled == Font.prototype.INSTALLED_NO ) {
		    var msg = "Font '" + fonts[0].fName + "' is not installed on your computer";
		    alert(msg);
		}
		else {
		    EventManager.postEvent(EventManager.EVENT_FONT_ADDED, fonts[0].fName, fonts[0].fName);
		    this.hide();
		}
	    }
	}
	else if( actionID == "cancel" ) {
	    this.hide();
	}
    }

    /**
     * override of {@link Form#provideContent} to provide content of
     * the form
     */
    this.provideContent = function() {
	/* 
	 * turned out to be a nighmare to lay this out. Decided on table
	 * # top row is instruction message
	 * # next row is font name label + input text box (both enclosed in a div)
	 * # next row is ok and cancel button with some space between (all enclosed
	 *   in a table, which is then centered in the table row)
	 */
	 
	var tbl = document.createElement("table");

	var maxCells = 1;

	var tr1 = tbl.insertRow(0);
	var div = document.createElement("div");
	div.style.wordWrap = "break-word";
	div.style.width    = "30em";
	div.style.color    = "green";
	div.appendChild(document.createTextNode("Please specify the name of a font installed on your computer. You may look up the installed fonts from your browser font selection dialog, or any other program which allows you to select a font"));
	var td = Utils.addTableCell(tr1, div, maxCells);
	td.style.paddingBottom = "0.5em"; // add bottom spacer

	var tr2 = tbl.insertRow(1);


	var fn = document.createElement("div");

	var lbl = document.createElement("div");
	lbl.style.fontWeight = "bold";
	lbl.style.width      = "6em";
	lbl.style.display    = "inline";
	lbl.style.cssFloat     = "left";
	lbl.appendChild(document.createTextNode("Font Name: "));
	fn.appendChild(lbl);


	var i = document.createElement("input");
	i.type           = "text";
	i.style.fontSize = "100%";// so it scales with the browse text size (liquid design)
	i.style.width    = "22em";
	i.style.textAlign = "left";
	i.style.display   = "inline";
	i.style.cssFloat  = "right";
	fn.appendChild(i);
	this.fFontTextBox = i;

	var td21 = Utils.addTableCell(tr2, fn, 1);
	td21.style.textAlign = "left";
	td21.style.paddingBottom = "0.5em"; // add bottom spacer

	var tr3 = tbl.insertRow(2);
	var center = document.createElement("center");
	var div3 = document.createElement("table");
	div3.style.width = "10em";
	div3.style.textAlign = "center";

	var t = div3.insertRow(0);
	var ok = new GenericButton();
	ok.initButton(this, "ok", "OK");
	ok.getContent().style.fontWeight = "bold";
	ok.getContent().style.width = "4em";
	ok.getContent().style.textAlign = "center";
	Utils.addTableCell(t, ok.getContent(), 1 );

	var sp = document.createElement("div");
	sp.style.width = "1em";
	Utils.addTableCell(t, sp, 1 );

	var cancel = new GenericButton();
	cancel.initButton(this, "cancel", "Cancel");
	cancel.getContent().style.fontWeight = "bold";
	cancel.getContent().style.width = "4em";
	cancel.getContent().style.textAlign = "center";
	Utils.addTableCell(t, cancel.getContent(), 1 );
	center.appendChild(div3);

	var td3 = Utils.addTableCell(tr3, center, maxCells);

	return tbl;
    }
}
/**
 * @class
 * represents the form that allows a user to type in a font name, which
 * is then checked as to whether it is installed or not and then added
 * to the system
 */
@class
represents the form that allows a user to type in a font name, which
is then checked as to whether it is installed or not and then added
to the system
@class represents the form that allows a user to type in a font name which is then checked as to whether it is installed or not and then added to the system
function AddFontForm() 
{
    this.onShow = function() {
	this.fFontTextBox.focus();
    }
    this.doAction = function(src, actionID) {
	if( actionID == "ok" ) {
	    if( this.fFontTextBox.value == "" )
		alert("Please specify a font");
	    else {
		var fonts = new Array();
		fonts[fonts.length] = new Font( this.fFontTextBox.value, Font.prototype.INSTALLED_DONTKNOW);
		FontManager.updateFontStates(this.getContent(), fonts, null);
		if( fonts[0].fInstalled == Font.prototype.INSTALLED_NO ) {
		    var msg = "Font '" + fonts[0].fName + "' is not installed on your computer";
		    alert(msg);
		}
		else {
		    EventManager.postEvent(EventManager.EVENT_FONT_ADDED, fonts[0].fName, fonts[0].fName);
		    this.hide();
		}
	    }
	}
	else if( actionID == "cancel" ) {
	    this.hide();
	}
    }
    this.provideContent = function() {
	var tbl = document.createElement("table");
	var maxCells = 1;
	var tr1 = tbl.insertRow(0);
	var div = document.createElement("div");
	div.style.wordWrap = "break-word";
	div.style.width    = "30em";
	div.style.color    = "green";
	div.appendChild(document.createTextNode("Please specify the name of a font installed on your computer. You may look up the installed fonts from your browser font selection dialog, or any other program which allows you to select a font"));
	var td = Utils.addTableCell(tr1, div, maxCells);
	td.style.paddingBottom = "0.5em"; 
	var tr2 = tbl.insertRow(1);
	var fn = document.createElement("div");
	var lbl = document.createElement("div");
	lbl.style.fontWeight = "bold";
	lbl.style.width      = "6em";
	lbl.style.display    = "inline";
	lbl.style.cssFloat     = "left";
	lbl.appendChild(document.createTextNode("Font Name: "));
	fn.appendChild(lbl);
	var i = document.createElement("input");
	i.type           = "text";
	i.style.fontSize = "100%";
	i.style.width    = "22em";
	i.style.textAlign = "left";
	i.style.display   = "inline";
	i.style.cssFloat  = "right";
	fn.appendChild(i);
	this.fFontTextBox = i;
	var td21 = Utils.addTableCell(tr2, fn, 1);
	td21.style.textAlign = "left";
	td21.style.paddingBottom = "0.5em"; 
	var tr3 = tbl.insertRow(2);
	var center = document.createElement("center");
	var div3 = document.createElement("table");
	div3.style.width = "10em";
	div3.style.textAlign = "center";
	var t = div3.insertRow(0);
	var ok = new GenericButton();
	ok.initButton(this, "ok", "OK");
	ok.getContent().style.fontWeight = "bold";
	ok.getContent().style.width = "4em";
	ok.getContent().style.textAlign = "center";
	Utils.addTableCell(t, ok.getContent(), 1 );
	var sp = document.createElement("div");
	sp.style.width = "1em";
	Utils.addTableCell(t, sp, 1 );
	var cancel = new GenericButton();
	cancel.initButton(this, "cancel", "Cancel");
	cancel.getContent().style.fontWeight = "bold";
	cancel.getContent().style.width = "4em";
	cancel.getContent().style.textAlign = "center";
	Utils.addTableCell(t, cancel.getContent(), 1 );
	center.appendChild(div3);
	var td3 = Utils.addTableCell(tr3, center, maxCells);
	return tbl;
    }
}
function AddFontForm ( ) { this . onShow = function ( ) { this . fFontTextBox . focus ( ) ; } this . doAction = function ( src , actionID ) { if ( actionID == "ok" ) { if ( this . fFontTextBox . value == "" ) alert ( "Please specify a font" ) ; else { var fonts = new Array ( ) ; fonts [ fonts . length ] = new Font ( this . fFontTextBox . value , Font . prototype . INSTALLED_DONTKNOW ) ; FontManager . updateFontStates ( this . getContent ( ) , fonts , null ) ; if ( fonts [ 0 ] . fInstalled == Font . prototype . INSTALLED_NO ) { var msg = "Font '" + fonts [ 0 ] . fName + "' is not installed on your computer" ; alert ( msg ) ; } else { EventManager . postEvent ( EventManager . EVENT_FONT_ADDED , fonts [ 0 ] . fName , fonts [ 0 ] . fName ) ; this . hide ( ) ; } } } else if ( actionID == "cancel" ) { this . hide ( ) ; } } this . provideContent = function ( ) { var tbl = document . createElement ( "table" ) ; var maxCells = 1 ; var tr1 = tbl . insertRow ( 0 ) ; var div = document . createElement ( "div" ) ; div . style . wordWrap = "break-word" ; div . style . width = "30em" ; div . style . color = "green" ; div . appendChild ( document . createTextNode ( "Please specify the name of a font installed on your computer. You may look up the installed fonts from your browser font selection dialog, or any other program which allows you to select a font" ) ) ; var td = Utils . addTableCell ( tr1 , div , maxCells ) ; td . style . paddingBottom = "0.5em" ; var tr2 = tbl . insertRow ( 1 ) ; var fn = document . createElement ( "div" ) ; var lbl = document . createElement ( "div" ) ; lbl . style . fontWeight = "bold" ; lbl . style . width = "6em" ; lbl . style . display = "inline" ; lbl . style . cssFloat = "left" ; lbl . appendChild ( document . createTextNode ( "Font Name: " ) ) ; fn . appendChild ( lbl ) ; var i = document . createElement ( "input" ) ; i . type = "text" ; i . style . fontSize = "100%" ; i . style . width = "22em" ; i . style . textAlign = "left" ; i . style . display = "inline" ; i . style . cssFloat = "right" ; fn . appendChild ( i ) ; this . fFontTextBox = i ; var td21 = Utils . addTableCell ( tr2 , fn , 1 ) ; td21 . style . textAlign = "left" ; td21 . style . paddingBottom = "0.5em" ; var tr3 = tbl . insertRow ( 2 ) ; var center = document . createElement ( "center" ) ; var div3 = document . createElement ( "table" ) ; div3 . style . width = "10em" ; div3 . style . textAlign = "center" ; var t = div3 . insertRow ( 0 ) ; var ok = new GenericButton ( ) ; ok . initButton ( this , "ok" , "OK" ) ; ok . getContent ( ) . style . fontWeight = "bold" ; ok . getContent ( ) . style . width = "4em" ; ok . getContent ( ) . style . textAlign = "center" ; Utils . addTableCell ( t , ok . getContent ( ) , 1 ) ; var sp = document . createElement ( "div" ) ; sp . style . width = "1em" ; Utils . addTableCell ( t , sp , 1 ) ; var cancel = new GenericButton ( ) ; cancel . initButton ( this , "cancel" , "Cancel" ) ; cancel . getContent ( ) . style . fontWeight = "bold" ; cancel . getContent ( ) . style . width = "4em" ; cancel . getContent ( ) . style . textAlign = "center" ; Utils . addTableCell ( t , cancel . getContent ( ) , 1 ) ; center . appendChild ( div3 ) ; var td3 = Utils . addTableCell ( tr3 , center , maxCells ) ; return tbl ; } }
@class
 represents the form that allows a user to type in a font name, which
 is then checked as to whether it is installed or not and then added
 to the system
@class represents the form that allows a user to type in a font name which is then checked as to whether it is installed or not and then added to the system
/**
     * implementation of {@link Form#onShow}
     */ /**
     * implementation of {@link ActionHandler} interface
     */ /**
     * override of {@link Form#provideContent} to provide content of
     * the form
     */ /* 
	 * turned out to be a nighmare to lay this out. Decided on table
	 * # top row is instruction message
	 * # next row is font name label + input text box (both enclosed in a div)
	 * # next row is ok and cancel button with some space between (all enclosed
	 *   in a table, which is then centered in the table row)
	 */ // add bottom spacer
 // so it scales with the browse text size (liquid design)
 // add bottom spacer
