IDEMPIERE-2333 Tab title is changed wrongly in some cases
This commit is contained in:
parent
5643ac7375
commit
9d5e3413b3
|
@ -1348,7 +1348,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
if (Util.isEmpty(header))
|
||||
header = AEnv.getDialogHeader(Env.getCtx(), curWindowNo, prefix);
|
||||
|
||||
SessionManager.getAppDesktop().setTabTitle(header);
|
||||
SessionManager.getAppDesktop().setTabTitle(header, curWindowNo);
|
||||
}
|
||||
else if (adTabbox.getSelectedDetailADTabpanel() == null)
|
||||
{
|
||||
|
|
|
@ -212,7 +212,7 @@ public interface IDesktop extends UIPart {
|
|||
|
||||
public boolean isPendingWindow();
|
||||
|
||||
public void setTabTitle(String title);
|
||||
public void setTabTitle(String title, int windowNo);
|
||||
|
||||
public void renderHomeTab();
|
||||
}
|
||||
|
|
|
@ -397,8 +397,8 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
}
|
||||
}
|
||||
|
||||
public void setTabTitle(String title) {
|
||||
windowContainer.setTabTitle(title);
|
||||
public void setTabTitle(String title, int windowNo) {
|
||||
windowContainer.setTabTitle(title, windowNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.adempiere.webui.component.Tabbox;
|
|||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.adempiere.webui.component.Tabpanels;
|
||||
import org.adempiere.webui.component.Tabs;
|
||||
import org.adempiere.webui.desktop.TabbedDesktop;
|
||||
import org.adempiere.webui.panel.IHelpContext;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.model.X_AD_CtxHelp;
|
||||
|
@ -265,11 +266,38 @@ public class WindowContainer extends AbstractUIPart
|
|||
return tab;
|
||||
}
|
||||
|
||||
public void setTabTitle(String title) {
|
||||
setTabTitle(title, getSelectedTab());
|
||||
public void setTabTitle(String title, int windowNo) {
|
||||
setTabTitle(title, getTab(windowNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* IDEMPIERE-2333 / getTab - get the tab based on the windowNo
|
||||
* @param windowNo
|
||||
* @return org.zkoss.zul.Tab
|
||||
*/
|
||||
private org.zkoss.zul.Tab getTab(int windowNo) {
|
||||
org.zkoss.zul.Tabpanels panels = tabbox.getTabpanels();
|
||||
List<?> childrens = panels.getChildren();
|
||||
for (Object child : childrens)
|
||||
{
|
||||
Tabpanel panel = (Tabpanel) child;
|
||||
Component component = panel.getFirstChild();
|
||||
Object att = component != null ? component.getAttribute(TabbedDesktop.WINDOWNO_ATTRIBUTE) : null;
|
||||
if (att != null && (att instanceof Integer))
|
||||
{
|
||||
if (windowNo == (Integer)att)
|
||||
{
|
||||
org.zkoss.zul.Tab tab = panel.getLinkedTab();
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setTabTitle(String title, org.zkoss.zul.Tab tab) {
|
||||
if (tab == null)
|
||||
return;
|
||||
title = title.replaceAll("[&]", "");
|
||||
if (title.length() <= MAX_TITLE_LENGTH)
|
||||
{
|
||||
|
@ -278,7 +306,7 @@ public class WindowContainer extends AbstractUIPart
|
|||
else
|
||||
{
|
||||
tab.setTooltiptext(title);
|
||||
title = title.substring(0, 27) + "...";
|
||||
title = title.substring(0, MAX_TITLE_LENGTH-3) + "...";
|
||||
tab.setLabel(title);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue