Clover coverage report - Code Coverage for tapestry-contrib release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:15:40 EST
file stats: LOC: 76   Methods: 2
NCLOC: 32   Classes: 1
 
 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.ArrayList;
 18    import java.util.Collection;
 19    import java.util.List;
 20   
 21    import org.apache.hivemind.service.ClassFabUtils;
 22    import org.apache.tapestry.BaseComponent;
 23    import org.apache.tapestry.IPage;
 24    import org.apache.tapestry.event.PageBeginRenderListener;
 25    import org.apache.tapestry.event.PageEvent;
 26    import org.apache.tapestry.record.PropertyChange;
 27    import org.apache.tapestry.record.PropertyPersistenceStrategySource;
 28   
 29    /**
 30    * Component of the {@link Inspector}page used to display the persisent properties of the page.
 31    *
 32    * @author Howard Lewis Ship
 33    */
 34   
 35    public abstract class ShowProperties extends BaseComponent implements PageBeginRenderListener
 36    {
 37   
 38    public abstract void setProperties(List properties);
 39   
 40    public abstract PropertyChange getChange();
 41   
 42    /** Injected */
 43   
 44    public abstract PropertyPersistenceStrategySource getPropertySource();
 45   
 46  0 public void pageBeginRender(PageEvent event)
 47    {
 48  0 Inspector inspector = (Inspector) getPage();
 49   
 50  0 IPage inspectedPage = inspector.getInspectedPage();
 51   
 52  0 String pageName = inspectedPage.getPageName();
 53   
 54  0 PropertyPersistenceStrategySource source = getPropertySource();
 55   
 56  0 Collection properties = source.getAllStoredChanges(pageName);
 57   
 58    // TODO: sorting
 59   
 60  0 setProperties(new ArrayList(properties));
 61    }
 62   
 63    /**
 64    * Returns the name of the value's class, if the value is non-null.
 65    */
 66   
 67  0 public String getValueClassName()
 68    {
 69  0 Object value = getChange().getNewValue();
 70   
 71  0 if (value == null)
 72  0 return "<null>";
 73   
 74  0 return ClassFabUtils.getJavaClassName(value.getClass());
 75    }
 76    }