1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.ui.client.configurable.mvc.multiplicity;
17
18
19 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityComposite.StyleType;
20 import org.kuali.student.common.ui.client.widgets.KSLabel;
21
22 import com.google.gwt.user.client.ui.FlowPanel;
23 import com.google.gwt.user.client.ui.Widget;
24
25 /**
26 * This is a read only version of MultiplicityItem for use in read only multiplicity composites.
27 *
28 *
29 * @author Kuali Student Team
30 */
31
32 /**
33 * @deprecated
34 */
35 public class DisplayItem extends MultiplicityItem {
36 private boolean loaded = false;
37 private KSLabel itemLabel;
38
39 protected FlowPanel itemPanel = new FlowPanel();
40
41 public DisplayItem(){
42 initWidget(itemPanel);
43 }
44
45 public DisplayItem(StyleType style){
46 this.initWidget(itemPanel);
47
48 }
49 public void onLoad(){
50 }
51
52 /**
53 * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem#clear()
54 */
55 @Override
56 public void clear() {
57 loaded = false;
58 }
59
60 /**
61 * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem#redraw()
62 */
63 @Override
64 public void redraw() {
65 Widget item = getItemWidget();
66 if (!loaded){
67
68 if (itemLabel != null) {
69 itemPanel.add(itemLabel);
70 itemLabel.addStyleName("KS-Multiplicity-Item-Header");
71 }
72 itemPanel.add(item);
73 itemPanel.addStyleName("KS-Multiplicity-Display-Item");
74 loaded = true;
75 }
76 //redraw() removed, probably not needed here
77 /* if (item instanceof Section){
78 ((Section)item).redraw();
79 }*/
80 }
81
82
83 public void setItemLabel(String itemLabel) {
84 this.itemLabel = new KSLabel(itemLabel);
85 }
86
87 }