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: 90   Methods: 6
NCLOC: 51   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
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   
 
 28   
 public abstract class ViewTabs extends BaseComponent
 29   
 {
 30   
     private static View[] _views =
 31   
         {
 32   
             View.SPECIFICATION,
 33   
             View.TEMPLATE,
 34   
             View.PROPERTIES,
 35   
             View.ENGINE };
 36   
 
 37  0
      public View[] getViews()
 38   
     {
 39  0
         return _views;
 40   
     }
 41   
 
 42   
     public abstract void setView(View value);
 43   
 
 44   
     public abstract View getView();
 45   
 
 46  0
     private IAsset getImageForView(boolean focus)
 47   
     {
 48  0
         Inspector inspector = (Inspector) getPage();
 49  0
         View view = getView();
 50   
         
 51  0
         boolean selected = (view == inspector.getView());
 52   
 
 53  0
         StringBuffer buffer = new StringBuffer(view.getName());
 54   
 
 55  0
         if (selected)
 56  0
             buffer.append("_selected");
 57   
 
 58  0
         if (focus)
 59  0
             buffer.append("_focus");
 60   
 
 61  0
         String key = buffer.toString();
 62   
 
 63  0
         return (IAsset) getAssets().get(key);
 64   
     }
 65   
 
 66  0
     public IAsset getViewImage()
 67   
     {
 68  0
         return getImageForView(false);
 69   
     }
 70   
 
 71  0
     public IAsset getFocusImage()
 72   
     {
 73  0
         return getImageForView(true);
 74   
     }
 75   
 
 76  0
     public IAsset getBannerImage()
 77   
     {
 78  0
          Inspector inspector = (Inspector) getPage();
 79  0
         View selectedView = inspector.getView();
 80  0
         String key = selectedView.getName() + "_banner";
 81   
 
 82  0
         return (IAsset) getAssets().get(key);
 83   
     }
 84   
 
 85  0
     public void selectTab(IRequestCycle cycle)
 86   
     {
 87  0
         Inspector inspector = (Inspector) getPage();
 88  0
         inspector.setView(getView());
 89   
     }
 90   
 }