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