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