01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.tapestry.services;
16:
17: import org.apache.tapestry.Block;
18: import org.apache.tapestry.corelib.components.BeanEditForm;
19: import org.apache.tapestry.corelib.components.Grid;
20:
21: /**
22: * A source of {@link Block}s used to display the properties of a bean (used by the {@link Grid}
23: * component), or to edit the properties of a bean (used by the {@link BeanEditForm} component).
24: * Contributions to this service define what properties may be editted.
25: *
26: * @see DataTypeAnalyzer
27: */
28: public interface BeanBlockSource {
29: /**
30: * Returns a block which can be used to present an editor for the given data type, in the form
31: * of a field label and input field.
32: *
33: * @param datatype
34: * logical name for the type of data to be displayed
35: * @return the Block
36: * @throws RuntimeException
37: * if no appropriate block is available
38: */
39: Block getEditBlock(String datatype);
40:
41: /**
42: * Returns a block which can be used to present an output for the given data type.
43: *
44: * @param datatype
45: * logical name for the type of data to be displayed
46: * @return the Block
47: * @throws RuntimeException
48: * if no appropriate block is available
49: */
50: Block getDisplayBlock(String datatype);
51:
52: /**
53: * Checks to see if there is a display block for the indicated data type.
54: *
55: * @param datatype
56: * to check for
57: * @return true if a block is available
58: */
59: boolean hasDisplayBlock(String datatype);
60: }
|