IDEMPIERE-2532:issue relate show dialog when run process

fix to show parameter dialog at center of info window
This commit is contained in:
hieplq 2015-03-28 01:30:55 +07:00
parent 829601a9f1
commit 72ae1269d1
2 changed files with 33 additions and 3 deletions

View File

@ -19,7 +19,12 @@ package org.adempiere.webui.apps;
import java.util.logging.Level;
import org.adempiere.util.IProcessUI;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.session.SessionManager;
import org.compiere.apps.AbstractProcessCtl;
import org.compiere.apps.IProcessParameter;
import org.compiere.model.MPInstance;
@ -28,6 +33,7 @@ import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@ -98,9 +104,30 @@ public class WProcessCtl extends AbstractProcessCtl {
{
//para.setWidth("500px");
para.setVisible(true);
para.setPosition("center");
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(para);
Object window = SessionManager.getAppDesktop().findWindow(WindowNo);
if (window != null && window instanceof Component && window instanceof ISupportMask){
final ISupportMask parent = LayoutUtils.showWindowWithMask(para, (Component)window, LayoutUtils.OVERLAP_PARENT);
para.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
parent.hideMask();
}
});
}else if (window != null && window instanceof Component){
final Mask mask = LayoutUtils.showWindowWithMask(para, (Component)window, null);
para.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
mask.hideMask();
}
});
}else{
para.setPosition("center");
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(para);
}
}
} // execute

View File

@ -19,6 +19,7 @@ import java.util.List;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.exception.ApplicationException;
@ -151,6 +152,8 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
}
/**
* when width of win set by stylesheet (css class or in style) win sometime don't in center.
* fix by find out method change to {@link LayoutUtils#openOverlappedWindow(org.zkoss.zk.ui.Component, org.zkoss.zul.Window, String)}
* @param win
* @param pos
*/