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 | 0 | private KSLabel titleLabel = new KSLabel(); |
35 | 0 | private KSLabel statusLabel = new KSLabel(); |
36 | 0 | private KSLabel linkLabel = new KSLabel(); |
37 | 0 | private SimplePanel parentContainer = new SimplePanel(); |
38 | 0 | private SimplePanel toolbar = new SimplePanel(); |
39 | 0 | private VerticalFlowPanel messagePanel = new VerticalFlowPanel(); |
40 | 0 | private SimplePanel content = new SimplePanel(); |
41 | 0 | private VerticalPanel layout = new VerticalPanel(); |
42 | 0 | private VerticalPanel rightContent = new VerticalPanel(); |
43 | 0 | private HorizontalPanel top = new HorizontalPanel(); |
44 | |
|
45 | 0 | public KSTitleContainerImpl(){ |
46 | 0 | createLayout(); |
47 | 0 | } |
48 | |
|
49 | 0 | public KSTitleContainerImpl(String title, String status, String link){ |
50 | 0 | this.setTitle(title); |
51 | 0 | this.setStatus(status); |
52 | 0 | this.setLinkText(link); |
53 | 0 | createLayout(); |
54 | 0 | } |
55 | |
|
56 | 0 | public KSTitleContainerImpl(String title, String status){ |
57 | 0 | this.setTitle(title); |
58 | 0 | this.setStatus(status); |
59 | 0 | createLayout(); |
60 | 0 | } |
61 | |
|
62 | 0 | public KSTitleContainerImpl(String title){ |
63 | 0 | this.setTitle(title); |
64 | 0 | createLayout(); |
65 | 0 | } |
66 | |
|
67 | |
private void createLayout(){ |
68 | 0 | top.add(titleLabel); |
69 | 0 | rightContent.add(statusLabel); |
70 | 0 | rightContent.add(linkLabel); |
71 | 0 | rightContent.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); |
72 | 0 | rightContent.setCellHorizontalAlignment(linkLabel, HasHorizontalAlignment.ALIGN_RIGHT); |
73 | 0 | rightContent.setCellHorizontalAlignment(statusLabel, HasHorizontalAlignment.ALIGN_RIGHT); |
74 | 0 | top.add(rightContent); |
75 | 0 | layout.add(top); |
76 | 0 | layout.add(toolbar); |
77 | 0 | layout.add(messagePanel); |
78 | 0 | layout.add(content); |
79 | 0 | linkLabel.addStyleName("KS-TitleContainer-Link"); |
80 | 0 | statusLabel.addStyleName("KS-TitleContainer-Status"); |
81 | 0 | titleLabel.addStyleName("KS-TitleContainer-Title"); |
82 | 0 | top.addStyleName("KS-TitleContainer-Top-Row"); |
83 | 0 | toolbar.addStyleName("KS-TitleContainer-Toolbar"); |
84 | 0 | messagePanel.addStyleName("KS-TitleContainer-Messages"); |
85 | 0 | rightContent.addStyleName("KS-TitleContainer-Right-Panel"); |
86 | 0 | layout.addStyleName("KS-TitleContainer-Layout"); |
87 | 0 | parentContainer.addStyleName("KS-Drop-Shadow"); |
88 | 0 | parentContainer.addStyleName("KS-TitleContainer"); |
89 | 0 | parentContainer.setWidget(layout); |
90 | 0 | this.initWidget(parentContainer); |
91 | 0 | } |
92 | |
|
93 | |
public String getTitle() { |
94 | 0 | return title; |
95 | |
} |
96 | |
|
97 | |
public void setTitle(String title) { |
98 | 0 | this.title = title; |
99 | 0 | titleLabel.setText(title); |
100 | 0 | } |
101 | |
|
102 | |
public String getStatus() { |
103 | 0 | return status; |
104 | |
} |
105 | |
|
106 | |
public void setStatus(String status) { |
107 | 0 | this.status = status; |
108 | 0 | statusLabel.setText(status); |
109 | 0 | } |
110 | |
|
111 | |
public String getLinkText() { |
112 | 0 | return linkText; |
113 | |
} |
114 | |
|
115 | |
public void setLinkText(String linkText) { |
116 | 0 | this.linkText = linkText; |
117 | 0 | linkLabel.setText(linkText); |
118 | 0 | } |
119 | |
|
120 | |
public void setContent(Widget contentWidget) { |
121 | 0 | content.setWidget(contentWidget); |
122 | 0 | } |
123 | |
|
124 | |
public void setToolbar(Widget toolbarWidget) { |
125 | 0 | toolbar.setWidget(toolbarWidget); |
126 | 0 | } |
127 | |
|
128 | |
public void addMessage(String message){ |
129 | 0 | HorizontalBlockFlowPanel staticMessagePanel = new HorizontalBlockFlowPanel(); |
130 | 0 | staticMessagePanel.addStyleName("KS-Message-Static"); |
131 | 0 | staticMessagePanel.add(Theme.INSTANCE.getCommonImages().getWarningDiamondIcon()); |
132 | 0 | staticMessagePanel.add(new KSLabel(message)); |
133 | 0 | messagePanel.add(staticMessagePanel); |
134 | 0 | } |
135 | |
|
136 | |
public void clearMessages(){ |
137 | 0 | messagePanel.clear(); |
138 | 0 | } |
139 | |
} |