IDEMPIERE-1328 Change tab name dynamically / fix issue reported by Claudemir about deleted records and empty tabs

This commit is contained in:
Carlos Ruiz 2015-08-19 07:37:26 -05:00
parent 679e2fd06a
commit 0f6e3abacf
2 changed files with 24 additions and 8 deletions

View File

@ -102,9 +102,11 @@ public class GridTable extends AbstractTableModel
/** /**
* *
*/ */
private static final long serialVersionUID = -4440415447489133947L; private static final long serialVersionUID = -3993077765244392901L;
public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_REFRESH_MESSAGE = "Refreshed";
public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied";
public static final String DATA_INSERTED_MESSAGE = "Inserted";
/** /**
* JDBC Based Buffered Table * JDBC Based Buffered Table
@ -2621,7 +2623,7 @@ public class GridTable extends AbstractTableModel
// inform // inform
if (log.isLoggable(Level.FINE)) log.fine("Current=" + currentRow + ", New=" + m_newRow); if (log.isLoggable(Level.FINE)) log.fine("Current=" + currentRow + ", New=" + m_newRow);
fireTableRowsInserted(m_newRow, m_newRow); fireTableRowsInserted(m_newRow, m_newRow);
fireDataStatusIEvent(copyCurrent ? "UpdateCopied" : "Inserted", ""); fireDataStatusIEvent(copyCurrent ? DATA_UPDATE_COPIED_MESSAGE : DATA_INSERTED_MESSAGE, "");
if (log.isLoggable(Level.FINE)) log.fine("Current=" + currentRow + ", New=" + m_newRow + " - complete"); if (log.isLoggable(Level.FINE)) log.fine("Current=" + currentRow + ", New=" + m_newRow + " - complete");
return true; return true;
} // dataNew } // dataNew

View File

@ -1337,7 +1337,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (!detailTab) if (!detailTab)
{ {
String dbInfo = e.getMessage(); String dbInfo = e.getMessage();
if (! prevdbInfo.equals(dbInfo)) { String adInfo = e.getAD_Message();
if ( ! prevdbInfo.equals(dbInfo)
&& ( GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
)
) {
prevdbInfo = dbInfo; prevdbInfo = dbInfo;
if (logger.isLoggable(Level.INFO)) logger.info(dbInfo); if (logger.isLoggable(Level.INFO)) logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive()) if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
@ -1366,8 +1373,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
&& getADTab().getADTabpanel(0).getGridTab() != null && getADTab().getADTabpanel(0).getGridTab() != null
&& getADTab().getADTabpanel(0).getGridTab().getTableModel() != null) { && getADTab().getADTabpanel(0).getGridTab().getTableModel() != null) {
GridTab tab = getADTab().getADTabpanel(0).getGridTab(); GridTab tab = getADTab().getADTabpanel(0).getGridTab();
PO po = tab.getTableModel().getPO(tab.getCurrentRow()); int row = tab.getCurrentRow();
int cnt = tab.getRowCount();
boolean inserting = tab.getTableModel().isInserting();
if (row >= 0 && cnt > 0 && !inserting) {
PO po = tab.getTableModel().getPO(row);
titleLogic = Env.parseVariable(titleLogic, po, null, false); titleLogic = Env.parseVariable(titleLogic, po, null, false);
} else {
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
}
} }
} else { } else {
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true); titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);