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.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21 import org.kuali.rice.krad.uif.CssConstants;
22 import org.kuali.rice.krad.uif.component.Component;
23 import org.kuali.rice.krad.uif.container.Group;
24 import org.kuali.rice.krad.uif.layout.LayoutManager;
25 import org.kuali.rice.krad.uif.view.View;
26
27
28
29
30
31
32 @BeanTag(name = "scrollpane-bean", parent = "Uif-Scrollpane")
33 public class Scrollpane extends WidgetBase {
34 private static final long serialVersionUID = 3853028195825084261L;
35
36 private String height;
37
38 @Override
39 public void performFinalize(View view, Object model, Component parent) {
40 super.performFinalize(view, model, parent);
41
42 buildCSSforScrollPane(parent);
43 }
44
45 private void buildCSSforScrollPane(Component parent) {
46 LayoutManager layoutManager = ((Group) parent).getLayoutManager();
47 if (StringUtils.isNotBlank(getHeight())) {
48 if (!StringUtils.contains(layoutManager.getStyle(), CssConstants.HEIGHT)) {
49 layoutManager.appendToStyle(CssConstants.HEIGHT + getHeight() +";");
50 }
51
52 if (!StringUtils.contains(layoutManager.getStyle(), CssConstants.OVERFLOW)) {
53 layoutManager.appendToStyle(CssConstants.OVERFLOW + "auto;");
54 }
55 }
56 }
57
58
59
60
61
62
63
64
65
66
67
68
69
70 @BeanTagAttribute(name="height")
71 public String getHeight() {
72 return height;
73 }
74
75
76
77
78
79
80 public void setHeight(String height) {
81 this.height = height;
82 }
83
84
85
86
87 @Override
88 protected <T> void copyProperties(T component) {
89 super.copyProperties(component);
90 Scrollpane scrollpaneCopy = (Scrollpane) component;
91 scrollpaneCopy.setHeight(this.getHeight());
92 }
93
94 }