View Javadoc

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  public class KSCollectionGroupBuilder extends CollectionGroupBuilder{
15  
16      @Override
17      protected List<Action> initializeLineActions(List<Action> lineActions, View view, Object model,
18              CollectionGroup collectionGroup, Object collectionLine, int lineIndex, String actionScript) {
19          String lineSuffix = UifConstants.IdSuffixes.LINE + Integer.toString(lineIndex);
20          if (StringUtils.isNotBlank(collectionGroup.getSubCollectionSuffix())) {
21              lineSuffix = collectionGroup.getSubCollectionSuffix() + lineSuffix;
22          }
23          List<Action> actions = ComponentUtils.copyComponentList(lineActions, lineSuffix);
24  
25          for (Action action : actions) {
26              action.addActionParameter(UifParameters.SELLECTED_COLLECTION_PATH,
27                      collectionGroup.getBindingInfo().getBindingPath());
28              action.addActionParameter(UifParameters.SELECTED_LINE_INDEX, Integer.toString(lineIndex));
29              action.setJumpToIdAfterSubmit(collectionGroup.getId());
30              String script;
31              if (StringUtils.isNotBlank(action.getActionScript())) {
32                  script = action.getActionScript();
33              }else{
34                  script = actionScript;
35              }
36              action.setActionScript(script);
37          }
38  
39          ComponentUtils.updateContextsForLine(actions, collectionLine, lineIndex);
40  
41          return actions;
42      }
43  }