001/** 002 * Copyright 2005-2018 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.layout; 017 018import java.util.List; 019 020/** 021 * Layout manager interface for grid layouts. 022 * 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public interface GridLayoutManager extends LayoutManager { 026 027 /** 028 * Indicates the number of columns that should make up one row of data 029 * 030 * <p> 031 * If the item count is greater than the number of columns, a new row will 032 * be created to render the remaining items (and so on until all items are 033 * placed). 034 * </p> 035 * 036 * <p> 037 * Note this does not include any generated columns by the layout manager, 038 * so the final column count could be greater (if label fields are 039 * separate). 040 * </p> 041 * 042 * @return int 043 */ 044 int getNumberOfColumns(); 045 046 /** 047 * Setter for the number of columns (each row) 048 * 049 * @param numberOfColumns 050 */ 051 void setNumberOfColumns(int numberOfColumns); 052 053 /** 054 * Indicates whether the number of columns for the table data should match 055 * the number of fields given in the container's items list (so that each 056 * field takes up one column without wrapping), this overrides the configured 057 * numberOfColumns 058 * 059 * <p> 060 * If set to true during the initialize phase the number of columns will be 061 * set to the size of the container's field list, if false the configured 062 * number of columns is used 063 * </p> 064 * 065 * @return true if the column count should match the container's 066 * field count, false to use the configured number of columns 067 */ 068 boolean isSuppressLineWrapping(); 069 070 /** 071 * Setter for the suppressLineWrapping indicator 072 * 073 * @param suppressLineWrapping 074 */ 075 void setSuppressLineWrapping(boolean suppressLineWrapping); 076 077 /** 078 * Indicates whether alternating row styles should be applied 079 * 080 * <p> 081 * Indicator to layout manager templates to apply alternating row styles. 082 * See the configured template for the actual style classes used 083 * </p> 084 * 085 * @return true if alternating styles should be applied, false if 086 * all rows should have the same style 087 */ 088 boolean isApplyAlternatingRowStyles(); 089 090 /** 091 * Setter for the alternating row styles indicator 092 * 093 * @param applyAlternatingRowStyles 094 */ 095 void setApplyAlternatingRowStyles(boolean applyAlternatingRowStyles); 096 097 /** 098 * Indicates whether the manager should default the cell widths 099 * 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}