1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.ui.client.configurable.mvc.sections;
17
18 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
19 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem;
20 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityComposite.StyleType;
21
22 import com.google.gwt.event.dom.client.ClickEvent;
23 import com.google.gwt.event.dom.client.ClickHandler;
24 import com.google.gwt.user.client.ui.FlowPanel;
25
26
27
28
29 @Deprecated
30 public class RemovableItemWithHeader extends MultiplicityItem{
31
32 private MultiplicityHeader header;
33 private FlowPanel layout = new FlowPanel();
34 private FlowPanel body = new FlowPanel();
35 private StyleType style;
36 private String itemLabel;
37 private boolean readOnly=false;
38 private boolean loaded = false;
39
40
41 public void isReadOnly(boolean readOnly){
42 this.readOnly=readOnly;
43 }
44
45 public void setReadOnly(boolean readOnly) {
46 this.readOnly = readOnly;
47 }
48
49 public RemovableItemWithHeader(StyleType style){
50 this.style = style;
51 this.initWidget(layout);
52
53 }
54
55 public RemovableItemWithHeader(StyleType style, boolean readOnly){
56 this.style = style;
57 this.readOnly = readOnly;
58 this.initWidget(layout);
59
60 }
61
62 @Override
63 public void clear() {
64 loaded = false;
65
66 }
67
68 public void setItemLabel(String itemLabel) {
69 this.itemLabel = itemLabel;
70 }
71
72 @Override
73 public void redraw() {
74 if (!loaded){
75 layout.clear();
76 if(style == StyleType.TOP_LEVEL){
77 SectionTitle title = SectionTitle.generateH4Title(itemLabel);
78 title.addStyleName("ks-form-bordered-header-title");
79 header = new MultiplicityHeader(title, readOnly);
80 header.setStyleName("ks-form-bordered-header");
81 layout.setStyleName("ks-form-bordered");
82 body.setStyleName("ks-form-bordered-body");
83 }
84 else if(style == StyleType.SUB_LEVEL){
85 SectionTitle title = SectionTitle.generateH5Title(itemLabel);
86 title.addStyleName("ks-form-course-format-activity-header-title");
87 header = new MultiplicityHeader(title, readOnly);
88 header.setStyleName("ks-form-course-format-activity-header");
89 layout.setStyleName("ks-form-course-format-activity");
90 }
91
92
93 if(!readOnly){
94 header.addDeleteHandler(new ClickHandler() {
95 public void onClick(ClickEvent event) {
96 getRemoveCallback().exec(RemovableItemWithHeader.this);
97 }
98 });
99 }
100
101 layout.add(header);
102 body.add(this.getItemWidget());
103 layout.add(body);
104 }
105
106
107
108
109
110 }
111
112 }