[ adempiere-Bugs-2701189 ] ZK WebUI: Index error at certain tab grids

This commit is contained in:
Heng Sin Low 2009-03-22 00:35:49 +00:00
parent 9828f83382
commit 107b96d8cf
2 changed files with 12 additions and 5 deletions

View File

@ -151,8 +151,6 @@ public class GridPanel extends Borderlayout implements EventListener
* @param gridTab * @param gridTab
*/ */
public void refresh(GridTab gridTab) { public void refresh(GridTab gridTab) {
if (!gridTab.isOpen()) return;
if (this.gridTab != gridTab || !isInit()) if (this.gridTab != gridTab || !isInit())
{ {
init = false; init = false;
@ -169,9 +167,9 @@ public class GridPanel extends Borderlayout implements EventListener
* Update current row from model * Update current row from model
*/ */
public void updateListIndex() { public void updateListIndex() {
if (gridTab == null) return; if (gridTab == null || !gridTab.isOpen()) return;
int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1; int rowIndex = gridTab.getCurrentRow();
if (pageSize > 0) { if (pageSize > 0) {
if (paging.getTotalSize() != gridTab.getRowCount()) if (paging.getTotalSize() != gridTab.getRowCount())
paging.setTotalSize(gridTab.getRowCount()); paging.setTotalSize(gridTab.getRowCount());
@ -368,6 +366,9 @@ public class GridPanel extends Borderlayout implements EventListener
* Event after the current selected row change * Event after the current selected row change
*/ */
public void onPostSelectedRowChanged() { public void onPostSelectedRowChanged() {
if (listbox.getRows().getChildren().isEmpty())
return;
int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1; int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1;
if (rowIndex >= 0 && pageSize > 0) { if (rowIndex >= 0 && pageSize > 0) {
int pgIndex = rowIndex >= 0 ? rowIndex % pageSize : 0; int pgIndex = rowIndex >= 0 ? rowIndex % pageSize : 0;

View File

@ -671,7 +671,10 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
*/ */
public void query() public void query()
{ {
boolean open = gridTab.isOpen();
gridTab.query(false); gridTab.query(false);
if (listPanel.isVisible() && !open)
gridTab.getTableModel().fireTableDataChanged();
} }
/** /**
@ -682,7 +685,10 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
*/ */
public void query (boolean onlyCurrentRows, int onlyCurrentDays, int maxRows) public void query (boolean onlyCurrentRows, int onlyCurrentDays, int maxRows)
{ {
boolean open = gridTab.isOpen();
gridTab.query(onlyCurrentRows, onlyCurrentDays, maxRows); gridTab.query(onlyCurrentRows, onlyCurrentDays, maxRows);
if (listPanel.isVisible() && !open)
gridTab.getTableModel().fireTableDataChanged();
} }
/** /**