1 15 package org.apache.tapestry.contrib.table.components; 16 17 import org.apache.tapestry.IRequestCycle; 18 import org.apache.tapestry.contrib.table.model.ITableModelSource; 19 import org.apache.tapestry.event.PageBeginRenderListener; 20 import org.apache.tapestry.event.PageDetachListener; 21 import org.apache.tapestry.event.PageEvent; 22 23 44 public abstract class TableFormPages extends TablePages 45 implements PageDetachListener, PageBeginRenderListener 46 { 47 private int m_nCurrentPage; 48 private int m_nPageCount; 49 private int m_nStartPage; 50 private int m_nStopPage; 51 52 public TableFormPages() 53 { 54 initialize(); 55 } 56 57 60 public void pageDetached(PageEvent event) 61 { 62 initialize(); 63 } 64 65 68 public void pageBeginRender(PageEvent event) 69 { 70 initialize(); 72 } 73 74 78 private void initialize() 79 { 80 m_nCurrentPage = -1; 81 m_nPageCount = -1; 82 m_nStartPage = -1; 83 m_nStopPage = -1; 84 } 85 86 public void changePage(IRequestCycle objCycle) 88 { 89 ITableModelSource objSource = getTableModelSource(); 90 setCurrentPage(objSource, getSelectedPage()); 91 92 objSource.fireObservedStateChange(); 94 } 95 96 public abstract int getSelectedPage(); 98 99 100 103 public int getCurrentPage() 104 { 105 if (m_nCurrentPage < 0) 106 m_nCurrentPage = super.getCurrentPage(); 107 return m_nCurrentPage; 108 } 109 110 113 public int getPageCount() 114 { 115 if (m_nPageCount < 0) 116 m_nPageCount = super.getPageCount(); 117 return m_nPageCount; 118 } 119 120 123 public int getStartPage() 124 { 125 if (m_nStartPage < 0) 126 m_nStartPage = super.getStartPage(); 127 return m_nStartPage; 128 } 129 130 133 public int getStopPage() 134 { 135 if (m_nStopPage < 0) 136 m_nStopPage = super.getStopPage(); 137 return m_nStopPage; 138 } 139 140 143 public void setCurrentPage(int i) 144 { 145 m_nCurrentPage = i; 146 } 147 148 151 public void setPageCount(int i) 152 { 153 m_nPageCount = i; 154 } 155 156 159 public void setStartPage(int i) 160 { 161 m_nStartPage = i; 162 } 163 164 167 public void setStopPage(int i) 168 { 169 m_nStopPage = i; 170 } 171 172 } 173 | Popular Tags |