View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.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/ecl2.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.krad.uif.container;
17  
18  import org.kuali.rice.krad.uif.component.Component;
19  import org.kuali.rice.krad.uif.element.Header;
20  import org.kuali.rice.krad.uif.element.Message;
21  import org.kuali.rice.krad.uif.element.ValidationMessages;
22  import org.kuali.rice.krad.uif.layout.LayoutManager;
23  import org.kuali.rice.krad.uif.widget.Helpable;
24  
25  import java.util.List;
26  import java.util.Set;
27  
28  /**
29   * Type of component that contains a collection of other components. All
30   * templates for {@code Container} components must use a
31   * {@code LayoutManager} to render the contained components.
32   *
33   * Each container has the following parts in addition to the contained components:
34   * <ul>
35   * <li>{@code HeaderField}</li>
36   * <li>Summary {@code Message}</li>
37   * <li>Help component</li>
38   * <li>Errors container</li>
39   * <li>Footer {@code Group}</li>
40   * </ul>
41   * Container implementations are free to add additional content as needed.
42   *
43   * @author Kuali Rice Team (rice.collab@kuali.org)
44   * @see org.kuali.rice.krad.uif.component.Component
45   */
46  public interface Container extends Component, Helpable {
47  
48      /**
49       * {@code List} of {@code Component} 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}.
55       * </p>
56       *
57       * @return List component instances
58       */
59      List<? extends Component> getItems();
60  
61      /**
62       * Setter for the containers list of components
63       *
64       * @param items list of components to set in container
65       */
66      void setItems(List<? extends Component> items);
67  
68      /**
69       * {@code Set} of {@code Component} classes that may be placed
70       * into the container
71       *
72       * <p>
73       * If an empty or null list is returned, it is assumed the container
74       * supports all components. The returned set will be used by dictionary
75       * validators and allows renders to make assumptions about the contained
76       * components
77       * </p>
78       *
79       * @return Set component classes
80       */
81      Set<Class<? extends Component>> getSupportedComponents();
82  
83      /**
84       * {@code LayoutManager} that should be used to layout the components
85       * in the container
86       *
87       * <p>
88       * The template associated with the layout manager will be invoked passing
89       * in the List of components from the container. This list is exported under
90       * the attribute name 'items'
91       * </p>
92       *
93       * @return LayoutManager instance
94       */
95      LayoutManager getLayoutManager();
96  
97      /**
98       * @see #getLayoutManager()
99       */
100     void setLayoutManager(LayoutManager layoutManager);
101 
102     /**
103      * {@code HeaderField} associated with the container
104      *
105      * <p>
106      * Header fields are generally rendered at the beginning of the container to
107      * indicate a grouping, although this is determined by the template
108      * associated with the container. The actual rendering configuration (style
109      * and so on) is configured within the HeaderField instance
110      * </p>
111      * <p>
112      * Header is only rendered if {@code Container#isRenderHeader} is true
113      * and getHeader() is not null
114      * </p>
115      *
116      * @return HeaderField instance or Null
117      */
118     Header getHeader();
119 
120     /**
121      * @see #getHeader()
122      */
123     void setHeader(Header header);
124 
125     /**
126      * Footer {@code Group} associated with the container
127      *
128      * <p>
129      * The footer is usually rendered at the end of the container. Often this is
130      * a place to put actions (buttons) for the container.
131      * </p>
132      * <p>
133      * Footer is only rendered if {@code Container#isRenderFooter} is true
134      * and getFooter is not null
135      * </p>
136      *
137      * @return Group footer instance or Null
138      */
139     Group getFooter();
140 
141     /**
142      * @see #getFooter()
143      */
144     void setFooter(Group footer);
145 
146     /**
147      * Text for the container that provides a summary description or
148      * instructions
149      *
150      * <p>
151      * Text is encapsulated in a {@code Message} that contains
152      * rendering configuration.
153      * </p>
154      * <p>
155      * Summary {@code Message} only rendered if this methods does not
156      * return null
157      * </p>
158      *
159      * @return Message instance or Null
160      */
161     Message getInstructionalMessage();
162 
163     /**
164      * @see #getInstructionalMessage()
165      */
166     void setInstructionalMessage(Message instructionalMessage);
167 
168     /**
169      * Field that contains the error messages for the container
170      *
171      * <p>
172      * Containers can collect the errors for the contained component and display
173      * either all the messages or counts. This {@code Field} is used to
174      * render those messages. Styling and other configuration is done through
175      * the {@code ValidationMessages}
176      * </p>
177      *
178      * @return ValidationMessages holding the container errors
179      */
180     ValidationMessages getValidationMessages();
181 
182     /**
183      * @see #getValidationMessages()
184      */
185     void setValidationMessages(ValidationMessages validationMessages);
186 
187     /**
188      * Performs sorting of the container items based on the order property.
189      *
190      * <p>
191      * Note that the items may be modified by this method to assign order priority where it has not
192      * been previously assigned.
193      * </p>
194      */
195     void sortItems();
196 
197     /**
198      * Determine if remote field holders should be processed for this container.
199      *
200      * @return True if remote field holders should be processed for this container.
201      */
202     boolean isProcessRemoteFieldHolders();
203 
204     /**
205      * Get the key of the action item to invoke upon pressing the enter key.
206      *
207      * @return String enterKeyAction
208      */
209     public String getEnterKeyAction();
210 
211     /**
212      * @see #getEnterKeyAction()
213      */
214     public void setEnterKeyAction(String enterKeyAction);
215 
216 }