1 15 package org.apache.tapestry.contrib.table.components; 16 17 import java.io.Serializable ; 18 19 import org.apache.tapestry.contrib.table.model.ITableModel; 20 import org.apache.tapestry.contrib.table.model.ITableSessionStateManager; 21 import org.apache.tapestry.contrib.table.model.simple.SimpleTableState; 22 23 30 public class TableViewSessionStateManager implements ITableSessionStateManager 31 { 32 private TableView m_objView; 33 34 public TableViewSessionStateManager(TableView objView) 35 { 36 m_objView = objView; 37 } 38 39 42 public Serializable getSessionState(ITableModel objModel) 43 { 44 if (m_objView.getCachedTableModelValue() != null) 48 return (Serializable ) objModel; 49 50 return new SimpleTableState(objModel.getPagingState(), objModel.getSortingState()); 52 } 53 54 57 public ITableModel recreateTableModel(Serializable objState) 58 { 59 if (objState instanceof ITableModel) 62 return (ITableModel) objState; 63 64 return m_objView.generateTableModel((SimpleTableState) objState); 66 } 67 68 } 69 | Popular Tags |