| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Container |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 1.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 | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl1.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.kns.uif.container; | |
| 17 | ||
| 18 | import java.util.List; | |
| 19 | import java.util.Set; | |
| 20 | ||
| 21 | import org.kuali.rice.kns.uif.core.Component; | |
| 22 | import org.kuali.rice.kns.uif.field.ErrorsField; | |
| 23 | import org.kuali.rice.kns.uif.field.HeaderField; | |
| 24 | import org.kuali.rice.kns.uif.field.MessageField; | |
| 25 | import org.kuali.rice.kns.uif.layout.LayoutManager; | |
| 26 | import org.kuali.rice.kns.uif.widget.Help; | |
| 27 | ||
| 28 | /** | |
| 29 | * Type of component that contains a collection of other components. All | |
| 30 | * templates for <code> Container</code> components must use a | |
| 31 | * <code>LayoutManager</code> to render the contained components. Each container | |
| 32 | * has the following parts in addition to the contained components: | |
| 33 | * <ul> | |
| 34 | * <li><code>HeaderField</code></li> | |
| 35 | * <li>Summary <code>MessageField</code></li> | |
| 36 | * <li>Help component</li> | |
| 37 | * <li>Errors container</li> | |
| 38 | * <li>Footer <code>Group</code></li> | |
| 39 | * </ul> | |
| 40 | * Container implementations are free to add additional content as needed. | |
| 41 | * | |
| 42 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 43 | * | |
| 44 | * @see org.kuali.rice.kns.uif.core.Component | |
| 45 | */ | |
| 46 | public interface Container extends Component { | |
| 47 | ||
| 48 | /** | |
| 49 | * <code>List</code> of <code>Component</code> instances that are held by | |
| 50 | * the container | |
| 51 | * | |
| 52 | * <p> | |
| 53 | * Contained components are rendered within the section template by calling | |
| 54 | * the associated <code>LayoutManager</code> | |
| 55 | * </p> | |
| 56 | * | |
| 57 | * @return List component instances | |
| 58 | */ | |
| 59 | public List<? extends Component> getItems(); | |
| 60 | ||
| 61 | /** | |
| 62 | * <code>Set</code> of <code>Component</code> classes that may be placed | |
| 63 | * into the container | |
| 64 | * | |
| 65 | * <p> | |
| 66 | * If an empty or null list is returned, it is assumed the container | |
| 67 | * supports all components. The returned set will be used by dictionary | |
| 68 | * validators and allows renders to make assumptions about the contained | |
| 69 | * components | |
| 70 | * </p> | |
| 71 | * | |
| 72 | * @return Set component classes | |
| 73 | */ | |
| 74 | public Set<Class<? extends Component>> getSupportedComponents(); | |
| 75 | ||
| 76 | /** | |
| 77 | * <code>LayoutManager</code> that should be used to layout the components | |
| 78 | * in the container | |
| 79 | * | |
| 80 | * <p> | |
| 81 | * The template associated with the layout manager will be invoked passing | |
| 82 | * in the List of components from the container. This list is exported under | |
| 83 | * the attribute name 'items' | |
| 84 | * </p> | |
| 85 | * | |
| 86 | * @return LayoutManager instance | |
| 87 | */ | |
| 88 | public LayoutManager getLayoutManager(); | |
| 89 | ||
| 90 | /** | |
| 91 | * Setter for the containers layout manager | |
| 92 | * | |
| 93 | * @param layoutManager | |
| 94 | */ | |
| 95 | public void setLayoutManager(LayoutManager layoutManager); | |
| 96 | ||
| 97 | /** | |
| 98 | * <code>HeaderField</code> associated with the container | |
| 99 | * | |
| 100 | * <p> | |
| 101 | * Header fields are generally rendered at the beginning of the container to | |
| 102 | * indicate a grouping, although this is determined by the template | |
| 103 | * associated with the container. The actual rendering configuration (style | |
| 104 | * and so on) is configured within the HeaderField instance | |
| 105 | * </p> | |
| 106 | * <p> | |
| 107 | * Header is only rendered if <code>Container#isRenderHeader</code> is true | |
| 108 | * and getHeader() is not null | |
| 109 | * </p> | |
| 110 | * | |
| 111 | * @return HeaderField instance or Null | |
| 112 | */ | |
| 113 | public HeaderField getHeader(); | |
| 114 | ||
| 115 | /** | |
| 116 | * Setter for the containers header field | |
| 117 | * | |
| 118 | * @param header | |
| 119 | */ | |
| 120 | public void setHeader(HeaderField header); | |
| 121 | ||
| 122 | /** | |
| 123 | * Footer <code>Group</code> associated with the container | |
| 124 | * | |
| 125 | * <p> | |
| 126 | * The footer is usually rendered at the end of the container. Often this is | |
| 127 | * a place to put actions (buttons) for the container. | |
| 128 | * </p> | |
| 129 | * <p> | |
| 130 | * Footer is only rendered if <code>Container#isRenderFooter</code> is true | |
| 131 | * and getFooter is not null | |
| 132 | * </p> | |
| 133 | * | |
| 134 | * @return Group footer instance or Null | |
| 135 | */ | |
| 136 | public Group getFooter(); | |
| 137 | ||
| 138 | /** | |
| 139 | * Setter for the containers footer | |
| 140 | * | |
| 141 | * @param footer | |
| 142 | */ | |
| 143 | public void setFooter(Group footer); | |
| 144 | ||
| 145 | /** | |
| 146 | * Text for the container that provides a summary description or | |
| 147 | * instructions | |
| 148 | * | |
| 149 | * <p> | |
| 150 | * Text is encapsulated in a <code>MessageField</code> that contains | |
| 151 | * rendering configuration. | |
| 152 | * </p> | |
| 153 | * <p> | |
| 154 | * Summary <code>MessageField</code> only rendered if this methods does not | |
| 155 | * return null | |
| 156 | * </p> | |
| 157 | * | |
| 158 | * @return MessageField instance or Null | |
| 159 | */ | |
| 160 | public MessageField getSummaryMessageField(); | |
| 161 | ||
| 162 | /** | |
| 163 | * Setter for the containers summary message field | |
| 164 | * | |
| 165 | * @param summaryMessageField | |
| 166 | */ | |
| 167 | public void setSummaryMessageField(MessageField summaryMessageField); | |
| 168 | ||
| 169 | /** | |
| 170 | * Field that contains the error messages for the container | |
| 171 | * | |
| 172 | * <p> | |
| 173 | * Containers can collect the errors for the contained component and display | |
| 174 | * either all the messages or counts. This <code>Field</code> is used to | |
| 175 | * render those messages. Styling and other configuration is done through | |
| 176 | * the <code>ErrorsField</code> | |
| 177 | * </p> | |
| 178 | * | |
| 179 | * @return ErrorsField holding the container errors | |
| 180 | */ | |
| 181 | public ErrorsField getErrorsField(); | |
| 182 | ||
| 183 | /** | |
| 184 | * Setter for the containers errors field | |
| 185 | * | |
| 186 | * @param errorsField | |
| 187 | */ | |
| 188 | public void setErrorsField(ErrorsField errorsField); | |
| 189 | ||
| 190 | /** | |
| 191 | * Help configuration object for the container | |
| 192 | * | |
| 193 | * <p> | |
| 194 | * External help information can be configured for the container. The | |
| 195 | * <code>Help</code> object can the configuration for rendering a link to | |
| 196 | * that help information. | |
| 197 | * </p> | |
| 198 | * | |
| 199 | * @return Help for container | |
| 200 | */ | |
| 201 | public Help getHelp(); | |
| 202 | ||
| 203 | /** | |
| 204 | * Setter for the containers help content | |
| 205 | * | |
| 206 | * @param help | |
| 207 | */ | |
| 208 | public void setHelp(Help help); | |
| 209 | ||
| 210 | /** | |
| 211 | * This property is true if the container is used to display a group of fields that is visually a single | |
| 212 | * field - this has an effect on where errors will show up for these fields. | |
| 213 | * @return the fieldContainer | |
| 214 | */ | |
| 215 | public boolean isFieldContainer(); | |
| 216 | ||
| 217 | /** | |
| 218 | * @param fieldContainer the fieldContainer to set | |
| 219 | */ | |
| 220 | public void setFieldContainer(boolean fieldContainer); | |
| 221 | ||
| 222 | } |