IDEMPIERE-1236 Recent Items - Names do not reflect definitions from Window Customization

This commit is contained in:
Carlos Ruiz 2013-08-08 18:00:22 -05:00
parent d45691b141
commit 51c8295228
2 changed files with 15 additions and 6 deletions

View File

@ -276,8 +276,14 @@ public class MRecentItem extends X_AD_RecentItem
}
public String getLabel() {
MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null);
String windowName = win.get_Translation("Name");
String windowName;
MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID());
if (userDef != null) {
windowName = userDef.getName();
} else {
MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null);
windowName = win.get_Translation("Name");
}
MTable table = MTable.get(getCtx(), getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), null);
if (po == null) {

View File

@ -108,9 +108,8 @@ public class MUserDefWin extends X_AD_UserDef_Win
{
// Check Cache
Integer key = new Integer(window_ID);
MUserDefWin retValue = (MUserDefWin)s_cache.get(key);
if (retValue != null)
return retValue;
if (s_cache.containsKey(key))
return s_cache.get(key);
// parameters
final int AD_Org_ID = Env.getAD_Org_ID(ctx);
@ -122,8 +121,10 @@ public class MUserDefWin extends X_AD_UserDef_Win
// candidates
MUserDefWin[] candidates = getAll(ctx, window_ID);
if (candidates == null)
if (candidates == null) {
s_cache.put(key, null);
return null;
}
final int size = candidates.length;
int[] weight = new int[size];
@ -177,10 +178,12 @@ public class MUserDefWin extends X_AD_UserDef_Win
}
if (weight[maxindex] > -1) {
MUserDefWin retValue = null;
retValue=candidates[maxindex];
s_cache.put(key, retValue);
return retValue;
} else {
s_cache.put(key, null);
return null;
}
}