1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.lifecycle.model;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhase;
21 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase;
22 import org.kuali.rice.krad.uif.util.ComponentUtils;
23
24
25
26
27
28
29
30 public class SuffixIdFromContainerTask extends ViewLifecycleTaskBase<Component> {
31
32
33
34
35
36
37 public SuffixIdFromContainerTask() {
38 super(Component.class);
39 }
40
41
42
43
44
45
46
47 @Override
48 protected void performLifecycleTask() {
49 Component component = (Component) getElementState().getElement();
50 ViewLifecyclePhase phase = (ViewLifecyclePhase) getElementState();
51
52 Component parent = phase.getParent();
53 if (parent == null) {
54 return;
55 }
56
57
58 String containerIdSuffix = phase.getParent().getContainerIdSuffix();
59 if (StringUtils.isBlank(parent.getContainerIdSuffix())) {
60 return;
61 }
62
63 ComponentUtils.updateIdWithSuffix(component, containerIdSuffix);
64
65
66 if (StringUtils.isNotBlank(component.getContainerIdSuffix())) {
67 containerIdSuffix = component.getContainerIdSuffix() + containerIdSuffix;
68 }
69
70 component.setContainerIdSuffix(containerIdSuffix);
71 }
72
73 }