Clover coverage report - angkor - 0.4
Coverage timestamp: ti okt 15 2002 22:32:48 CEST
file stats: LOC: 111   Methods: 14
NCLOC: 85   Classes: 1
Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
Button.java 0% 0% 0% 0%
 1   
 package com.tirsen.angkor.widget;
 2   
 
 3   
 import com.tirsen.angkor.RenderContext;
 4   
 import com.tirsen.angkor.Component;
 5   
 import com.tirsen.angkor.event.Action;
 6   
 import com.tirsen.angkor.event.ActionListener;
 7   
 import com.tirsen.angkor.event.ActionSource;
 8   
 import com.tirsen.angkor.event.ActionSourceHelper;
 9   
 
 10   
 import java.io.IOException;
 11   
 
 12   
 /**
 13   
  * @author $Author: tirsen $
 14   
  * @version $Revision: 1.6 $
 15   
  * <BR>
 16   
  * $Id: Button.java,v 1.6 2002/10/13 19:59:22 tirsen Exp $
 17   
  */
 18   
 public class Button extends Component implements ActionSource
 19   
 {
 20   
     private ActionSourceHelper actionSourceHelper = new ActionSourceHelper(this);
 21   
     private String label;
 22   
 
 23  0
     public Button(String id)
 24   
     {
 25  0
         super(id);
 26   
     }
 27   
 
 28  0
     public Button()
 29   
     {
 30   
     }
 31   
 
 32  0
     public Button(Action action)
 33   
     {
 34  0
         actionSourceHelper.setAction(action);
 35   
     }
 36   
 
 37  0
     public void setAction(Action action)
 38   
     {
 39  0
         actionSourceHelper.setAction(action);
 40   
     }
 41   
 
 42  0
     public Action getAction()
 43   
     {
 44  0
         return actionSourceHelper.getAction();
 45   
     }
 46   
 
 47  0
     public void addActionListener(ActionListener listener)
 48   
     {
 49  0
         actionSourceHelper.addActionListener(listener);
 50   
     }
 51   
 
 52  0
     public void removeActionListener(ActionListener listener)
 53   
     {
 54  0
         actionSourceHelper.removeActionListener(listener);
 55   
     }
 56   
 
 57  0
     public void signalActionEvent()
 58   
     {
 59  0
         actionSourceHelper.signalActionEvent();
 60   
     }
 61   
 
 62  0
     public void setLabel(String label)
 63   
     {
 64  0
         this.label = label;
 65   
     }
 66   
 
 67  0
     public boolean isParsing()
 68   
     {
 69  0
         return true;
 70   
     }
 71   
 
 72  0
     public void parse(RenderContext context)
 73   
     {
 74  0
         super.parse(context);
 75  0
         if (context.getRequestParameter(getId()) != null)
 76   
         {
 77  0
             actionSourceHelper.signalActionEvent(context);
 78   
         }
 79   
     }
 80   
 
 81  0
     public String getLabel()
 82   
     {
 83  0
         String actualLabel = null;
 84   
 
 85  0
         if (label != null)
 86   
         {
 87  0
             actualLabel = label;
 88   
         }
 89   
         else
 90   
         {
 91  0
             if (getAction() != null) actualLabel = (String) getAction().getValue(Action.NAME);
 92   
         }
 93   
 
 94  0
         return actualLabel;
 95   
     }
 96   
 
 97  0
     public void render(RenderContext context) throws IOException
 98   
     {
 99  0
         if (isVisible())
 100   
         {
 101  0
             context.startTag("INPUT name=\"" + uniqueId(context) + "\" type=\"submit\" value=\"" + getLabel() + "\"");
 102  0
             context.getApplication().registerParsingComponent(this);
 103   
         }
 104   
     }
 105   
 
 106  0
     public String toString()
 107   
     {
 108  0
         return getClass().getName() + "[" + label + "]";
 109   
     }
 110   
 }
 111