1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.ui.client.widgets.containers;
17
18 import org.kuali.student.common.ui.client.theme.Theme;
19 import org.kuali.student.common.ui.client.widgets.KSLabel;
20 import org.kuali.student.common.ui.client.widgets.layout.HorizontalBlockFlowPanel;
21 import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel;
22
23 import com.google.gwt.user.client.ui.Composite;
24 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
25 import com.google.gwt.user.client.ui.HorizontalPanel;
26 import com.google.gwt.user.client.ui.SimplePanel;
27 import com.google.gwt.user.client.ui.VerticalPanel;
28 import com.google.gwt.user.client.ui.Widget;
29
30 public class KSTitleContainerImpl extends Composite{
31 private String title;
32 private String status;
33 private String linkText;
34 private KSLabel titleLabel = new KSLabel();
35 private KSLabel statusLabel = new KSLabel();
36 private KSLabel linkLabel = new KSLabel();
37 private SimplePanel parentContainer = new SimplePanel();
38 private SimplePanel toolbar = new SimplePanel();
39 private VerticalFlowPanel messagePanel = new VerticalFlowPanel();
40 private SimplePanel content = new SimplePanel();
41 private VerticalPanel layout = new VerticalPanel();
42 private VerticalPanel rightContent = new VerticalPanel();
43 private HorizontalPanel top = new HorizontalPanel();
44
45 public KSTitleContainerImpl(){
46 createLayout();
47 }
48
49 public KSTitleContainerImpl(String title, String status, String link){
50 this.setTitle(title);
51 this.setStatus(status);
52 this.setLinkText(link);
53 createLayout();
54 }
55
56 public KSTitleContainerImpl(String title, String status){
57 this.setTitle(title);
58 this.setStatus(status);
59 createLayout();
60 }
61
62 public KSTitleContainerImpl(String title){
63 this.setTitle(title);
64 createLayout();
65 }
66
67 private void createLayout(){
68 top.add(titleLabel);
69 rightContent.add(statusLabel);
70 rightContent.add(linkLabel);
71 rightContent.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
72 rightContent.setCellHorizontalAlignment(linkLabel, HasHorizontalAlignment.ALIGN_RIGHT);
73 rightContent.setCellHorizontalAlignment(statusLabel, HasHorizontalAlignment.ALIGN_RIGHT);
74 top.add(rightContent);
75 layout.add(top);
76 layout.add(toolbar);
77 layout.add(messagePanel);
78 layout.add(content);
79 linkLabel.addStyleName("KS-TitleContainer-Link");
80 statusLabel.addStyleName("KS-TitleContainer-Status");
81 titleLabel.addStyleName("KS-TitleContainer-Title");
82 top.addStyleName("KS-TitleContainer-Top-Row");
83 toolbar.addStyleName("KS-TitleContainer-Toolbar");
84 messagePanel.addStyleName("KS-TitleContainer-Messages");
85 rightContent.addStyleName("KS-TitleContainer-Right-Panel");
86 layout.addStyleName("KS-TitleContainer-Layout");
87 parentContainer.addStyleName("KS-Drop-Shadow");
88 parentContainer.addStyleName("KS-TitleContainer");
89 parentContainer.setWidget(layout);
90 this.initWidget(parentContainer);
91 }
92
93 public String getTitle() {
94 return title;
95 }
96
97 public void setTitle(String title) {
98 this.title = title;
99 titleLabel.setText(title);
100 }
101
102 public String getStatus() {
103 return status;
104 }
105
106 public void setStatus(String status) {
107 this.status = status;
108 statusLabel.setText(status);
109 }
110
111 public String getLinkText() {
112 return linkText;
113 }
114
115 public void setLinkText(String linkText) {
116 this.linkText = linkText;
117 linkLabel.setText(linkText);
118 }
119
120 public void setContent(Widget contentWidget) {
121 content.setWidget(contentWidget);
122 }
123
124 public void setToolbar(Widget toolbarWidget) {
125 toolbar.setWidget(toolbarWidget);
126 }
127
128 public void addMessage(String message){
129 HorizontalBlockFlowPanel staticMessagePanel = new HorizontalBlockFlowPanel();
130 staticMessagePanel.addStyleName("KS-Message-Static");
131 staticMessagePanel.add(Theme.INSTANCE.getCommonImages().getWarningDiamondIcon());
132 staticMessagePanel.add(new KSLabel(message));
133 messagePanel.add(staticMessagePanel);
134 }
135
136 public void clearMessages(){
137 messagePanel.clear();
138 }
139 }