1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.widget;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
20 import org.kuali.rice.krad.uif.UifConstants;
21 import org.kuali.rice.krad.uif.component.Component;
22 import org.kuali.rice.krad.uif.container.Group;
23 import org.kuali.rice.krad.uif.view.View;
24
25
26
27
28
29
30 public class Reorderer extends WidgetBase {
31 private static final long serialVersionUID = 6142957061046219120L;
32
33 private String movableStyleClass;
34
35 public Reorderer() {
36 super();
37 }
38
39
40
41
42
43
44
45
46
47 @Override
48 public void performFinalize(View view, Object model, Component component) {
49 super.performFinalize(view, model, component);
50
51 if (!(component instanceof Group)) {
52 throw new RiceIllegalArgumentException("Parent component for Reorderer widget must be a group.");
53 }
54
55 if (StringUtils.isNotBlank(movableStyleClass)) {
56 for (Component item : ((Group) component).getItems()) {
57 item.addStyleClass(movableStyleClass);
58 }
59
60
61 if (!getComponentOptions().containsKey(UifConstants.ReordererOptionKeys.SELECTORS)) {
62 String selectorsOption =
63 "{" + UifConstants.ReordererOptionKeys.MOVABLES + " : 'span." + movableStyleClass + "' }";
64 getComponentOptions().put(UifConstants.ReordererOptionKeys.SELECTORS, selectorsOption);
65 }
66 }
67 }
68
69
70
71
72
73
74
75
76
77
78
79 public String getMovableStyleClass() {
80 return movableStyleClass;
81 }
82
83
84
85
86
87
88 public void setMovableStyleClass(String movableStyleClass) {
89 this.movableStyleClass = movableStyleClass;
90 }
91 }