[ 1699826 ] Process Parameters Panel overwrites window context

http://sourceforge.net/tracker/index.php?func=detail&aid=1699826&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2007-04-26 08:03:28 +00:00
parent 2d7ef6d21e
commit 0c004aaf8e
3 changed files with 57 additions and 0 deletions

View File

@ -1163,13 +1163,22 @@ public class GridField
|| m_vo.displayType == DisplayType.RowID)
; // ignore
else if (newValue instanceof Boolean)
{
backupValue(); // teo_sarca [ 1699826 ]
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
((Boolean)newValue).booleanValue());
}
else if (newValue instanceof Timestamp)
{
backupValue(); // teo_sarca [ 1699826 ]
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
}
else
{
backupValue(); // teo_sarca [ 1699826 ]
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
m_value==null ? null : m_value.toString());
}
// Does not fire, if same value
Object oldValue = m_oldValue;
@ -1506,4 +1515,35 @@ public class GridField
}
return result;
}
/** Initial context value for this field - teo_sarca [ 1699826 ] */
private String m_backupValue = null;
/** Is the initial context value for this field backup ? - teo_sarca [ 1699826 ] */
private boolean m_isBackupValue = false;
/**
* Backup the context value
* @author teo_sarca [ 1699826 ]
*/
private final void backupValue() {
if (!m_isBackupValue) {
m_backupValue = Env.getContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName);
if (CLogMgt.isLevelFinest())
log.finest("Backup " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
m_isBackupValue = true;
}
}
/**
* Restore the backup value if any
* @author teo_sarca [ 1699826 ]
*/
public void restoreValue() {
if (m_isBackupValue) {
if (CLogMgt.isLevelFinest())
log.finest("Restore " + m_vo.WindowNo + "|" + m_vo.ColumnName + "=" + m_backupValue);
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, m_backupValue);
}
}
} // MField

View File

@ -191,6 +191,7 @@ public class ProcessModalDialog extends CDialog
public void dispose()
{
m_valid = false;
parameterPanel.restoreContext(); // teo_sarca [ 1699826 ]
super.dispose();
} // dispose

View File

@ -442,5 +442,21 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
return true;
} // saveParameters
/**
* Restore window context.
* @author teo_sarca [ 1699826 ]
* @see org.compiere.model.GridField#restoreValue()
*/
protected void restoreContext() {
for (GridField f : m_mFields) {
if (f != null)
f.restoreValue();
}
for (GridField f : m_mFields2) {
if (f != null)
f.restoreValue();
}
}
} // ProcessParameterPanel