IDEMPIERE-900 How To text vanishes after clicking on the Lookup icon - move the send event code from InfoPanel.dispose to WSearchEditor

This commit is contained in:
Elaine Tan 2013-05-03 15:45:51 +08:00
parent 4f9e09c0ca
commit 86ab9b3493
6 changed files with 24 additions and 48 deletions

View File

@ -210,7 +210,7 @@ public class ADWindowContent extends AbstractADWindowContent
}
}
static class ADWindowVlayout extends Vlayout {
public static class ADWindowVlayout extends Vlayout {
/**
* generated serial id
*/

View File

@ -33,7 +33,6 @@ import org.adempiere.webui.apps.graph.WPerformanceDetail;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.dashboard.DashboardPanel;
import org.adempiere.webui.dashboard.DashboardRunnable;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.report.HTMLExtension;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
@ -48,7 +47,6 @@ import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess;
import org.compiere.model.MSysConfig;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -104,8 +102,6 @@ public class DashboardController implements EventListener<Event> {
maximizedHolder = new Anchorchildren();
maximizedHolder.setAnchor("100% 100%");
maximizedHolder.setStyle("overflow: hidden; border: none; margin: 0; padding: 0;");
dashboardLayout.addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
}
public void render(Component parent, IDesktop desktopImpl, boolean isShowInDashboard) {
@ -490,9 +486,6 @@ public class DashboardController implements EventListener<Event> {
}
}
}
else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) {
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
}
private void createDashboardPreference()

View File

@ -67,6 +67,12 @@ public interface IDesktop extends UIPart {
* @return boolean
*/
public boolean closeActiveWindow();
/**
* get active window
* @return Component
*/
public Component getActiveWindow();
/**
*

View File

@ -31,7 +31,10 @@ import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.adwindow.ADTabpanel;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.adwindow.IFieldEditorContainer;
import org.adempiere.webui.adwindow.ADWindowContent.ADWindowVlayout;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.apps.wf.WFPanel;
import org.adempiere.webui.component.Searchbox;
import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener;
@ -41,16 +44,20 @@ import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.grid.WQuickEntry;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.window.WFieldRecordInfo;
import org.adempiere.webui.window.WTask;
import org.compiere.model.GridField;
import org.compiere.model.Lookup;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@ -564,6 +571,13 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
@Override
public void onEvent(Event event) throws Exception {
Component component = SessionManager.getAppDesktop().getActiveWindow();
if (component instanceof ADWindowVlayout || component instanceof ADForm || component instanceof ProcessDialog
|| component instanceof InfoPanel || component instanceof WFPanel || component instanceof WTask)
Events.sendEvent(new Event(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, component));
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
boolean cancelled = ip.isCancelled();
Object[] result = ip.getSelectedKeys();

View File

@ -33,11 +33,8 @@ import java.util.Vector;
import java.util.logging.Level;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.apps.wf.WFPanel;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.ListModelTable;
import org.adempiere.webui.component.WListItemRenderer;
@ -52,7 +49,6 @@ import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.part.ITabOnSelectHandler;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.WTask;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.I_A_Asset;
@ -75,18 +71,15 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Anchorlayout;
import org.zkoss.zul.Listhead;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Vlayout;
import org.zkoss.zul.event.ZulEvents;
import org.zkoss.zul.ext.Sortable;
@ -1324,35 +1317,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
if (Window.MODE_EMBEDDED.equals(getAttribute(Window.MODE_KEY)))
SessionManager.getAppDesktop().closeActiveWindow();
else
{
if (getWindowNo() > 0)
{
Object window = SessionManager.getAppDesktop().findWindow(getWindowNo());
Component component = null;
if (window instanceof ADWindow)
{
ADWindow w = (ADWindow) window;
component = w.getADWindowContent().getComponent();
}
else if (window instanceof ADForm || window instanceof ProcessDialog || window instanceof InfoPanel
|| window instanceof WFPanel || window instanceof WTask)
{
component = (Component) window;
}
if (component != null &&
(component instanceof Vlayout || component instanceof ADForm || component instanceof ProcessDialog
|| component instanceof InfoPanel || component instanceof Anchorlayout
|| component instanceof WFPanel || component instanceof WTask))
Events.sendEvent(new Event(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, component));
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
}
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);
this.detach();
}
} // dispose
public void sort(Comparator<Object> cmpr, boolean ascending) {

View File

@ -13,6 +13,7 @@
package org.adempiere.webui.part;
import org.adempiere.webui.adwindow.ADWindowContent.ADWindowVlayout;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.apps.wf.WFPanel;
import org.adempiere.webui.component.Tab;
@ -30,8 +31,6 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.SwipeEvent;
import org.zkoss.zul.Anchorlayout;
import org.zkoss.zul.Vlayout;
/**
*
@ -152,9 +151,8 @@ public class WindowContainer extends AbstractUIPart
handler.onSelect();
}
if (component instanceof Vlayout || component instanceof ADForm || component instanceof ProcessDialog
|| component instanceof InfoPanel || component instanceof Anchorlayout
|| component instanceof WFPanel || component instanceof WTask)
if (component instanceof ADWindowVlayout || component instanceof ADForm || component instanceof ProcessDialog
|| component instanceof InfoPanel || component instanceof WFPanel || component instanceof WTask)
Events.sendEvent(new Event(ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, component));
else
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Home, 0);