001    /*
002     * Firebug.java
003     */
004    
005    package net.sf.tacos.components;
006    
007    import org.apache.tapestry.AbstractComponent;
008    import org.apache.tapestry.IAsset;
009    import org.apache.tapestry.IMarkupWriter;
010    import org.apache.tapestry.IRequestCycle;
011    
012    /**
013     * Adds Firebug-lite into current page.
014     * @author andyhot
015     */
016    public abstract class Firebug extends AbstractComponent
017    {    
018        public abstract boolean isDisabled();
019    
020        protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
021        {
022            if (!cycle.isRewinding() && !isDisabled())
023            {         
024                cycle.getResponseBuilder().addExternalScript(this, 
025                        getScriptAsset().getResourceLocation());
026            }
027        }  
028        
029        /** Injected asset. */
030        public abstract IAsset getScriptAsset();     
031    }