Coverage Report - org.trails.component.Identifier
 
Classes in this File Line Coverage Branch Coverage Complexity
Identifier
0% 
0% 
0
 
 1  
 /*
 2  
  * Copyright 2004 Chris Nelson
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 7  
  * Unless required by applicable law or agreed to in writing,
 8  
  * software distributed under the License is distributed on an "AS IS" BASIS,
 9  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 10  
  * See the License for the specific language governing permissions and limitations under the License.
 11  
  */
 12  
 package org.trails.component;
 13  
 
 14  
 import org.apache.tapestry.annotations.Bean;
 15  
 import org.apache.tapestry.annotations.ComponentClass;
 16  
 import org.apache.tapestry.annotations.Lifecycle;
 17  
 import org.apache.tapestry.annotations.Parameter;
 18  
 import org.apache.tapestry.valid.IValidator;
 19  
 import org.apache.tapestry.valid.NumberValidator;
 20  
 import org.trails.descriptor.IIdentifierDescriptor;
 21  
 import org.trails.descriptor.IPropertyDescriptor;
 22  
 import org.trails.page.ModelPage;
 23  
 
 24  
 /**
 25  
  * Displays an id property
 26  
  */
 27  
 @ComponentClass(allowBody = true, allowInformalParameters = true)
 28  0
 public abstract class Identifier extends PropertyEditor
 29  
 {
 30  
 
 31  
         @Parameter(required = true, cache = true)
 32  
         public abstract IPropertyDescriptor getDescriptor();
 33  
 
 34  
         public abstract void setDescriptor(IPropertyDescriptor Descriptor);
 35  
 
 36  
         @Parameter(required = false, defaultValue = "container.model", cache = true)
 37  
         public abstract Object getModel();
 38  
 
 39  
         public abstract void setModel(Object Model);
 40  
 
 41  
         @Parameter(required = false, defaultValue = "page.validatorTranslatorService.getValidator(descriptor)")
 42  
         public abstract IValidator getValidator();
 43  
 
 44  
         public abstract void setValidator(IValidator validator);
 45  
 
 46  
         @Bean(lifecycle = Lifecycle.PAGE)
 47  
         public abstract NumberValidator getNumberValidator();
 48  
 
 49  
         public boolean isEditable()
 50  
         {
 51  0
                 return !((IIdentifierDescriptor) getDescriptor()).isGenerated() && ((ModelPage) getPage()).isModelNew();
 52  
         }
 53  
 }