1 package org.kuali.student.common.ui.client.widgets.layout;
2
3 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
4
5 import com.google.gwt.user.client.ui.HTML;
6 import com.google.gwt.user.client.ui.Panel;
7 import com.google.gwt.user.client.ui.Widget;
8
9
10
11
12
13
14 public class ContentBlock extends VerticalFlowPanel{
15
16 private SectionTitle sectionTitle = SectionTitle.generateH2Title("");
17 private VerticalFlowPanel titlePanel = new VerticalFlowPanel();
18 private HTML description = new HTML();
19 private int size;
20
21 public ContentBlock(String blockTitle, String blockDescriptionHtml){
22 this(blockTitle, blockDescriptionHtml, 1);
23 }
24
25 public ContentBlock(String blockTitle, String blockDescriptionHtml, int blockSize){
26 sectionTitle.setText(blockTitle);
27 description.setHTML(blockDescriptionHtml);
28 titlePanel.add(sectionTitle);
29 titlePanel.add(description);
30 size = blockSize;
31 super.add(titlePanel);
32 if(blockSize == 3){
33 this.setStyleName("contentBlock-size3");
34 }
35 else if(blockSize == 2){
36 this.setStyleName("contentBlock-size2");
37 }
38 else{
39 this.setStyleName("contentBlock-size1");
40 }
41 titlePanel.setStyleName("contentBlock-titlePanel");
42 sectionTitle.setStyleName("contentBlock-title");
43 description.setStyleName("contentBlock-desc");
44 }
45
46 public int getBlockSize(){
47 return size;
48 }
49
50 @Override
51 public void add(Widget w){
52 super.add(w);
53 }
54
55 public void addBlock(ContentBlock block){
56 super.add(block);
57 }
58
59 public Panel getTitlePanel(){
60 return titlePanel;
61 }
62
63 }