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 | |
public class ContentBlock extends VerticalFlowPanel{ |
10 | |
|
11 | 0 | private SectionTitle sectionTitle = SectionTitle.generateH2Title(""); |
12 | 0 | private VerticalFlowPanel titlePanel = new VerticalFlowPanel(); |
13 | 0 | private HTML description = new HTML(); |
14 | |
private int size; |
15 | |
|
16 | |
public ContentBlock(String blockTitle, String blockDescriptionHtml){ |
17 | 0 | this(blockTitle, blockDescriptionHtml, 1); |
18 | 0 | } |
19 | |
|
20 | 0 | public ContentBlock(String blockTitle, String blockDescriptionHtml, int blockSize){ |
21 | 0 | sectionTitle.setText(blockTitle); |
22 | 0 | description.setHTML(blockDescriptionHtml); |
23 | 0 | titlePanel.add(sectionTitle); |
24 | 0 | titlePanel.add(description); |
25 | 0 | size = blockSize; |
26 | 0 | super.add(titlePanel); |
27 | 0 | if(blockSize == 3){ |
28 | 0 | this.setStyleName("contentBlock-size3"); |
29 | |
} |
30 | 0 | else if(blockSize == 2){ |
31 | 0 | this.setStyleName("contentBlock-size2"); |
32 | |
} |
33 | |
else{ |
34 | 0 | this.setStyleName("contentBlock-size1"); |
35 | |
} |
36 | 0 | titlePanel.setStyleName("contentBlock-titlePanel"); |
37 | 0 | sectionTitle.setStyleName("contentBlock-title"); |
38 | 0 | description.setStyleName("contentBlock-desc"); |
39 | 0 | } |
40 | |
|
41 | |
public int getBlockSize(){ |
42 | 0 | return size; |
43 | |
} |
44 | |
|
45 | |
@Override |
46 | |
public void add(Widget w){ |
47 | 0 | super.add(w); |
48 | 0 | } |
49 | |
|
50 | |
public void addBlock(ContentBlock block){ |
51 | 0 | super.add(block); |
52 | 0 | } |
53 | |
|
54 | |
public Panel getTitlePanel(){ |
55 | 0 | return titlePanel; |
56 | |
} |
57 | |
|
58 | |
} |