View Javadoc

1   /**
2    * Copyright 2005-2011 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.apache.commons.lang.StringUtils;
19  import org.kuali.rice.krad.uif.UifConstants;
20  import org.kuali.rice.krad.uif.component.DataBinding;
21  import org.kuali.rice.krad.uif.container.CollectionGroup;
22  import org.kuali.rice.krad.uif.container.Container;
23  import org.kuali.rice.krad.uif.container.Group;
24  import org.kuali.rice.krad.uif.field.DataField;
25  import org.kuali.rice.krad.uif.field.FieldGroup;
26  import org.kuali.rice.krad.uif.field.InputField;
27  import org.kuali.rice.krad.uif.view.View;
28  import org.kuali.rice.krad.uif.component.Component;
29  import org.kuali.rice.krad.uif.field.ActionField;
30  import org.kuali.rice.krad.uif.field.Field;
31  import org.kuali.rice.krad.uif.field.LabelField;
32  import org.kuali.rice.krad.uif.field.MessageField;
33  import org.kuali.rice.krad.uif.util.ComponentFactory;
34  import org.kuali.rice.krad.uif.util.ComponentUtils;
35  import org.kuali.rice.krad.uif.widget.RichTable;
36  import org.kuali.rice.krad.web.form.UifFormBase;
37  
38  import java.util.ArrayList;
39  import java.util.List;
40  
41  /**
42   * Layout manager that works with <code>CollectionGroup</code> components and
43   * renders the collection as a Table
44   * 
45   * <p>
46   * Based on the fields defined, the <code>TableLayoutManager</code> will
47   * dynamically create instances of the fields for each collection row. In
48   * addition, the manager can create standard fields like the action and sequence
49   * fields for each row. The manager supports options inherited from the
50   * <code>GridLayoutManager</code> such as rowSpan, colSpan, and cell width
51   * settings.
52   * </p>
53   * 
54   * @author Kuali Rice Team (rice.collab@kuali.org)
55   */
56  public class TableLayoutManager extends GridLayoutManager implements CollectionLayoutManager {
57  	private static final long serialVersionUID = 3622267585541524208L;
58  
59  	private boolean useShortLabels;
60  	private boolean repeatHeader;
61  	private LabelField headerFieldPrototype;
62  
63  	private boolean renderSequenceField;
64  	private boolean generateAutoSequence;
65  	private Field sequenceFieldPrototype;
66  
67  	private FieldGroup actionFieldPrototype;
68  	private FieldGroup subCollectionFieldGroupPrototype;
69      private Field selectFieldPrototype;
70  
71      private boolean separateAddLine;
72      private Group addLineGroup;
73  
74  	// internal counter for the data columns (not including sequence, action)
75  	private int numberOfDataColumns;
76  
77  	private List<LabelField> headerFields;
78  	private List<Field> dataFields;
79  
80  	private RichTable richTable;
81  	private boolean headerAdded = false;
82  
83  	public TableLayoutManager() {
84  		useShortLabels = true;
85  		repeatHeader = false;
86  		renderSequenceField = true;
87  		generateAutoSequence = false;
88          separateAddLine = false;
89  
90  		headerFields = new ArrayList<LabelField>();
91  		dataFields = new ArrayList<Field>();
92  	}
93  	
94  	/**
95  	 * The following actions are performed:
96  	 * 
97  	 * <ul>
98  	 * <li>Sets sequence field prototype if auto sequence is true</li>
99  	 * <li>Initializes the prototypes</li>
100 	 * </ul>
101 	 * 
102 	 * @see org.kuali.rice.krad.uif.layout.BoxLayoutManager#performInitialization(org.kuali.rice.krad.uif.view.View,
103 	 *      java.lang.Object, org.kuali.rice.krad.uif.container.Container)
104 	 */
105 	@Override
106 	public void performInitialization(View view, Object model, Container container) {
107 		super.performInitialization(view, model, container);
108 		
109         if (generateAutoSequence && !(sequenceFieldPrototype instanceof MessageField)) {
110             sequenceFieldPrototype = ComponentFactory.getMessageField();
111             view.assignComponentIds(sequenceFieldPrototype);
112         }
113 
114 		view.getViewHelperService().performComponentInitialization(view, model, headerFieldPrototype);
115 		view.getViewHelperService().performComponentInitialization(view, model, sequenceFieldPrototype);
116 		view.getViewHelperService().performComponentInitialization(view, model, actionFieldPrototype);
117 		view.getViewHelperService().performComponentInitialization(view, model, subCollectionFieldGroupPrototype);
118         view.getViewHelperService().performComponentInitialization(view, model, selectFieldPrototype);
119 	}
120 
121 	/**
122 	 * Sets up the final column count for rendering based on whether the
123 	 * sequence and action fields have been generated
124 	 * 
125 	 * @see org.kuali.rice.krad.uif.layout.LayoutManagerBase#performFinalize(org.kuali.rice.krad.uif.view.View,
126 	 *      java.lang.Object, org.kuali.rice.krad.uif.container.Container)
127 	 */
128 	@Override
129 	public void performFinalize(View view, Object model, Container container) {
130 		super.performFinalize(view, model, container);
131 
132         UifFormBase formBase = (UifFormBase) model;
133 
134 		CollectionGroup collectionGroup = (CollectionGroup) container;
135 
136 		int totalColumns = getNumberOfDataColumns();
137 		if (renderSequenceField) {
138 			totalColumns++;
139 		}
140 
141         if (collectionGroup.isRenderSelectField()) {
142             totalColumns++;
143         }
144 
145 		if (collectionGroup.isRenderLineActions() && !collectionGroup.isReadOnly()) {
146 			totalColumns++;
147 		}
148 
149         if (collectionGroup.isRenderAddLine()){
150             if(StringUtils.isBlank(this.getFirstLineStyle()) && !isSeparateAddLine()){
151                 this.setFirstLineStyle("kr-addLine");
152             }
153         }
154 
155         // if add line event, add highlighting for added row
156         if (UifConstants.ActionEvents.ADD_LINE.equals(formBase.getActionEvent())) {
157             String highlightScript =
158                     "jq(\"#" + container.getId() + "_div > tr:first\").effect(\"highlight\",{}, 6000);";
159             String onReadyScript = collectionGroup.getOnDocumentReadyScript();
160             if (StringUtils.isNotBlank(onReadyScript)) {
161                 highlightScript = onReadyScript + highlightScript;
162             }
163             collectionGroup.setOnDocumentReadyScript(highlightScript);
164         }
165 		setNumberOfColumns(totalColumns);
166 	}
167 
168 	/**
169 	 * Assembles the field instances for the collection line. The given sequence
170 	 * field prototype is copied for the line sequence field. Likewise a copy of
171 	 * the actionFieldPrototype is made and the given actions are set as the
172 	 * items for the action field. Finally the generated items are assembled
173 	 * together into the dataFields list with the given lineFields.
174 	 * 
175 	 * @see org.kuali.rice.krad.uif.layout.CollectionLayoutManager#buildLine(org.kuali.rice.krad.uif.view.View,
176 	 *      java.lang.Object, org.kuali.rice.krad.uif.container.CollectionGroup,
177 	 *      java.util.List, java.util.List, java.lang.String, java.util.List,
178 	 *      java.lang.String, java.lang.Object, int)
179 	 */
180 	public void buildLine(View view, Object model, CollectionGroup collectionGroup, List<Field> lineFields,
181 			List<FieldGroup> subCollectionFields, String bindingPath, List<ActionField> actions, String idSuffix,
182 			Object currentLine, int lineIndex) {
183 		boolean isAddLine = lineIndex == -1;
184 
185         // if separate add line prepare the add line group
186         if (isAddLine && separateAddLine) {
187             if (StringUtils.isBlank(addLineGroup.getTitle()) && StringUtils.isBlank(
188                     addLineGroup.getHeader().getHeaderText())) {
189                addLineGroup.getHeader().setHeaderText(collectionGroup.getAddLineLabel());
190             }
191 
192             addLineGroup.setItems(lineFields);
193 
194             List<Component> footerItems = new ArrayList<Component>(actions);
195             footerItems.addAll(addLineGroup.getFooter().getItems());
196             addLineGroup.getFooter().setItems(footerItems);
197 
198             return;
199         }
200 
201         // if first line for table set number of data columns
202         if (dataFields.isEmpty()) {
203             if (isSuppressLineWrapping()) {
204                 setNumberOfDataColumns(lineFields.size());
205             } else {
206                 setNumberOfDataColumns(getNumberOfColumns());
207             }
208         }
209 
210 		// TODO: implement repeat header
211 		if (!headerAdded) {
212 			headerFields = new ArrayList<LabelField>();
213 			dataFields = new ArrayList<Field>();
214 
215 			buildTableHeaderRows(collectionGroup, lineFields);
216 			ComponentUtils.pushObjectToContext(headerFields, UifConstants.ContextVariableNames.LINE, currentLine);
217 			ComponentUtils.pushObjectToContext(headerFields, UifConstants.ContextVariableNames.INDEX, new Integer(
218 					lineIndex));
219 			headerAdded = true;
220 		}
221 
222 		// set label field rendered to true on line fields
223 		for (Field field : lineFields) {
224 			field.setLabelFieldRendered(true);
225 
226 			// don't display summary message
227 			// TODO: remove once we have modifier
228 			ComponentUtils.setComponentPropertyDeep(field, "summaryMessageField.render", new Boolean(false));
229 		}
230 
231 		int rowCount = calculateNumberOfRows(lineFields);
232 		int rowSpan = rowCount + subCollectionFields.size();
233 
234 		// sequence field is always first and should span all rows for the line
235 		if (renderSequenceField) {
236 			Field sequenceField = null;
237             if (!isAddLine) {
238                 sequenceField = ComponentUtils.copy(sequenceFieldPrototype, idSuffix);
239 
240                 if (generateAutoSequence && (sequenceField instanceof MessageField)) {
241                     ((MessageField) sequenceField).setMessageText(Integer.toString(lineIndex + 1));
242                 }
243             }
244 			else {
245 				sequenceField = ComponentUtils.copy(collectionGroup.getAddLineLabelField(), idSuffix);
246 			}
247 			sequenceField.setRowSpan(rowSpan);
248 
249 			if (sequenceField instanceof DataBinding) {
250 				((DataBinding) sequenceField).getBindingInfo().setBindByNamePrefix(bindingPath);
251 			}
252 
253 			ComponentUtils.updateContextForLine(sequenceField, currentLine, lineIndex);
254 			dataFields.add(sequenceField);
255 		}
256 
257         // select field will come after sequence field (if enabled) or be first column
258         if (collectionGroup.isRenderSelectField()) {
259             Field selectField = ComponentUtils.copy(selectFieldPrototype, idSuffix);
260             CollectionLayoutUtils.prepareSelectFieldForLine(selectField, collectionGroup, bindingPath, currentLine);
261 
262             ComponentUtils.updateContextForLine(selectField, currentLine, lineIndex);
263             dataFields.add(selectField);
264         }
265 
266 		// now add the fields in the correct position
267 		int cellPosition = 0;
268 		for (Field lineField : lineFields) {
269 			dataFields.add(lineField);
270 
271 			cellPosition += lineField.getColSpan();
272 
273 			// action field should be in last column
274 			if ((cellPosition == getNumberOfDataColumns()) && collectionGroup.isRenderLineActions()
275 					&& !collectionGroup.isReadOnly()) {
276 				FieldGroup lineActionsField = ComponentUtils.copy(actionFieldPrototype, idSuffix);
277 
278 				ComponentUtils.updateContextForLine(lineActionsField, currentLine, lineIndex);
279 				lineActionsField.setRowSpan(rowSpan);
280 				lineActionsField.setItems(actions);
281 
282 				dataFields.add(lineActionsField);
283 			}
284 		}
285 
286 		// update colspan on sub-collection fields
287 		for (FieldGroup subCollectionField : subCollectionFields) {
288 			subCollectionField.setColSpan(numberOfDataColumns);
289 		}
290 
291 		// add sub-collection fields to end of data fields
292 		dataFields.addAll(subCollectionFields);
293 	}
294 
295 	/**
296 	 * Create the <code>LabelField</code> instances that will be used to render
297 	 * the table header
298 	 * 
299 	 * <p>
300 	 * For each column, a copy of headerFieldPrototype is made that determines
301 	 * the label configuration. The actual label text comes from the field for
302 	 * which the header applies to. The first column is always the sequence (if
303 	 * enabled) and the last column contains the actions. Both the sequence and
304 	 * action header fields will span all rows for the header.
305 	 * </p>
306 	 * 
307 	 * <p>
308 	 * The headerFields list will contain the final list of header fields built
309 	 * </p>
310 	 * 
311 	 * @param collectionGroup
312 	 *            - CollectionGroup container the table applies to
313 	 * @param lineFields - fields for the data columns from which the headers are pulled
314 	 */
315 	protected void buildTableHeaderRows(CollectionGroup collectionGroup, List<Field> lineFields) {
316 		// row count needed to determine the row span for the sequence and
317 		// action fields, since they should span all rows for the line
318 		int rowCount = calculateNumberOfRows(lineFields);
319 
320 		// first column is sequence label
321 		if (renderSequenceField) {
322 			sequenceFieldPrototype.setLabelFieldRendered(true);
323 			sequenceFieldPrototype.setRowSpan(rowCount);
324 			addHeaderField(sequenceFieldPrototype, 1);
325 		}
326 
327         // next is select field
328         if (collectionGroup.isRenderSelectField()) {
329             selectFieldPrototype.setLabelFieldRendered(true);
330             selectFieldPrototype.setRowSpan(rowCount);
331             addHeaderField(selectFieldPrototype, 1);
332         }
333 
334 		// pull out label fields from the container's items
335 		int cellPosition = 0;
336 		for (Field field : lineFields) {
337 		    if (!field.isRender() && StringUtils.isEmpty(field.getProgressiveRender())) {
338 		        continue;
339 		    }
340 		    
341 			cellPosition += field.getColSpan();
342 			addHeaderField(field, cellPosition);
343 
344 			// add action header as last column in row
345 			if ((cellPosition == getNumberOfDataColumns()) && collectionGroup.isRenderLineActions()
346 					&& !collectionGroup.isReadOnly()) {
347 				actionFieldPrototype.setLabelFieldRendered(true);
348 				actionFieldPrototype.setRowSpan(rowCount);
349 				addHeaderField(actionFieldPrototype, cellPosition);
350 			}
351 		}
352 	}
353 
354 	/**
355 	 * Creates a new instance of the header field prototype and then sets the
356 	 * label to the short (if useShortLabels is set to true) or long label of
357 	 * the given component. After created the header field is added to the list
358 	 * making up the table header
359 	 * 
360 	 * @param field
361 	 *            - field instance the header field is being created for
362 	 * @param column
363 	 *            - column number for the header, used for setting the id
364 	 */
365 	protected void addHeaderField(Field field, int column) {
366 		LabelField headerField = ComponentUtils.copy(headerFieldPrototype, "_c" + column);
367 		if (useShortLabels) {
368 			headerField.setLabelText(field.getLabel());
369 		}
370 		else {
371 			headerField.setLabelText(field.getLabel());
372 		}
373 
374 		headerField.setRowSpan(field.getRowSpan());
375 		headerField.setColSpan(field.getColSpan());
376 
377 		if ((field.getRequired() != null) && field.getRequired().booleanValue()) {
378 			headerField.getRequiredMessageField().setRender(true);
379 		}
380 		else {
381 			headerField.getRequiredMessageField().setRender(false);
382 		}
383 
384 		headerFields.add(headerField);
385 	}
386 
387 	/**
388 	 * Calculates how many rows will be needed per collection line to display
389 	 * the list of fields. Assumption is made that the total number of cells the
390 	 * fields take up is evenly divisible by the configured number of columns
391 	 * 
392 	 * @param items
393 	 *            - list of items that make up one collection line
394 	 * @return int number of rows
395 	 */
396 	protected int calculateNumberOfRows(List<? extends Field> items) {
397 		int rowCount = 0;
398 		
399 		// check flag that indicates only one row should be created
400 		if (isSuppressLineWrapping()) {
401 		    return 1;
402 		}
403 
404 		int cellCount = 0;
405 		for (Field field : items) {
406 			cellCount += field.getColSpan() + field.getRowSpan() - 1;
407 		}
408 
409 		if (cellCount != 0) {
410 			rowCount = cellCount / getNumberOfDataColumns();
411 		}
412 
413 		return rowCount;
414 	}
415 
416 	/**
417 	 * @see org.kuali.rice.krad.uif.layout.ContainerAware#getSupportedContainer()
418 	 */
419 	@Override
420 	public Class<? extends Container> getSupportedContainer() {
421 		return CollectionGroup.class;
422 	}
423 
424 	/**
425 	 * @see org.kuali.rice.krad.uif.layout.LayoutManagerBase#getComponentsForLifecycle()
426 	 */
427 	@Override
428 	public List<Component> getComponentsForLifecycle() {
429 		List<Component> components = super.getComponentsForLifecycle();
430 
431 		components.add(richTable);
432         components.add(addLineGroup);
433 		components.addAll(headerFields);
434 		components.addAll(dataFields);
435 
436 		return components;
437 	}
438 
439     /**
440      * @see org.kuali.rice.krad.uif.layout.LayoutManager#getComponentPrototypes()
441      */
442     @Override
443     public List<Component> getComponentPrototypes() {
444         List<Component> components = super.getComponentPrototypes();
445 
446         components.add(headerFieldPrototype);
447         components.add(sequenceFieldPrototype);
448         components.add(actionFieldPrototype);
449         components.add(subCollectionFieldGroupPrototype);
450         components.add(selectFieldPrototype);
451 
452         return components;
453     }
454 
455 	/**
456 	 * Indicates whether the short label for the collection field should be used
457 	 * as the table header or the regular label
458 	 * 
459 	 * @return boolean true if short label should be used, false if long label
460 	 *         should be used
461 	 */
462 	public boolean isUseShortLabels() {
463 		return this.useShortLabels;
464 	}
465 
466 	/**
467 	 * Setter for the use short label indicator
468 	 * 
469 	 * @param useShortLabels
470 	 */
471 	public void setUseShortLabels(boolean useShortLabels) {
472 		this.useShortLabels = useShortLabels;
473 	}
474 
475 	/**
476 	 * Indicates whether the header should be repeated before each collection
477 	 * row. If false the header is only rendered at the beginning of the table
478 	 * 
479 	 * @return boolean true if header should be repeated, false if it should
480 	 *         only be rendered once
481 	 */
482 	public boolean isRepeatHeader() {
483 		return this.repeatHeader;
484 	}
485 
486 	/**
487 	 * Setter for the repeat header indicator
488 	 * 
489 	 * @param repeatHeader
490 	 */
491 	public void setRepeatHeader(boolean repeatHeader) {
492 		this.repeatHeader = repeatHeader;
493 	}
494 
495 	/**
496 	 * <code>LabelField</code> instance to use as a prototype for creating the
497 	 * tables header fields. For each header field the prototype will be copied
498 	 * and adjusted as necessary
499 	 * 
500 	 * @return LabelField instance to serve as prototype
501 	 */
502 	public LabelField getHeaderFieldPrototype() {
503 		return this.headerFieldPrototype;
504 	}
505 
506 	/**
507 	 * Setter for the header field prototype
508 	 * 
509 	 * @param headerFieldPrototype
510 	 */
511 	public void setHeaderFieldPrototype(LabelField headerFieldPrototype) {
512 		this.headerFieldPrototype = headerFieldPrototype;
513 	}
514 
515 	/**
516 	 * List of <code>LabelField</code> instances that should be rendered to make
517 	 * up the tables header
518 	 * 
519 	 * @return List of label field instances
520 	 */
521 	public List<LabelField> getHeaderFields() {
522 		return this.headerFields;
523 	}
524 
525 	/**
526 	 * Indicates whether the sequence field should be rendered for the
527 	 * collection
528 	 * 
529 	 * @return boolean true if sequence field should be rendered, false if not
530 	 */
531 	public boolean isRenderSequenceField() {
532 		return this.renderSequenceField;
533 	}
534 
535 	/**
536 	 * Setter for the render sequence field indicator
537 	 * 
538 	 * @param renderSequenceField
539 	 */
540 	public void setRenderSequenceField(boolean renderSequenceField) {
541 		this.renderSequenceField = renderSequenceField;
542 	}
543 
544 	/**
545 	 * Attribute name to use as sequence value. For each collection line the
546 	 * value of this field on the line will be retrieved and used as the
547 	 * sequence value
548 	 * 
549 	 * @return String sequence property name
550 	 */
551     public String getSequencePropertyName() {
552         if ((sequenceFieldPrototype != null) && (sequenceFieldPrototype instanceof DataField)) {
553             return ((DataField) sequenceFieldPrototype).getPropertyName();
554         }
555 
556         return null;
557     }
558 
559     /**
560      * Setter for the sequence property name
561      * 
562      * @param sequencePropertyName
563      */
564     public void setSequencePropertyName(String sequencePropertyName) {
565         if ((sequenceFieldPrototype != null) && (sequenceFieldPrototype instanceof DataField)) {
566             ((DataField) sequenceFieldPrototype).setPropertyName(sequencePropertyName);
567         }
568     }
569 	
570     /**
571      * Indicates whether the sequence field should be generated with the current
572      * line number
573      * 
574      * <p>
575      * If set to true the sequence field prototype will be changed to a message
576      * field (if not already a message field) and the text will be set to the
577      * current line number
578      * </p>
579      * 
580      * @return boolean true if the sequence field should be generated from the
581      *         line number, false if not
582      */
583     public boolean isGenerateAutoSequence() {
584         return this.generateAutoSequence;
585     }
586 
587     /**
588      * Setter for the generate auto sequence field
589      * 
590      * @param generateAutoSequence
591      */
592     public void setGenerateAutoSequence(boolean generateAutoSequence) {
593         this.generateAutoSequence = generateAutoSequence;
594     }
595 
596     /**
597 	 * <code>Field</code> instance to serve as a prototype for the
598 	 * sequence field. For each collection line this instance is copied and
599 	 * adjusted as necessary
600 	 * 
601 	 * @return Attribute field instance
602 	 */
603 	public Field getSequenceFieldPrototype() {
604 		return this.sequenceFieldPrototype;
605 	}
606 
607 	/**
608 	 * Setter for the sequence field prototype
609 	 * 
610 	 * @param sequenceFieldPrototype
611 	 */
612 	public void setSequenceFieldPrototype(Field sequenceFieldPrototype) {
613 		this.sequenceFieldPrototype = sequenceFieldPrototype;
614 	}
615 
616 	/**
617 	 * <code>FieldGroup</code> instance to serve as a prototype for the actions
618 	 * column. For each collection line this instance is copied and adjusted as
619 	 * necessary. Note the actual actions for the group come from the collection
620 	 * groups actions List
621 	 * (org.kuali.rice.krad.uif.container.CollectionGroup.getActionFields()). The
622 	 * FieldGroup prototype is useful for setting styling of the actions column
623 	 * and for the layout of the action fields. Note also the label associated
624 	 * with the prototype is used for the action column header
625 	 * 
626 	 * @return GroupField instance
627 	 */
628 	public FieldGroup getActionFieldPrototype() {
629 		return this.actionFieldPrototype;
630 	}
631 
632 	/**
633 	 * Setter for the action field prototype
634 	 * 
635 	 * @param actionFieldPrototype
636 	 */
637 	public void setActionFieldPrototype(FieldGroup actionFieldPrototype) {
638 		this.actionFieldPrototype = actionFieldPrototype;
639 	}
640 
641 	/**
642 	 * @see org.kuali.rice.krad.uif.layout.CollectionLayoutManager#getSubCollectionFieldGroupPrototype()
643 	 */
644 	public FieldGroup getSubCollectionFieldGroupPrototype() {
645 		return this.subCollectionFieldGroupPrototype;
646 	}
647 
648 	/**
649 	 * Setter for the sub-collection field group prototype
650 	 * 
651 	 * @param subCollectionFieldGroupPrototype
652 	 */
653 	public void setSubCollectionFieldGroupPrototype(FieldGroup subCollectionFieldGroupPrototype) {
654 		this.subCollectionFieldGroupPrototype = subCollectionFieldGroupPrototype;
655 	}
656 
657     /**
658      * Field instance that serves as a prototype for creating the select field on each line when
659      * {@link org.kuali.rice.krad.uif.container.CollectionGroup#isRenderSelectField()} is true
660      *
661      * <p>
662      * This prototype can be used to set the control used for the select field (generally will be a checkbox control)
663      * in addition to styling and other setting. The binding path will be formed with using the
664      * {@link org.kuali.rice.krad.uif.container.CollectionGroup#getSelectPropertyName()} or if not set the framework
665      * will use {@link org.kuali.rice.krad.web.form.UifFormBase#getSelectedCollectionLines()}
666      * </p>
667      *
668      * @return Field select field prototype instance
669      */
670     public Field getSelectFieldPrototype() {
671         return selectFieldPrototype;
672     }
673 
674     /**
675      * Setter for the prototype instance for select fields
676      *
677      * @param selectFieldPrototype
678      */
679     public void setSelectFieldPrototype(Field selectFieldPrototype) {
680         this.selectFieldPrototype = selectFieldPrototype;
681     }
682 
683     /**
684      * Indicates whether the add line should be rendered in a separate group, or as part of the table (first line)
685      *
686      * <p>
687      * When separate add line is enabled, the fields for the add line will be placed in the {@link #getAddLineGroup()}.
688      * This group can be used to configure the add line presentation. In addition to the fields, the header on the
689      * group (unless already set) will be set to
690      * {@link org.kuali.rice.krad.uif.container.CollectionGroup#getAddLineLabel()} and the add line actions will
691      * be placed into the group's footer.
692      * </p>
693      *
694      * @return boolean true if add line should be separated, false if it should be placed into the table
695      */
696     public boolean isSeparateAddLine() {
697         return separateAddLine;
698     }
699 
700     /**
701      * Setter for the separate add line indicator
702      *
703      * @param separateAddLine
704      */
705     public void setSeparateAddLine(boolean separateAddLine) {
706         this.separateAddLine = separateAddLine;
707     }
708 
709     /**
710      * When {@link #isSeparateAddLine()} is true, this group will be used to render the add line
711      *
712      * <p>
713      * This group can be used to configure how the add line will be rendered. For example the layout manager configured
714      * on the group will be used to rendered the add line fields. If the header (title) is not set on the group, it
715      * will be set from
716      * {@link org.kuali.rice.krad.uif.container.CollectionGroup#getAddLineLabel()}. In addition,
717      * {@link org.kuali.rice.krad.uif.container.CollectionGroup#getAddLineActionFields()} will be added to the group
718      * footer items.
719      * </p>
720      *
721      * @return Group instance for the collection add line
722      */
723     public Group getAddLineGroup() {
724         return addLineGroup;
725     }
726 
727     /**
728      * Setter for the add line Group
729      *
730      * @param addLineGroup
731      */
732     public void setAddLineGroup(Group addLineGroup) {
733         this.addLineGroup = addLineGroup;
734     }
735 
736     /**
737 	 * List of <code>Field</code> instances that make up the tables body. Pulled
738 	 * by the layout manager template to send through the Grid layout
739 	 * 
740 	 * @return List<Field> table body fields
741 	 */
742 	public List<Field> getDataFields() {
743 		return this.dataFields;
744 	}
745 
746 	/**
747 	 * Widget associated with the table to add functionality such as sorting,
748 	 * paging, and export
749 	 * 
750 	 * @return TableTools instance
751 	 */
752 	public RichTable getRichTable() {
753 		return this.richTable;
754 	}
755 
756 	/**
757 	 * Setter for the table tools widget
758 	 * 
759 	 * @param richTable
760 	 */
761 	public void setRichTable(RichTable richTable) {
762 		this.richTable = richTable;
763 	}
764 
765 	/**
766      * @return the numberOfDataColumns
767      */
768     public int getNumberOfDataColumns() {
769     	return this.numberOfDataColumns;
770     }
771 
772 	/**
773      * @param numberOfDataColumns the numberOfDataColumns to set
774      */
775     public void setNumberOfDataColumns(int numberOfDataColumns) {
776     	this.numberOfDataColumns = numberOfDataColumns;
777     }
778 
779 }