From fb4bfb1e01a77a55e4eb41890479cf51166b9362 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 12 Apr 2013 13:41:39 -0500 Subject: [PATCH] IDEMPIERE-454 Easy import - peer review --- .../adempiere/impexp/GridTabCSVImporter.java | 2 +- .../src/org/compiere/model/GridTable.java | 30 ++++++------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 90972c650c..2ce8decb12 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -1038,7 +1038,7 @@ public class GridTabCSVImporter implements IGridTabImporter } } } - gridTab.getTableModel().dataRequery(pquery.getWhereClause()); + gridTab.getTableModel().dataRequery(pquery.getWhereClause(), false, 0, false); if (isInsertMode()){ if(gridTab.getTableModel().getRowCount()>=1) logMsg = Msg.getMsg(Env.getCtx(), "AlreadyExists")+" "+pquery; diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index ac11629a43..9f3cc9dfa7 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -100,7 +100,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = 4727235099287761006L; + private static final long serialVersionUID = 5782826500266625861L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; @@ -2917,9 +2917,10 @@ public class GridTable extends AbstractTableModel * @param whereClause sql where clause * @param onlyCurrentRows only current rows * @param onlyCurrentDays how many days back + * @param fireEvents if tabledatachanged and datastatusievent must be fired * @return true if success */ - public boolean dataRequery (String whereClause, boolean onlyCurrentRows, int onlyCurrentDays) + public boolean dataRequery (String whereClause, boolean onlyCurrentRows, int onlyCurrentDays, boolean fireEvents) { if (log.isLoggable(Level.INFO)) log.info(whereClause + "; OnlyCurrent=" + onlyCurrentRows); close(false); @@ -2931,29 +2932,16 @@ public class GridTable extends AbstractTableModel m_changed = false; m_rowChanged = -1; m_inserting = false; - fireTableDataChanged(); - fireDataStatusIEvent(DATA_REFRESH_MESSAGE, ""); + if (fireEvents) { + fireTableDataChanged(); + fireDataStatusIEvent(DATA_REFRESH_MESSAGE, ""); + } return true; } // dataRequery - /** - * Requery with new whereClause - * @param whereClause sql where clause - * @return true if success - */ - public boolean dataRequery (String whereClause) + public boolean dataRequery (String whereClause, boolean onlyCurrentRows, int onlyCurrentDays) { - if (log.isLoggable(Level.INFO)) log.info(whereClause + "; OnlyCurrent=" + 0); - close(false); - m_onlyCurrentDays = 0; - setSelectWhereClause(whereClause,false, m_onlyCurrentDays); - open(m_maxRows); - // Info - m_rowData = null; - m_changed = false; - m_rowChanged = -1; - m_inserting = false; - return true; + return dataRequery (whereClause, onlyCurrentRows, onlyCurrentDays, true); } // dataRequery /**************************************************************************