FR [ 1670025 ] ModelValidator.afterLoadPreferences will be useful

http://sourceforge.net/tracker/index.php?func=detail&aid=1670025&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2007-04-16 10:36:01 +00:00
parent 18046bb44f
commit 2c568a2cca
2 changed files with 34 additions and 0 deletions

View File

@ -311,4 +311,36 @@ public class ModelValidationEngine
return sb.toString();
} // toString
/**
* After Load Preferences into Context for selected client.
* @param ctx context
* @see org.compiere.util.Login#loadPreferences(KeyNamePair, KeyNamePair, java.sql.Timestamp, String)
* @author Teo Sarca - FR [ 1670025 ] - https://sourceforge.net/tracker/index.php?func=detail&aid=1670025&group_id=176962&atid=879335
*/
public void afterLoadPreferences (Properties ctx)
{
int AD_Client_ID = Env.getAD_Client_ID(ctx);
for (int i = 0; i < m_validators.size(); i++)
{
ModelValidator validator = (ModelValidator)m_validators.get(i);
if (AD_Client_ID == validator.getAD_Client_ID())
{
java.lang.reflect.Method m = null;
try {
m = validator.getClass().getMethod("afterLoadPreferences", new Class[]{Properties.class});
}
catch(NoSuchMethodException e) {
// ignore
}
try {
if (m != null)
m.invoke(validator, ctx);
}
catch (Exception e) {
log.warning("" + validator + ": " + e.getLocalizedMessage());
}
}
}
}
} // ModelValidatorEngine

View File

@ -894,6 +894,8 @@ public class Login
Ini.saveProperties(Ini.isClient());
// Country
Env.setContext(m_ctx, "#C_Country_ID", MCountry.getDefault(m_ctx).getC_Country_ID());
// Call ModelValidators afterLoadPreferences - teo_sarca FR [ 1670025 ]
ModelValidationEngine.get().afterLoadPreferences(m_ctx);
return retValue;
} // loadPreferences