Coverage Report - org.apache.tapestry.html.ExceptionDisplay
 
Classes in this File Line Coverage Branch Coverage Complexity
ExceptionDisplay
0% 
0% 
1
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.html;
 16  
 
 17  
 import org.apache.tapestry.BaseComponent;
 18  
 import org.apache.tapestry.IMarkupWriter;
 19  
 import org.apache.tapestry.IRequestCycle;
 20  
 import org.apache.tapestry.bean.EvenOdd;
 21  
 import org.apache.tapestry.util.exception.ExceptionDescription;
 22  
 
 23  
 /**
 24  
  * Component used to display an already formatted exception. [ <a
 25  
  * href="../../../../../ComponentReference/ExceptionDisplay.html">Component
 26  
  * Reference </a>]
 27  
  * 
 28  
  * @author Howard Lewis Ship
 29  
  */
 30  
 
 31  0
 public abstract class ExceptionDisplay extends BaseComponent
 32  
 {
 33  
     private ExceptionDescription _exception;
 34  
 
 35  
     private EvenOdd _evenOdd;
 36  
 
 37  
     public abstract int getIndex();
 38  
 
 39  
     public abstract int getCount();
 40  
 
 41  
     public abstract void setCount(int count);
 42  
 
 43  
     public abstract ExceptionDescription[] getExceptions();
 44  
     
 45  
     /**
 46  
      * Each time the current exception is set, as a side effect, the evenOdd
 47  
      * helper bean is reset to even.
 48  
      */
 49  
 
 50  
     public void setException(ExceptionDescription value)
 51  
     {
 52  0
         _exception = value;
 53  
 
 54  0
         _evenOdd.setEven(true);
 55  0
     }
 56  
 
 57  
     public ExceptionDescription getException()
 58  
     {
 59  0
         return _exception;
 60  
     }
 61  
 
 62  
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
 63  
     {
 64  0
         ExceptionDescription[] exceptions = getExceptions();
 65  
 
 66  0
         setCount(exceptions.length);
 67  
 
 68  
         try
 69  
         {
 70  0
             _evenOdd = (EvenOdd) getBeans().getBean("evenOdd");
 71  
 
 72  0
             super.renderComponent(writer, cycle);
 73  
         }
 74  
         finally
 75  
         {
 76  0
             _exception = null;
 77  0
             _evenOdd = null;
 78  0
         }
 79  0
     }
 80  
 
 81  
     public boolean isLast()
 82  
     {
 83  0
         return getIndex() == (getCount() - 1);
 84  
     }
 85  
 }