View Javadoc

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