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_UPDATE_COPIED_MESSAGE = "UpdateCopied";
public static final String DATA_INSERTED_MESSAGE = "Inserted";
/**
* JDBC Based Buffered Table
@ -2621,7 +2623,7 @@ public class GridTable extends AbstractTableModel
// inform
if (log.isLoggable(Level.FINE)) log.fine("Current=" + currentRow + ", New=" + 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");
return true;
} // dataNew

View File

@ -1337,7 +1337,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (!detailTab)
{
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;
if (logger.isLoggable(Level.INFO)) logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
@ -1361,13 +1368,20 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
sb.append(Env.getContext(ctx, curWindowNo, "_WinInfo_WindowName", false)).append(": ");
if (titleLogic.contains("<")) {
// IDEMPIERE-1328 - enable using format or subcolumns on title
if ( getADTab() != null
&& getADTab().getADTabpanel(0) != null
&& getADTab().getADTabpanel(0).getGridTab() != null
if ( getADTab() != null
&& getADTab().getADTabpanel(0) != null
&& getADTab().getADTabpanel(0).getGridTab() != null
&& getADTab().getADTabpanel(0).getGridTab().getTableModel() != null) {
GridTab tab = getADTab().getADTabpanel(0).getGridTab();
PO po = tab.getTableModel().getPO(tab.getCurrentRow());
titleLogic = Env.parseVariable(titleLogic, po, null, false);
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);
} else {
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
}
}
} else {
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);