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.element.Action; |
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<Action> 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<Action> lineActions = ComponentUtils.copyComponentList(collectionGroup.getLineActions(), lineSuffix); |
24 | |
|
25 | 0 | for (Action action : lineActions) { |
26 | 0 | action.addActionParameter(UifParameters.SELLECTED_COLLECTION_PATH, collectionGroup.getBindingInfo() |
27 | |
.getBindingPath()); |
28 | 0 | action.addActionParameter(UifParameters.SELECTED_LINE_INDEX, Integer.toString(lineIndex)); |
29 | 0 | action.setJumpToIdAfterSubmit(collectionGroup.getId() + "_div"); |
30 | |
|
31 | 0 | if (StringUtils.isBlank(action.getClientSideJs())){ |
32 | 0 | action.setClientSideJs("performCollectionAction('"+collectionGroup.getId()+"');"); |
33 | |
} |
34 | |
} |
35 | |
|
36 | 0 | ComponentUtils.updateContextsForLine(lineActions, collectionLine, lineIndex); |
37 | |
|
38 | 0 | return lineActions; |
39 | |
} |
40 | |
} |