| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BeanBlockContribution |
|
| 0.0;0 |
| 1 | // Copyright 2007 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.corelib.components.Label; | |
| 18 | import static org.apache.tapestry5.ioc.internal.util.Defense.notBlank; | |
| 19 | ||
| 20 | /** | |
| 21 | * A contribution to the {@link BeanBlockSource} service, defining a page name and block id (within the page) that can | |
| 22 | * edit or display a particular type of property. | |
| 23 | */ | |
| 24 | public final class BeanBlockContribution | |
| 25 | { | |
| 26 | private final String dataType; | |
| 27 | ||
| 28 | private final String pageName; | |
| 29 | ||
| 30 | private final String blockId; | |
| 31 | ||
| 32 | private final boolean edit; | |
| 33 | ||
| 34 | public BeanBlockContribution(String dataType, String pageName, String blockId, boolean edit) | |
| 35 | 72 | { |
| 36 | 72 | notBlank(dataType, "datatype"); |
| 37 | 72 | notBlank(pageName, "pageName"); |
| 38 | 72 | notBlank(blockId, "blockId"); |
| 39 | ||
| 40 | 72 | this.dataType = dataType; |
| 41 | 72 | this.pageName = pageName; |
| 42 | 72 | this.blockId = blockId; |
| 43 | 72 | this.edit = edit; |
| 44 | 72 | } |
| 45 | ||
| 46 | /** | |
| 47 | * The type of data for which the indicated block will provide an editor or displayer for. | |
| 48 | */ | |
| 49 | public String getDataType() | |
| 50 | { | |
| 51 | 72 | return dataType; |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 | * The id of the block within the page. | |
| 56 | */ | |
| 57 | public String getBlockId() | |
| 58 | { | |
| 59 | 576 | return blockId; |
| 60 | } | |
| 61 | ||
| 62 | /** | |
| 63 | * If true, then the block provides an editor for the property, consisting of a {@link Label} and some field | |
| 64 | * component (or set of field components). If false, the block is used to display the value of the property, usually | |
| 65 | * by applying some kind of formatting to the raw value. | |
| 66 | */ | |
| 67 | public boolean isEdit() | |
| 68 | { | |
| 69 | 72 | return edit; |
| 70 | } | |
| 71 | ||
| 72 | /** | |
| 73 | * The logical name of the page containing the block. | |
| 74 | */ | |
| 75 | public String getPageName() | |
| 76 | { | |
| 77 | 576 | return pageName; |
| 78 | } | |
| 79 | ||
| 80 | } |