1 /** 2 * Copyright 2005-2015 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.uif.layout; 17 18 import java.util.List; 19 20 /** 21 * Layout manager interface for grid layouts. 22 * 23 * @author Kuali Rice Team (rice.collab@kuali.org) 24 */ 25 public interface GridLayoutManager extends LayoutManager { 26 27 /** 28 * Indicates the number of columns that should make up one row of data 29 * 30 * <p> 31 * If the item count is greater than the number of columns, a new row will 32 * be created to render the remaining items (and so on until all items are 33 * placed). 34 * </p> 35 * 36 * <p> 37 * Note this does not include any generated columns by the layout manager, 38 * so the final column count could be greater (if label fields are 39 * separate). 40 * </p> 41 * 42 * @return int 43 */ 44 int getNumberOfColumns(); 45 46 /** 47 * Setter for the number of columns (each row) 48 * 49 * @param numberOfColumns 50 */ 51 void setNumberOfColumns(int numberOfColumns); 52 53 /** 54 * Indicates whether the number of columns for the table data should match 55 * the number of fields given in the container's items list (so that each 56 * field takes up one column without wrapping), this overrides the configured 57 * numberOfColumns 58 * 59 * <p> 60 * If set to true during the initialize phase the number of columns will be 61 * set to the size of the container's field list, if false the configured 62 * number of columns is used 63 * </p> 64 * 65 * @return true if the column count should match the container's 66 * field count, false to use the configured number of columns 67 */ 68 boolean isSuppressLineWrapping(); 69 70 /** 71 * Setter for the suppressLineWrapping indicator 72 * 73 * @param suppressLineWrapping 74 */ 75 void setSuppressLineWrapping(boolean suppressLineWrapping); 76 77 /** 78 * Indicates whether alternating row styles should be applied 79 * 80 * <p> 81 * Indicator to layout manager templates to apply alternating row styles. 82 * See the configured template for the actual style classes used 83 * </p> 84 * 85 * @return true if alternating styles should be applied, false if 86 * all rows should have the same style 87 */ 88 boolean isApplyAlternatingRowStyles(); 89 90 /** 91 * Setter for the alternating row styles indicator 92 * 93 * @param applyAlternatingRowStyles 94 */ 95 void setApplyAlternatingRowStyles(boolean applyAlternatingRowStyles); 96 97 /** 98 * Indicates whether the manager should default the cell widths 99 * 100 * <p> 101 * If true, the manager will set the cell width by equally dividing by the 102 * number of columns 103 * </p> 104 * 105 * @return true if default cell widths should be applied, false if 106 * no defaults should be applied 107 */ 108 boolean isApplyDefaultCellWidths(); 109 110 /** 111 * Setter for the default cell width indicator 112 * 113 * @param applyDefaultCellWidths 114 */ 115 void setApplyDefaultCellWidths(boolean applyDefaultCellWidths); 116 117 /** 118 * Indicates whether the first cell of each row should be rendered as a header cell (th) 119 * 120 * <p> 121 * When this flag is turned on, the first cell for each row will be rendered as a header cell. If 122 * {@link #isRenderAlternatingHeaderColumns()} is false, the remaining cells for the row will be rendered 123 * as data cells, else they will alternate between cell headers 124 * </p> 125 * 126 * @return true if first cell of each row should be rendered as a header cell 127 */ 128 boolean isRenderRowFirstCellHeader(); 129 130 /** 131 * Setter for render first row column as header indicator 132 * 133 * @param renderRowFirstCellHeader 134 */ 135 void setRenderRowFirstCellHeader(boolean renderRowFirstCellHeader); 136 137 /** 138 * Indicates whether the first row of items rendered should all be rendered as table header (th) cells 139 * 140 * <p> 141 * Generally when using a grid layout all the cells will be tds or alternating th/td (with the label in the 142 * th cell). However in some cases it might be desired to display the labels in one row as table header cells (th) 143 * followed by a row with the corresponding fields in td cells. When this is enabled this type of layout is 144 * possible 145 * </p> 146 * 147 * @return true if first row should be rendered as header cells 148 */ 149 boolean isRenderFirstRowHeader(); 150 151 /** 152 * Setter for the first row as header indicator 153 * 154 * @param renderFirstRowHeader 155 */ 156 void setRenderFirstRowHeader(boolean renderFirstRowHeader); 157 158 /** 159 * Indicates whether header columns (th for tables) should be rendered for 160 * every other item (alternating) 161 * 162 * <p> 163 * If true the first cell of each row will be rendered as an header, with 164 * every other cell in the row as a header 165 * </p> 166 * 167 * @return true if alternating headers should be rendered, false if not 168 */ 169 boolean isRenderAlternatingHeaderColumns(); 170 171 /** 172 * Setter for the render alternating header columns indicator 173 * 174 * @param renderAlternatingHeaderColumns 175 */ 176 void setRenderAlternatingHeaderColumns(boolean renderAlternatingHeaderColumns); 177 178 /** 179 * List of styles for each row. 180 * 181 * <p>Each entry in the list gives the style for the row with the same index. This style will be added to 182 * the <tr> tag when the table rows are rendered in the grid.tag. This is used to store the styles for newly added lines 183 * and other special cases like the add item row.</p> 184 * 185 * @return list of styles for the rows 186 */ 187 List<String> getRowCssClasses(); 188 189 /** 190 * @see #getRowCssClasses() 191 */ 192 void setRowCssClasses(List<String> rowCssClasses); 193 194 /** 195 * List of data attributes for each row. 196 * 197 * <p>Each entry in the list gives the data attributes for the row with the same index. These data attributes will be added to 198 * the <tr> tag when the table rows are rendered in the grid.tag. This is used to store the data attributes for newly added lines 199 * and other special cases like the add item row.</p> 200 * 201 * @return list of styles for the rows 202 */ 203 List<String> getRowDataAttributes(); 204 205 /** 206 * @see #getRowDataAttributes() 207 */ 208 void setRowDataAttributes(List<String> rowDataAttributes); 209 210 }