Coverage Report - net.sf.tacos.components.FieldHint
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldHint
0% 
0% 
1,2
 
 1  
 package net.sf.tacos.components;
 2  
 
 3  
 import java.util.HashMap;
 4  
 import java.util.Map;
 5  
 
 6  
 import org.apache.tapestry.BaseComponent;
 7  
 import org.apache.tapestry.IMarkupWriter;
 8  
 import org.apache.tapestry.IRequestCycle;
 9  
 import org.apache.tapestry.IScript;
 10  
 import org.apache.tapestry.TapestryUtils;
 11  
 import org.apache.tapestry.form.IFormComponent;
 12  
 
 13  
 /**
 14  
  * Provides a hint for a form field to guide the user on how to fill it.
 15  
  * The box with the helper text appears when the field is focused and disappears when the focus is lost.
 16  
  * 
 17  
  * @author Igor Drobiazko
 18  
  */
 19  0
 public abstract class FieldHint extends BaseComponent {
 20  
         /**
 21  
      * {@inheritDoc}
 22  
      */
 23  
         protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
 24  0
                 writer.begin("span");
 25  0
         renderIdAttribute(writer, cycle);
 26  0
         writer.appendAttribute("class", "hint");
 27  0
         renderBody(writer, cycle);
 28  0
         super.renderComponent(writer, cycle);
 29  0
         writer.end();
 30  
         
 31  0
         if (!cycle.isRewinding()) {
 32  0
             Map parms = new HashMap();
 33  0
             parms.put("component", this);
 34  0
             parms.put("startEvent", getStartEvent());
 35  0
             parms.put("endEvent", getEndEvent());
 36  
 
 37  0
             getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
 38  
             }
 39  0
         }
 40  
         
 41  
     /** Injected {@link IScript}. */
 42  
     public abstract IScript getScript();
 43  
     
 44  
     /** Field parameter. */
 45  
     public abstract IFormComponent getField();
 46  
     
 47  
     /** The js event of the form component that should make the hint visible. */
 48  
     public abstract String getStartEvent();
 49  
     
 50  
     /** The js event of the form component that should make the hint hidden. */
 51  
     public abstract String getEndEvent();    
 52  
 }