- 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 static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -171,6 +173,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
|
||||
private boolean m_parentNeedSave = false;
|
||||
|
||||
private long m_lastDataStatusEventTime;
|
||||
|
||||
private DataStatusEvent m_lastDataStatusEvent;
|
||||
|
||||
// Context property names:
|
||||
public static final String CTX_KeyColumnName = "KeyColumnName";
|
||||
public static final String CTX_LinkColumnName = "LinkColumnName";
|
||||
|
@ -891,7 +897,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
|
||||
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
||||
if (manualCmd)
|
||||
{
|
||||
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));
|
||||
|
||||
if (retValue) {
|
||||
|
@ -2148,6 +2162,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
}
|
||||
else // Redistribute Info with current row info
|
||||
fireDataStatusChanged(m_DataStatusEvent);
|
||||
|
||||
//reset
|
||||
m_lastDataStatusEventTime = System.currentTimeMillis();
|
||||
m_lastDataStatusEvent = m_DataStatusEvent;
|
||||
m_DataStatusEvent = null;
|
||||
// log.fine("dataStatusChanged #" + m_vo.TabNo + "- fini", e.toString());
|
||||
} // dataStatusChanged
|
||||
|
||||
|
@ -2164,6 +2183,16 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
// WHO Info
|
||||
if (e.getCurrentRow() >= 0)
|
||||
{
|
||||
updateDataStatusEventProperties(e);
|
||||
}
|
||||
e.setInserting(m_mTable.isInserting());
|
||||
// Distribute/fire it
|
||||
for (int i = 0; i < listeners.length; i++)
|
||||
listeners[i].dataStatusChanged(e);
|
||||
// log.fine("fini - " + e.toString());
|
||||
} // fireDataStatusChanged
|
||||
|
||||
private void updateDataStatusEventProperties(DataStatusEvent e) {
|
||||
e.Created = (Timestamp)getValue("Created");
|
||||
e.CreatedBy = (Integer)getValue("CreatedBy");
|
||||
e.Updated = (Timestamp)getValue("Updated");
|
||||
|
@ -2188,12 +2217,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
}
|
||||
e.Info = info.toString();
|
||||
}
|
||||
e.setInserting(m_mTable.isInserting());
|
||||
// Distribute/fire it
|
||||
for (int i = 0; i < listeners.length; i++)
|
||||
listeners[i].dataStatusChanged(e);
|
||||
// log.fine("fini - " + e.toString());
|
||||
} // fireDataStatusChanged
|
||||
|
||||
/**
|
||||
* Create and fire Data Status Error Event
|
||||
|
@ -2384,6 +2407,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
// inform VTable/.. -> rowChanged
|
||||
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
|
||||
if (m_DataStatusEvent == null)
|
||||
m_DataStatusEvent = new DataStatusEvent(this, getRowCount(),
|
||||
|
@ -2393,8 +2423,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
m_DataStatusEvent.setCurrentRow(m_currentRow);
|
||||
String status = m_DataStatusEvent.getAD_Message();
|
||||
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);
|
||||
|
||||
//reset
|
||||
m_DataStatusEvent = null;
|
||||
|
||||
return m_currentRow;
|
||||
} // setCurrentRow
|
||||
|
||||
|
|
Loading…
Reference in New Issue