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.datadictionary.parse.BeanTag;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
22 import org.kuali.rice.krad.uif.UifConstants;
23 import org.kuali.rice.krad.uif.component.Component;
24 import org.kuali.rice.krad.uif.container.Group;
25 import org.kuali.rice.krad.uif.view.View;
26
27
28
29
30
31
32 @BeanTag(name = "reorderer-bean", parent = "Uif-Reorderer")
33 public class Reorderer extends WidgetBase {
34 private static final long serialVersionUID = 6142957061046219120L;
35
36 private String movableStyleClass;
37
38 public Reorderer() {
39 super();
40 }
41
42
43
44
45
46
47
48
49
50 @Override
51 public void performFinalize(View view, Object model, Component component) {
52 super.performFinalize(view, model, component);
53
54 if (!(component instanceof Group)) {
55 throw new RiceIllegalArgumentException("Parent component for Reorderer widget must be a group.");
56 }
57
58 if (StringUtils.isNotBlank(movableStyleClass)) {
59 for (Component item : ((Group) component).getItems()) {
60 item.addStyleClass(movableStyleClass);
61 }
62
63
64 if (!getTemplateOptions().containsKey(UifConstants.ReordererOptionKeys.SELECTORS)) {
65 String selectorsOption =
66 "{" + UifConstants.ReordererOptionKeys.MOVABLES + " : 'span." + movableStyleClass + "' }";
67 getTemplateOptions().put(UifConstants.ReordererOptionKeys.SELECTORS, selectorsOption);
68 }
69 }
70 }
71
72
73
74
75
76
77
78
79
80
81
82 @BeanTagAttribute(name="movableStyleClass")
83 public String getMovableStyleClass() {
84 return movableStyleClass;
85 }
86
87
88
89
90
91
92 public void setMovableStyleClass(String movableStyleClass) {
93 this.movableStyleClass = movableStyleClass;
94 }
95 }