1 18 package org.apache.beehive.netui.tags.databinding.datagrid; 19 20 import javax.servlet.jsp.JspContext ; 21 22 import org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel; 23 import org.apache.beehive.netui.databinding.datagrid.api.rendering.CellModel; 24 25 29 final class DataGridUtil { 30 31 private static final String KEY_GRID_MODEL = "dataGrid"; 32 private static final String KEY_CELL_MODEL = "cell"; 33 34 35 private DataGridUtil() {} 36 37 43 public static final DataGridTagModel getDataGridTagModel(JspContext jspContext) { 44 Object model = jspContext.getAttribute(KEY_GRID_MODEL); 45 assert model != null ? model instanceof DataGridTagModel : true; 46 return (DataGridTagModel)model; 47 } 48 49 55 public static final void putDataGridTagModel(JspContext jspContext, DataGridTagModel dataGridTagModel) { 56 jspContext.setAttribute(KEY_GRID_MODEL, dataGridTagModel); 57 } 58 59 63 public static final void removeDataGridTagModel(JspContext jspContext) { 64 jspContext.removeAttribute(KEY_GRID_MODEL); 65 } 66 67 73 public static final CellModel getCellModel(JspContext jspContext) { 74 Object model = jspContext.getAttribute(KEY_CELL_MODEL); 75 assert model != null ? model instanceof CellModel : true; 76 return (CellModel)model; 77 } 78 79 85 public static final void putCellModel(JspContext jspContext, CellModel cellModel) { 86 jspContext.setAttribute(KEY_CELL_MODEL, cellModel); 87 } 88 89 93 public static final void removeCellModel(JspContext jspContext) { 94 jspContext.removeAttribute(KEY_CELL_MODEL); 95 } 96 } 97 | Popular Tags |