IDEMPIERE-454 Easy import / Improvements (speed, export selected detail tab, bug fixes)
This commit is contained in:
parent
d6179e6297
commit
f6d907ff63
|
@ -32,7 +32,7 @@ public interface IGridTabExporter {
|
|||
* @param isCurrentRowOnly
|
||||
* @param file
|
||||
*/
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean isCurrentRowOnly, File file);
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean isCurrentRowOnly, File file, int indxDetailSelected);
|
||||
|
||||
/**
|
||||
* @return file extension
|
||||
|
|
|
@ -69,7 +69,7 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
private static CLogger log = CLogger.getCLogger(GridTabCSVExporter.class);
|
||||
|
||||
@Override
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file) {
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file,int indxDetailSelected) {
|
||||
|
||||
ICsvMapWriter mapWriter = null;
|
||||
Map<GridTab,GridField[]> tabMapDetails = new HashMap<GridTab, GridField[]>();
|
||||
|
@ -130,6 +130,9 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
int numOfTabs=0;
|
||||
for(GridTab detail: childs){
|
||||
|
||||
if(indxDetailSelected != detail.getTabNo())
|
||||
continue;
|
||||
|
||||
if(!detail.isDisplayed())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -459,12 +459,11 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
|
||||
if(isInsertMode())
|
||||
logMsg = Msg.getMsg(Env.getCtx(), "Inserted")+" "+ po.toString();
|
||||
else
|
||||
else{
|
||||
logMsg = Msg.getMsg(Env.getCtx(), "Updated")+" "+ po.toString();
|
||||
|
||||
//if it's parent record and there are details, parent needs to be refreshed
|
||||
if(currentGridTab.equals(gridTab) && sortedtTabMapIndexes.size()>1)
|
||||
currentGridTab.dataRefresh(false);
|
||||
currentGridTab.dataRefresh(true);
|
||||
}
|
||||
} else {
|
||||
ValueNamePair ppE = CLogger.retrieveWarning();
|
||||
if (ppE==null)
|
||||
|
@ -482,11 +481,17 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
|
||||
if(currentGridTab.equals(gridTab) && masterRecord==null){
|
||||
isMasterok = false;
|
||||
rowResult.append("<"+currentGridTab.getTableName()+">: ");
|
||||
rowResult.append(logMsg);
|
||||
rowResult.append(" / ");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!currentGridTab.equals(gridTab) && masterRecord!=null){
|
||||
isDetailok = false;
|
||||
rowResult.append("<"+currentGridTab.getTableName()+">: ");
|
||||
rowResult.append(logMsg);
|
||||
rowResult.append(" / ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +548,6 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
row =row.replaceAll("Inserted","RolledBack");
|
||||
logFileW.write(row);
|
||||
}
|
||||
gridTab.dataRefreshAll();
|
||||
}else{
|
||||
if(isThereDocAction){
|
||||
|
||||
|
@ -581,14 +585,14 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
|
||||
if(masterRecord!=null){
|
||||
gridTab.getTableModel().dataRequery(masterRecord.get_WhereClause(true),false,0,false);
|
||||
gridTab.navigateCurrent();
|
||||
gridTab.query(false);
|
||||
gridTab.getTableModel().setImportingMode(false,null);
|
||||
|
||||
for(GridTab detail: childs)
|
||||
if(detail.getTableModel().isOpen())
|
||||
if(detail.getTableModel().isOpen()){
|
||||
detail.query(true);
|
||||
detail.getTableModel().setImportingMode(false,null);
|
||||
}
|
||||
}
|
||||
trx.close();
|
||||
trx=null;
|
||||
}
|
||||
|
@ -1227,7 +1231,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
if (isUpdateMode()){
|
||||
if(gridTab.getTableModel().getRowCount()==1){
|
||||
gridTab.navigateRelative(gridTab.getCurrentRow());
|
||||
gridTab.navigateCurrent();
|
||||
return null;
|
||||
}
|
||||
else if(gridTab.getTableModel().getRowCount()<=0)
|
||||
|
@ -1237,7 +1241,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
if (isMergeMode()){
|
||||
if(gridTab.getTableModel().getRowCount()==1){
|
||||
gridTab.navigateRelative(gridTab.getCurrentRow());
|
||||
gridTab.navigateCurrent();
|
||||
m_import_mode = IMPORT_MODE_UPDATE;
|
||||
}else if(gridTab.getTableModel().getRowCount()<=0)
|
||||
m_import_mode = IMPORT_MODE_INSERT;
|
||||
|
|
|
@ -153,7 +153,7 @@ public class GridTabExcelExporter extends AbstractExcelExporter implements IGrid
|
|||
}
|
||||
|
||||
@Override
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file) {
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file,int indxDetailSelected) {
|
||||
m_tab = gridTab;
|
||||
setCurrentRowOnly(currentRowOnly);
|
||||
try {
|
||||
|
|
|
@ -2822,7 +2822,7 @@ public class GridTable extends AbstractTableModel
|
|||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql,get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
// only one row
|
||||
if (rs.next())
|
||||
|
@ -3681,7 +3681,7 @@ public class GridTable extends AbstractTableModel
|
|||
String sql = "SELECT " + columns + " FROM " + m_tableName + " WHERE " + m_tableName + "_ID=?";
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getKeyID(row));
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
|
@ -3717,8 +3717,12 @@ public class GridTable extends AbstractTableModel
|
|||
if (hasProcessed) {
|
||||
Boolean memProcessed = null;
|
||||
memProcessed = (Boolean) getOldValue(row, colProcessed);
|
||||
if (memProcessed == null)
|
||||
if (memProcessed == null){
|
||||
if(getValueAt(row, colProcessed) instanceof Boolean )
|
||||
memProcessed = (Boolean) getValueAt(row, colProcessed);
|
||||
else if (getValueAt(row, colProcessed) instanceof String )
|
||||
memProcessed = Boolean.valueOf((String)getValueAt(row, colProcessed));
|
||||
}
|
||||
|
||||
Boolean dbProcessed = Boolean.TRUE;
|
||||
if (! dbProcessedS.equals("Y"))
|
||||
|
|
|
@ -43,7 +43,7 @@ public class GridTab2PackExporter implements IGridTabExporter {
|
|||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file) {
|
||||
public void export(GridTab gridTab, List<GridTab> childs, boolean currentRowOnly, File file,int indxDetailSelected) {
|
||||
String tableName = gridTab.getTableName();
|
||||
PackOut packOut = new PackOut();
|
||||
packOut.setCtx(Env.getCtx());
|
||||
|
|
|
@ -160,6 +160,6 @@ public class AExport
|
|||
childs.add(gc.getMTab());
|
||||
}
|
||||
|
||||
exporter.export(tab, childs, currentRowOnly, outFile);
|
||||
exporter.export(tab, childs, currentRowOnly, outFile,0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ ContextMenuListener, IZoomableEditor
|
|||
//still not in list, reset to zero
|
||||
if (!getComponent().isSelected(value))
|
||||
{
|
||||
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID) // for IDs is ok to be out of the list
|
||||
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID && !gridTab.getTableModel().isImporting()) // for IDs is ok to be out of the list
|
||||
{
|
||||
getComponent().setValue(null);
|
||||
if (curValue == null)
|
||||
|
|
|
@ -206,7 +206,11 @@ public class ExportAction implements EventListener<Event>
|
|||
childs.add(adTabPanel.getGridTab());
|
||||
}
|
||||
|
||||
exporter.export(panel.getActiveGridTab(), childs, currentRowOnly, file);
|
||||
int indxDetailSelected = 0;
|
||||
if( adTab.getSelectedDetailADTabpanel()!=null )
|
||||
indxDetailSelected = adTab.getSelectedDetailADTabpanel().getGridTab().getTabNo();
|
||||
|
||||
exporter.export(panel.getActiveGridTab(), childs, currentRowOnly,file,indxDetailSelected);
|
||||
|
||||
winExportFile.onClose();
|
||||
winExportFile = null;
|
||||
|
|
Loading…
Reference in New Issue