Coverage Report - org.apache.tapestry5.services.BeanBlockSource
 
Classes in this File Line Coverage Branch Coverage Complexity
BeanBlockSource
N/A
N/A
0
 
 1  
 // Copyright 2007, 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.services;
 16  
 
 17  
 import org.apache.tapestry5.Block;
 18  
 import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
 19  
 
 20  
 /**
 21  
  * A source of {@link Block}s used to display the properties of a bean (used by the {@link
 22  
  * org.apache.tapestry5.corelib.components.Grid} component), or to edit the properties of a bean (used by the {@link
 23  
  * org.apache.tapestry5.corelib.components.BeanEditForm} component). Contributions to this service (a configuration of
 24  
  * {@link BeanBlockContribution}s) define what properties may be editted.
 25  
  * <p/>
 26  
  * Blocks are accessed in terms of a <strong>data type</strong> a string that identifies the type of data to be editted,
 27  
  * such as "string", "date", "boolean", etc.
 28  
  * <p/>
 29  
  * Tapestry contributes a number of default data types and corresponding edit and display blocks. The {@link
 30  
  * org.apache.tapestry5.services.BeanBlockOverrideSource} service allows these to be overridden.
 31  
  *
 32  
  * @see org.apache.tapestry5.services.DataTypeAnalyzer
 33  
  * @see org.apache.tapestry5.services.TapestryModule#contributeBeanBlockSource(org.apache.tapestry5.ioc.Configuration)
 34  
  */
 35  
 @UsesConfiguration(BeanBlockContribution.class)
 36  
 public interface BeanBlockSource
 37  
 {
 38  
     /**
 39  
      * Returns a block which can be used to render an editor for the given data type, in the form of a field label and
 40  
      * input field.
 41  
      *
 42  
      * @param datatype logical name for the type of data to be displayed
 43  
      * @return the Block
 44  
      * @throws RuntimeException if no appropriate block is available
 45  
      */
 46  
     Block getEditBlock(String datatype);
 47  
 
 48  
     /**
 49  
      * Returns a block which can be used to render output for the given data type.
 50  
      *
 51  
      * @param datatype logical name for the type of data to be displayed
 52  
      * @return the Block
 53  
      * @throws RuntimeException if no appropriate block is available
 54  
      */
 55  
     Block getDisplayBlock(String datatype);
 56  
 
 57  
     /**
 58  
      * Checks to see if there is a display block for the indicated data type.
 59  
      *
 60  
      * @param datatype to check for
 61  
      * @return true if a block is available
 62  
      */
 63  
     boolean hasDisplayBlock(String datatype);
 64  
 }