[ 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:
parent
2d7ef6d21e
commit
0c004aaf8e
|
@ -1163,13 +1163,22 @@ public class GridField
|
||||||
|| m_vo.displayType == DisplayType.RowID)
|
|| m_vo.displayType == DisplayType.RowID)
|
||||||
; // ignore
|
; // ignore
|
||||||
else if (newValue instanceof Boolean)
|
else if (newValue instanceof Boolean)
|
||||||
|
{
|
||||||
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
||||||
((Boolean)newValue).booleanValue());
|
((Boolean)newValue).booleanValue());
|
||||||
|
}
|
||||||
else if (newValue instanceof Timestamp)
|
else if (newValue instanceof Timestamp)
|
||||||
|
{
|
||||||
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, (Timestamp)m_value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
backupValue(); // teo_sarca [ 1699826 ]
|
||||||
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName,
|
||||||
m_value==null ? null : m_value.toString());
|
m_value==null ? null : m_value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// Does not fire, if same value
|
// Does not fire, if same value
|
||||||
Object oldValue = m_oldValue;
|
Object oldValue = m_oldValue;
|
||||||
|
@ -1506,4 +1515,35 @@ public class GridField
|
||||||
}
|
}
|
||||||
return result;
|
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
|
} // MField
|
||||||
|
|
|
@ -191,6 +191,7 @@ public class ProcessModalDialog extends CDialog
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
|
parameterPanel.restoreContext(); // teo_sarca [ 1699826 ]
|
||||||
super.dispose();
|
super.dispose();
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
|
|
|
@ -442,5 +442,21 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // saveParameters
|
} // 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
|
} // ProcessParameterPanel
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue