View Javadoc

1   /*
2    * Firebug.java
3    */
4   
5   package net.sf.tacos.components;
6   
7   import org.apache.tapestry.AbstractComponent;
8   import org.apache.tapestry.IAsset;
9   import org.apache.tapestry.IMarkupWriter;
10  import org.apache.tapestry.IRequestCycle;
11  
12  /**
13   * Adds Firebug-lite into current page.
14   * @author andyhot
15   */
16  public abstract class Firebug extends AbstractComponent
17  {    
18      public abstract boolean isDisabled();
19  
20      protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
21      {
22          if (!cycle.isRewinding() && !isDisabled())
23          {         
24              cycle.getResponseBuilder().addExternalScript(this, 
25                      getScriptAsset().getResourceLocation());
26          }
27      }  
28      
29      /** Injected asset. */
30      public abstract IAsset getScriptAsset();     
31  }