Coverage Report - org.trails.link.AbstractTypeNavigationLink
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractTypeNavigationLink
0% 
0% 
0
 
 1  
 /*
 2  
  * Created on Jan 30, 2005
 3  
  *
 4  
  * Copyright 2004 Chris Nelson
 5  
  * 
 6  
  * Licensed under the Apache License, Version 2.0 (the "License"); 
 7  
  * you may not use this file except in compliance with the License. 
 8  
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
 9  
  * Unless required by applicable law or agreed to in writing, 
 10  
  * software 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 limitations under the License.
 13  
  */
 14  
 package org.trails.link;
 15  
 
 16  
 import org.apache.tapestry.IMarkupWriter;
 17  
 import org.apache.tapestry.IRequestCycle;
 18  
 import org.apache.tapestry.annotations.Component;
 19  
 import org.apache.tapestry.annotations.ComponentClass;
 20  
 import org.apache.tapestry.annotations.InjectObject;
 21  
 import org.apache.tapestry.annotations.Parameter;
 22  
 import org.trails.component.InsertI18N;
 23  
 import org.trails.descriptor.DescriptorService;
 24  
 import org.trails.descriptor.IClassDescriptor;
 25  
 
 26  
 /**
 27  
  * Common functionality for ListAllLink, NewLink, SearchLink
 28  
  */
 29  
 @ComponentClass
 30  0
 public abstract class AbstractTypeNavigationLink extends TrailsLink
 31  
 {
 32  
         @InjectObject("spring:descriptorService")
 33  
         public abstract DescriptorService getDescriptorService();
 34  
 
 35  
         /**
 36  
          * @return Class object that this link targets.
 37  
          */
 38  
         @Parameter(required = true)
 39  
         public abstract Class getType();
 40  
 
 41  
         /**
 42  
          * @return the class descriptor for the class that this link targets
 43  
          */
 44  
         public IClassDescriptor getClassDescriptor()
 45  
         {
 46  0
                 return getDescriptorService().getClassDescriptor(getType());
 47  
         }
 48  
 
 49  
         @Parameter(required = true)
 50  
         public abstract String getBundleKey();
 51  
 
 52  
         @Parameter(required = true)
 53  
         public abstract String getDefaultMessage();
 54  
 
 55  
         @Parameter(required = true)
 56  
         public abstract Object getParams();
 57  
 
 58  
         @Component(bindings = {"bundleKey=ognl:bundleKey", "defaultMessage=ognl:defaultMessage", "params=ognl:params"})
 59  
         public abstract InsertI18N getInsertI18N();
 60  
 
 61  
         public void renderBody(IMarkupWriter writer, IRequestCycle cycle)
 62  
         {
 63  0
                 if (getBodyCount() > 0)
 64  
                 {
 65  0
                         super.renderBody(writer, cycle);
 66  
                 } else
 67  
                 {
 68  0
                         getInsertI18N().render(writer, cycle);
 69  
                 }
 70  0
         }
 71  
 }