/**
 * An abstract element in a document
 *
 * This is used in an example of event bubbling
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public abstract class AbstractDocumentElement 
                      extends AbstractEventHandler
{
    
//[handleEvent.

    /**
     * Handle an event
     *
     * @param event   The event to handle
     * @return        true if the event was handled
     */
    public boolean handleEvent(BubblingEvent event)
    {
	boolean      handled;
	String       name, value;

	name  = event.getName();
	value = event.getValue();

	handled = false;

	if      (name.equals("FaceChange"))  
        {
           handled = handleFaceChange(value);
        }
        else if (name.equals("SizeChange"))
        {
           handled = handleSizeChange(value);
        }
	else if (name.equals("StyleChange"))
        {
           handled = handleStyleChange(value);
        }

	return handled;
    }
//]handleEvent.

//[defaultHandlers.

    /**
     * Handle a font face change event
     *
     * @param face    The new font face (e.g., TimesRoman)
     */
    protected boolean handleFaceChange(String face)
    {
       return false;       
    }
    



    /**
     * Handle a font size change event
     *
     * @param pointSize    The new font size (e.g., 12)
     */
    protected boolean handleSizeChange(String pointSize)
    {
       return false;       
    }



    /**
     * Handle a font style change event
     *
     * @param style    The new font style (e.g., Italic)
     */
    protected boolean handleStyleChange(String style)
    {
       return false;       
    }
//]defaultHandlers.
}
