View Javadoc

1   /**
2    * Copyright 2005-2013 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.layout;
17  
18  import org.kuali.rice.krad.uif.container.CollectionGroup;
19  import org.kuali.rice.krad.uif.element.Action;
20  import org.kuali.rice.krad.uif.field.FieldGroup;
21  import org.kuali.rice.krad.uif.view.View;
22  import org.kuali.rice.krad.uif.field.Field;
23  
24  import java.util.List;
25  
26  /**
27   * Layout manager implementations that work with a collection (such as a table
28   * layout) should implement this interface for building the collection
29   * <code>Component</code> instances
30   *
31   * <p>
32   * Unlike other <code>Group</code> instances, <code>CollectionGroup</code>
33   * instances need to generate new instances of the configured components for
34   * each line of the collection. The <code>Field</code> instances for each line
35   * are wrapped differently depending on what <code>LayoutManager</code> is being
36   * applied. Therefore as the collection lines are being built (during the
37   * applyModel phase) this method will be invoked on the manager so that it may
38   * setup the line as needed.
39   * </p>
40   *
41   * @author Kuali Rice Team (rice.collab@kuali.org)
42   * @see org.kuali.rice.krad.uif.container.CollectionGroupBuilder
43   */
44  public interface CollectionLayoutManager extends LayoutManager {
45  
46  	/**
47  	 * Call to the layout manager to build the components necessary for the
48  	 * given collection line
49  	 *
50  	 * <p>
51  	 * As the collection is being iterated over by the
52  	 * <code>CollectionGroupBuilder</code> this method is invoked for each line.
53  	 * The builder will create copies of the configured fields and actions for
54  	 * the line and pass into the layout manager so they can be assembled
55  	 * </p>
56  	 *
57  	 * @param view
58  	 *            - view instance the collection belongs to
59  	 * @param model
60  	 *            - object containing the data
61  	 * @param collectionGroup
62  	 *            - collection group the layout manager applies to
63  	 * @param lineFields
64  	 *            - the field instances for the collection line which were
65  	 *            copied from the collection groups items, id and binding
66  	 *            already updated
67  	 * @param subCollectionFields
68  	 *            - group field instances for each sub collection of the current
69  	 *            line
70  	 * @param bindingPath
71  	 *            - binding path for the groups items (if DataBinding)
72  	 * @param actions
73  	 *            - list of action instances for the collection line, with id
74  	 *            and binding updated
75  	 * @param idSuffix
76  	 *            - suffix to use for any generated items
77  	 * @param currentLine
78  	 *            - object instance for the current line, or null if add line
79  	 * @param lineIndex
80  	 *            - index of the collection line being iterated over, or -1 if
81  	 *            the add line
82  	 */
83  	public void buildLine(View view, Object model, CollectionGroup collectionGroup, List<Field> lineFields,
84  			List<FieldGroup> subCollectionFields, String bindingPath, List<Action> actions, String idSuffix,
85  			Object currentLine, int lineIndex);
86  
87  	/**
88  	 * Field group instance that is used as a prototype for creating the
89  	 * sub-collection field groups. For each sub-collection a copy of the
90  	 * prototype is made and the list will be passed to the layout manager
91  	 * buildLine method
92  	 *
93  	 * @return GroupField instance to use as prototype
94  	 */
95  	public FieldGroup getSubCollectionFieldGroupPrototype();
96  }