- record info not working for new record https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2886944&group_id=176962 - status bar doesn't clear the last action message
This commit is contained in:
parent
6ecbef7398
commit
75764d4298
|
@ -90,6 +90,8 @@ import org.compiere.util.ValueNamePair;
|
||||||
*/
|
*/
|
||||||
public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
|
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -170,6 +172,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
protected CLogger log = CLogger.getCLogger(getClass());
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
|
||||||
private boolean m_parentNeedSave = false;
|
private boolean m_parentNeedSave = false;
|
||||||
|
|
||||||
|
private long m_lastDataStatusEventTime;
|
||||||
|
|
||||||
|
private DataStatusEvent m_lastDataStatusEvent;
|
||||||
|
|
||||||
// Context property names:
|
// Context property names:
|
||||||
public static final String CTX_KeyColumnName = "KeyColumnName";
|
public static final String CTX_KeyColumnName = "KeyColumnName";
|
||||||
|
@ -891,7 +897,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
||||||
if (manualCmd)
|
if (manualCmd)
|
||||||
|
{
|
||||||
setCurrentRow(m_currentRow, false);
|
setCurrentRow(m_currentRow, false);
|
||||||
|
if (m_lastDataStatusEvent != null && m_lastDataStatusEvent.getCurrentRow() == m_currentRow
|
||||||
|
&& ((m_lastDataStatusEvent.Record_ID != null && m_lastDataStatusEvent.Record_ID instanceof Integer
|
||||||
|
&& (Integer) m_lastDataStatusEvent.Record_ID == 0) || m_lastDataStatusEvent.Record_ID == null))
|
||||||
|
{
|
||||||
|
updateDataStatusEventProperties(m_lastDataStatusEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_SAVE));
|
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_SAVE));
|
||||||
|
|
||||||
if (retValue) {
|
if (retValue) {
|
||||||
|
@ -2148,6 +2162,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
}
|
}
|
||||||
else // Redistribute Info with current row info
|
else // Redistribute Info with current row info
|
||||||
fireDataStatusChanged(m_DataStatusEvent);
|
fireDataStatusChanged(m_DataStatusEvent);
|
||||||
|
|
||||||
|
//reset
|
||||||
|
m_lastDataStatusEventTime = System.currentTimeMillis();
|
||||||
|
m_lastDataStatusEvent = m_DataStatusEvent;
|
||||||
|
m_DataStatusEvent = null;
|
||||||
// log.fine("dataStatusChanged #" + m_vo.TabNo + "- fini", e.toString());
|
// log.fine("dataStatusChanged #" + m_vo.TabNo + "- fini", e.toString());
|
||||||
} // dataStatusChanged
|
} // dataStatusChanged
|
||||||
|
|
||||||
|
@ -2164,29 +2183,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
// WHO Info
|
// WHO Info
|
||||||
if (e.getCurrentRow() >= 0)
|
if (e.getCurrentRow() >= 0)
|
||||||
{
|
{
|
||||||
e.Created = (Timestamp)getValue("Created");
|
updateDataStatusEventProperties(e);
|
||||||
e.CreatedBy = (Integer)getValue("CreatedBy");
|
|
||||||
e.Updated = (Timestamp)getValue("Updated");
|
|
||||||
e.UpdatedBy = (Integer)getValue("UpdatedBy");
|
|
||||||
e.Record_ID = getValue(m_keyColumnName);
|
|
||||||
// Info
|
|
||||||
StringBuffer info = new StringBuffer(getTableName());
|
|
||||||
// We have a key column
|
|
||||||
if (m_keyColumnName != null && m_keyColumnName.length() > 0)
|
|
||||||
{
|
|
||||||
info.append(" - ")
|
|
||||||
.append(m_keyColumnName).append("=").append(e.Record_ID);
|
|
||||||
}
|
|
||||||
else // we have multiple parents
|
|
||||||
{
|
|
||||||
for (int i = 0; i < m_parents.size(); i++)
|
|
||||||
{
|
|
||||||
String keyCol = (String)m_parents.get(i);
|
|
||||||
info.append(" - ")
|
|
||||||
.append(keyCol).append("=").append(getValue(keyCol));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e.Info = info.toString();
|
|
||||||
}
|
}
|
||||||
e.setInserting(m_mTable.isInserting());
|
e.setInserting(m_mTable.isInserting());
|
||||||
// Distribute/fire it
|
// Distribute/fire it
|
||||||
|
@ -2195,6 +2192,32 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
// log.fine("fini - " + e.toString());
|
// log.fine("fini - " + e.toString());
|
||||||
} // fireDataStatusChanged
|
} // fireDataStatusChanged
|
||||||
|
|
||||||
|
private void updateDataStatusEventProperties(DataStatusEvent e) {
|
||||||
|
e.Created = (Timestamp)getValue("Created");
|
||||||
|
e.CreatedBy = (Integer)getValue("CreatedBy");
|
||||||
|
e.Updated = (Timestamp)getValue("Updated");
|
||||||
|
e.UpdatedBy = (Integer)getValue("UpdatedBy");
|
||||||
|
e.Record_ID = getValue(m_keyColumnName);
|
||||||
|
// Info
|
||||||
|
StringBuffer info = new StringBuffer(getTableName());
|
||||||
|
// We have a key column
|
||||||
|
if (m_keyColumnName != null && m_keyColumnName.length() > 0)
|
||||||
|
{
|
||||||
|
info.append(" - ")
|
||||||
|
.append(m_keyColumnName).append("=").append(e.Record_ID);
|
||||||
|
}
|
||||||
|
else // we have multiple parents
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_parents.size(); i++)
|
||||||
|
{
|
||||||
|
String keyCol = (String)m_parents.get(i);
|
||||||
|
info.append(" - ")
|
||||||
|
.append(keyCol).append("=").append(getValue(keyCol));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.Info = info.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and fire Data Status Error Event
|
* Create and fire Data Status Error Event
|
||||||
* @param AD_Message message
|
* @param AD_Message message
|
||||||
|
@ -2384,6 +2407,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
// inform VTable/.. -> rowChanged
|
// inform VTable/.. -> rowChanged
|
||||||
m_propertyChangeSupport.firePropertyChange(PROPERTY, oldCurrentRow, m_currentRow);
|
m_propertyChangeSupport.firePropertyChange(PROPERTY, oldCurrentRow, m_currentRow);
|
||||||
|
|
||||||
|
//check last data status event
|
||||||
|
long since = System.currentTimeMillis() - m_lastDataStatusEventTime;
|
||||||
|
if (since <= 500 && m_lastDataStatusEvent != null)
|
||||||
|
{
|
||||||
|
m_DataStatusEvent = m_lastDataStatusEvent;
|
||||||
|
}
|
||||||
|
|
||||||
// inform APanel/.. -> dataStatus with row updated
|
// inform APanel/.. -> dataStatus with row updated
|
||||||
if (m_DataStatusEvent == null)
|
if (m_DataStatusEvent == null)
|
||||||
m_DataStatusEvent = new DataStatusEvent(this, getRowCount(),
|
m_DataStatusEvent = new DataStatusEvent(this, getRowCount(),
|
||||||
|
@ -2393,8 +2423,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
m_DataStatusEvent.setCurrentRow(m_currentRow);
|
m_DataStatusEvent.setCurrentRow(m_currentRow);
|
||||||
String status = m_DataStatusEvent.getAD_Message();
|
String status = m_DataStatusEvent.getAD_Message();
|
||||||
if (status == null || status.length() == 0)
|
if (status == null || status.length() == 0)
|
||||||
m_DataStatusEvent.setInfo("NavigateOrUpdate", null, false,false);
|
m_DataStatusEvent.setInfo(DEFAULT_STATUS_MESSAGE, null, false,false);
|
||||||
fireDataStatusChanged(m_DataStatusEvent);
|
fireDataStatusChanged(m_DataStatusEvent);
|
||||||
|
|
||||||
|
//reset
|
||||||
|
m_DataStatusEvent = null;
|
||||||
|
|
||||||
return m_currentRow;
|
return m_currentRow;
|
||||||
} // setCurrentRow
|
} // setCurrentRow
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue