001 package org.kuali.student.common.ui.client.widgets.layout; 002 003 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; 004 005 import com.google.gwt.user.client.ui.FlowPanel; 006 import com.google.gwt.user.client.ui.Label; 007 import com.google.gwt.user.client.ui.Widget; 008 009 /** 010 * A layout which contains content blocks, used for a layout which contains logical blocks of content. 011 * Each row contains a space of 3 blocks, and depending on size of blocks added will wrap to the next line. 012 * 013 * @author Kuali Student Team 014 * 015 */ 016 @Deprecated 017 public class ContentBlockLayout extends VerticalFlowPanel{ 018 019 private SectionTitle sectionTitle = SectionTitle.generateH1Title(""); 020 private FlowPanel titlePanel = new FlowPanel(); 021 //private FlowPanel blockPanel = new FlowPanel(); 022 private FlowPanel currentRow; 023 private int rowSize = 0; 024 private int titleWidgetCount = 0; 025 026 public ContentBlockLayout(String title){ 027 this.setContentTitle(title); 028 titlePanel.add(sectionTitle); 029 this.add(titlePanel); 030 //this.add(blockPanel); 031 sectionTitle.addStyleName("blockLayout-title"); 032 titlePanel.addStyleName("blockLayout-titlePanel"); 033 //blockPanel.addStyleName("blockLayout-content"); 034 this.addStyleName("blockLayout"); 035 } 036 037 public void setContentTitle(String title){ 038 sectionTitle.setText(title); 039 } 040 041 public void addContentTitleWidget(Widget widget){ 042 043 if(titleWidgetCount != 0){ 044 Label separator = new Label(" | "); 045 separator.addStyleName("titleWidget-separator"); 046 separator.addStyleName("blockLayout-title-widget"); 047 titlePanel.add(separator); 048 titlePanel.add(widget); 049 } 050 else{ 051 titlePanel.add(widget); 052 } 053 widget.addStyleName("blockLayout-title-widget"); 054 titleWidgetCount++; 055 } 056 057 public void addContentBlock(ContentBlock block){ 058 if(rowSize == 0){ 059 FlowPanel row = new FlowPanel(); 060 this.add(row); 061 row.addStyleName("blockLayout-row"); 062 currentRow = row; 063 } 064 currentRow.add(block); 065 rowSize = rowSize + block.getBlockSize(); 066 if(rowSize == 3){ 067 rowSize = 0; 068 } 069 block.addStyleName("blockLayout-blockPadding"); 070 } 071 }