001// Copyright 2008 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.services;
016
017import org.apache.tapestry5.Block;
018import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
019
020/**
021 * Used to override the default {@link org.apache.tapestry5.services.BeanBlockSource} for a particular data type.  The
022 * service accepts the same configuration of {@link org.apache.tapestry5.services.BeanBlockContribution}s as the main
023 * service.
024 */
025@UsesConfiguration(BeanBlockContribution.class)
026public interface BeanBlockOverrideSource
027{
028    /**
029     * Returns a block which can be used to render an editor for the given data type, in the form of a field label and
030     * input field.
031     *
032     * @param datatype logical name for the type of data to be displayed
033     * @return the Block
034     * @throws null if no override is available
035     */
036    Block getEditBlock(String datatype);
037
038    /**
039     * Returns a block which can be used to render output for the given data type.
040     *
041     * @param datatype logical name for the type of data to be displayed
042     * @return the Block
043     * @throws null if no override is available
044     */
045    Block getDisplayBlock(String datatype);
046
047    /**
048     * Checks to see if there is a display block for the indicated data type.
049     *
050     * @param datatype to check for
051     * @return true if an override display block is available
052     */
053    boolean hasDisplayBlock(String datatype);
054}