IDEMPIERE-3340 : Adaxa's User Favorite which allow user to organize their menu, create folders (#1304)
Menu items should use names defined in AD_UserDef... tables
This commit is contained in:
parent
36158fdbc4
commit
ac38581265
|
@ -26,6 +26,7 @@ import java.util.logging.Level;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.idempiere.cache.ImmutableIntPOCache;
|
||||
import org.idempiere.cache.ImmutablePOSupport;
|
||||
|
||||
|
@ -44,8 +45,7 @@ public class MMenu extends X_AD_Menu implements ImmutablePOSupport
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5999216946208895291L;
|
||||
|
||||
private static final long serialVersionUID = 8157805998814206274L;
|
||||
/** Cache */
|
||||
private static ImmutableIntPOCache<Integer, MMenu> s_cache = new ImmutableIntPOCache<Integer, MMenu>(Table_Name, 50);
|
||||
|
||||
|
@ -260,4 +260,34 @@ public class MMenu extends X_AD_Menu implements ImmutablePOSupport
|
|||
return this;
|
||||
}
|
||||
|
||||
/** Returns the name using UserDef module ; if nothing is defined, fallback to the translated name */
|
||||
public String getDisplayedName() {
|
||||
|
||||
if (!Util.isEmpty(getAction())) {
|
||||
if (ACTION_Window.equals(getAction())) {
|
||||
MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID());
|
||||
if (userDef != null) {
|
||||
if (userDef.getName() != null)
|
||||
return userDef.getName();
|
||||
}
|
||||
}
|
||||
else if (ACTION_Process.equals(getAction()) || ACTION_Report.equals(getAction())) {
|
||||
MUserDefProc userDef = MUserDefProc.getBestMatch(getCtx(), getAD_Process_ID());
|
||||
if (userDef != null) {
|
||||
if (userDef.getName() != null)
|
||||
return userDef.getName();
|
||||
}
|
||||
}
|
||||
else if (ACTION_Info.equals(getAction())) {
|
||||
MUserDefInfo userDef = MUserDefInfo.getBestMatch(getCtx(), getAD_InfoWindow_ID());
|
||||
if (userDef != null) {
|
||||
if (userDef.getName() != null)
|
||||
return userDef.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return get_Translation(MMenu.COLUMNNAME_Name);
|
||||
}
|
||||
|
||||
} // MMenu
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MTreeFavorite extends X_AD_Tree_Favorite
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1781192037651191816L;
|
||||
private static final long serialVersionUID = 6849737702264230347L;
|
||||
|
||||
public static final String SQL_GET_TREE_FAVORITE_ID = "SELECT AD_Tree_Favorite_ID FROM AD_Tree_Favorite WHERE IsActive='Y' AND AD_User_ID=?";
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class MTreeFavorite extends X_AD_Tree_Favorite
|
|||
|
||||
if (access != null)
|
||||
{
|
||||
name = menu.get_Translation(MMenu.COLUMNNAME_Name);
|
||||
name = menu.getDisplayedName();
|
||||
img = menu.getAction();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
if (favNode.getAD_Menu_ID() > 0)
|
||||
{
|
||||
MMenu menu = (MMenu) MTable.get(Env.getCtx(), MMenu.Table_ID).getPO(favNode.getAD_Menu_ID(), null);
|
||||
name = menu.get_Translation(MMenu.COLUMNNAME_Name);
|
||||
name = menu.getDisplayedName();
|
||||
action = menu.getAction();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue