Clover coverage report - Code Coverage for tapestry-contrib release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:12:41 EDT
file stats: LOC: 129   Methods: 7
NCLOC: 58   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. 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
ShowProperties.java 0% 0% 0% 0%
coverage
 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.contrib.inspector;
 16   
 
 17   
 import java.util.Collections;
 18   
 import java.util.List;
 19   
 
 20   
 import org.apache.hivemind.service.ClassFabUtils;
 21   
 import org.apache.tapestry.BaseComponent;
 22   
 import org.apache.tapestry.IPage;
 23   
 import org.apache.tapestry.engine.IPageRecorder;
 24   
 import org.apache.tapestry.event.PageEvent;
 25   
 import org.apache.tapestry.event.PageRenderListener;
 26   
 import org.apache.tapestry.record.PropertyChange;
 27   
 
 28   
 /**
 29   
  * Component of the {@link Inspector}page used to display the persisent properties of the page.
 30   
  * 
 31   
  * @author Howard Lewis Ship
 32   
  */
 33   
 
 34   
 public abstract class ShowProperties extends BaseComponent implements PageRenderListener
 35   
 {
 36   
     private List _properties;
 37   
 
 38   
     private PropertyChange _change;
 39   
 
 40   
     private IPage _inspectedPage;
 41   
 
 42   
     /**
 43   
      * Does nothing.
 44   
      * 
 45   
      * @since 1.0.5
 46   
      */
 47   
 
 48  0
     public void pageBeginRender(PageEvent event)
 49   
     {
 50   
     }
 51   
 
 52   
     /**
 53   
      * @since 1.0.5
 54   
      */
 55   
 
 56  0
     public void pageEndRender(PageEvent event)
 57   
     {
 58  0
         _properties = null;
 59  0
         _change = null;
 60  0
         _inspectedPage = null;
 61   
     }
 62   
 
 63  0
     private void buildProperties()
 64   
     {
 65  0
         Inspector inspector = (Inspector) getPage();
 66   
 
 67  0
         _inspectedPage = inspector.getInspectedPage();
 68   
 
 69   
         //  IEngine engine = getPage().getEngine();
 70  0
         IPageRecorder recorder = null;
 71   
 
 72   
         // TODO: This is going to blow up with UnsupportedOperationException
 73   
         // engine.getPageRecorder(_inspectedPage.getPageName(), inspector.getRequestCycle());
 74   
 
 75   
         // No page recorder? No properties.
 76   
 
 77  0
         if (recorder == null)
 78   
         {
 79  0
             _properties = Collections.EMPTY_LIST;
 80  0
             return;
 81   
         }
 82   
 
 83  0
         _properties = Collections.EMPTY_LIST;
 84   
 
 85   
         // The getChanges() method was removed
 86   
         // from IPageRecorder in release 4.0
 87   
         // new ArrayList(recorder.getChanges());
 88   
     }
 89   
 
 90   
     /**
 91   
      * Returns a {@link List}of {@link PropertyChange}objects.
 92   
      * <p>
 93   
      * Sort order is not defined.
 94   
      */
 95   
 
 96  0
     public List getProperties()
 97   
     {
 98  0
         if (_properties == null)
 99  0
             buildProperties();
 100   
 
 101  0
         return _properties;
 102   
     }
 103   
 
 104  0
     public void setChange(PropertyChange value)
 105   
     {
 106  0
         _change = value;
 107   
     }
 108   
 
 109  0
     public PropertyChange getChange()
 110   
     {
 111  0
         return _change;
 112   
     }
 113   
 
 114   
     /**
 115   
      * Returns the name of the value's class, if the value is non-null.
 116   
      */
 117   
 
 118  0
     public String getValueClassName()
 119   
     {
 120  0
         Object value;
 121   
 
 122  0
         value = _change.getNewValue();
 123   
 
 124  0
         if (value == null)
 125  0
             return "<null>";
 126   
 
 127  0
         return ClassFabUtils.getJavaClassName(value.getClass());
 128   
     }
 129   
 }