| 1 | |
package org.kuali.student.enrollment.uif.container; |
| 2 | |
|
| 3 | |
import org.apache.commons.lang.StringUtils; |
| 4 | |
import org.kuali.rice.krad.uif.UifConstants; |
| 5 | |
import org.kuali.rice.krad.uif.UifParameters; |
| 6 | |
import org.kuali.rice.krad.uif.container.CollectionGroup; |
| 7 | |
import org.kuali.rice.krad.uif.container.CollectionGroupBuilder; |
| 8 | |
import org.kuali.rice.krad.uif.field.ActionField; |
| 9 | |
import org.kuali.rice.krad.uif.util.ComponentUtils; |
| 10 | |
import org.kuali.rice.krad.uif.view.View; |
| 11 | |
|
| 12 | |
import java.util.List; |
| 13 | |
|
| 14 | 0 | public class KSCollectionGroupBuilder extends CollectionGroupBuilder{ |
| 15 | |
|
| 16 | |
protected List<ActionField> getLineActions(View view, Object model, CollectionGroup collectionGroup, |
| 17 | |
Object collectionLine, int lineIndex) { |
| 18 | |
|
| 19 | 0 | String lineSuffix = UifConstants.IdSuffixes.LINE + Integer.toString(lineIndex); |
| 20 | 0 | if (StringUtils.isNotBlank(collectionGroup.getSubCollectionSuffix())) { |
| 21 | 0 | lineSuffix = collectionGroup.getSubCollectionSuffix() + lineSuffix; |
| 22 | |
} |
| 23 | 0 | List<ActionField> lineActions = ComponentUtils.copyFieldList(collectionGroup.getActionFields(), lineSuffix); |
| 24 | |
|
| 25 | 0 | for (ActionField actionField : lineActions) { |
| 26 | 0 | actionField.addActionParameter(UifParameters.SELLECTED_COLLECTION_PATH, collectionGroup.getBindingInfo() |
| 27 | |
.getBindingPath()); |
| 28 | 0 | actionField.addActionParameter(UifParameters.SELECTED_LINE_INDEX, Integer.toString(lineIndex)); |
| 29 | 0 | actionField.setJumpToIdAfterSubmit(collectionGroup.getId() + "_div"); |
| 30 | |
|
| 31 | 0 | if (StringUtils.isBlank(actionField.getClientSideJs())){ |
| 32 | 0 | actionField.setClientSideJs("performCollectionAction('"+collectionGroup.getId()+"');"); |
| 33 | |
} |
| 34 | |
} |
| 35 | |
|
| 36 | 0 | ComponentUtils.updateContextsForLine(lineActions, collectionLine, lineIndex); |
| 37 | |
|
| 38 | 0 | return lineActions; |
| 39 | |
} |
| 40 | |
} |