Clover coverage report - Code Coverage for tapestry-contrib release 4.0-beta-9
Coverage timestamp: Sat Oct 1 2005 08:42:40 EDT
file stats: LOC: 86   Methods: 6
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ViewTabs.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 org.apache.tapestry.BaseComponent;
 18    import org.apache.tapestry.IAsset;
 19    import org.apache.tapestry.IRequestCycle;
 20   
 21    /**
 22    * Component of the {@link Inspector} page used to select the view.
 23    *
 24    * @author Howard Lewis Ship
 25    */
 26   
 27    public abstract class ViewTabs extends BaseComponent
 28    {
 29    private static String[] _views =
 30    { View.SPECIFICATION, View.TEMPLATE, View.PROPERTIES, View.ENGINE };
 31   
 32  0 public String[] getViews()
 33    {
 34  0 return _views;
 35    }
 36   
 37    public abstract void setView(String value);
 38   
 39    public abstract String getView();
 40   
 41  0 private IAsset getImageForView(boolean focus)
 42    {
 43  0 Inspector inspector = (Inspector) getPage();
 44   
 45  0 String view = getView();
 46   
 47  0 boolean selected = view.equals(inspector.getView());
 48   
 49  0 StringBuffer buffer = new StringBuffer(view);
 50   
 51  0 if (selected)
 52  0 buffer.append("_selected");
 53   
 54  0 if (focus)
 55  0 buffer.append("_focus");
 56   
 57  0 String key = buffer.toString();
 58   
 59  0 return (IAsset) getAssets().get(key);
 60    }
 61   
 62  0 public IAsset getViewImage()
 63    {
 64  0 return getImageForView(false);
 65    }
 66   
 67  0 public IAsset getFocusImage()
 68    {
 69  0 return getImageForView(true);
 70    }
 71   
 72  0 public IAsset getBannerImage()
 73    {
 74  0 Inspector inspector = (Inspector) getPage();
 75  0 String selectedView = inspector.getView();
 76  0 String key = selectedView + "_banner";
 77   
 78  0 return (IAsset) getAssets().get(key);
 79    }
 80   
 81  0 public void selectTab(IRequestCycle cycle)
 82    {
 83  0 Inspector inspector = (Inspector) getPage();
 84  0 inspector.setView(getView());
 85    }
 86    }