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() { public String getLabel() {
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); MWindow win = new MWindow(getCtx(), getAD_Window_ID(), null);
String windowName = win.get_Translation("Name"); windowName = win.get_Translation("Name");
}
MTable table = MTable.get(getCtx(), getAD_Table_ID()); MTable table = MTable.get(getCtx(), getAD_Table_ID());
PO po = table.getPO(getRecord_ID(), null); PO po = table.getPO(getRecord_ID(), null);
if (po == null) { if (po == null) {

View File

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