Coverage Report - org.apache.tapestry5.internal.renderers.ComponentResourcesRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentResourcesRenderer
100%
11/11
100%
2/2
0
 
 1  
 // Copyright 2008 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.tapestry5.internal.renderers;
 16  
 
 17  
 import org.apache.tapestry5.ComponentResources;
 18  
 import org.apache.tapestry5.MarkupWriter;
 19  
 import org.apache.tapestry5.ioc.Location;
 20  
 import org.apache.tapestry5.ioc.annotations.Primary;
 21  
 import org.apache.tapestry5.services.ObjectRenderer;
 22  
 
 23  
 /**
 24  
  * Renders {@link ComponentResources} instance, showing the complete id and the class name and the location (if a
 25  
  * location is available, it won't be for pages).
 26  
  */
 27  28
 public class ComponentResourcesRenderer implements ObjectRenderer<ComponentResources>
 28  
 {
 29  
     private final ObjectRenderer masterRenderer;
 30  
 
 31  
     public ComponentResourcesRenderer(@Primary ObjectRenderer masterRenderer)
 32  2
     {
 33  2
         this.masterRenderer = masterRenderer;
 34  2
     }
 35  
 
 36  
     public void render(ComponentResources object, MarkupWriter writer)
 37  
     {
 38  28
         writer.writef("%s (class %s)", object.getCompleteId(), object.getComponentModel().getComponentClassName());
 39  
 
 40  28
         Location location = object.getLocation();
 41  
 
 42  28
         if (location != null)
 43  
         {
 44  18
             writer.element("br");
 45  18
             writer.end();
 46  
 
 47  18
             masterRenderer.render(location, writer);
 48  
         }
 49  28
     }
 50  
 }