diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java index f2ea109029..7d758aa12a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -139,6 +139,24 @@ public final class LayoutUtils { Clients.response("_openPopupWindow_", new AuScript(window, script.toString())); } + /** + * position opened window relative to the ref component + * @param ref + * @param window + * @param position + */ + public static void positionWindow(Component ref, Window window, String position) { + StringBuilder script = new StringBuilder(); + script.append("_idempiere_popup_window('#") + .append(ref.getUuid()) + .append("','#") + .append(window.getUuid()) + .append("','") + .append(position) + .append("');"); + Clients.response("_openPopupWindow_", new AuScript(window, script.toString())); + } + /** * open popup window relative to the ref component * @param ref diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java index d6de09b1cc..3464d3f320 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java @@ -40,6 +40,7 @@ import org.compiere.util.Msg; 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.OpenEvent; /** * @author Sendy Yagambrum @@ -171,6 +172,7 @@ public class WLocationEditor extends WEditor implements EventListener, Pr @Override public void onEvent(Event event) throws Exception { + getComponent().getTextbox().focus(); m_value = ld.getValue(); // if (!ld.isChanged()) @@ -192,6 +194,14 @@ public class WLocationEditor extends WEditor implements EventListener, Pr setValue(ii); } }); + ld.addEventListener(Events.ON_OPEN, new EventListener() { + @Override + public void onEvent(OpenEvent event) throws Exception { + if (!event.isOpen()) { + ld.detach(); + } + } + }); ld.setTitle(null); LayoutUtils.openPopupWindow(getComponent(), ld); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index 0bc1684db1..83a07d74ba 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -582,6 +582,7 @@ public class WLocationDialog extends Window implements EventListener // refresh initLocation(); inCountryAction = false; + lstCountry.focus(); } // Region Changed else if (lstRegion.equals(event.getTarget())) @@ -594,6 +595,7 @@ public class WLocationDialog extends Window implements EventListener m_location.setCity(null); // refresh initLocation(); + lstRegion.focus(); } } @@ -701,6 +703,7 @@ public class WLocationDialog extends Window implements EventListener } super.dispose(); } + /** returns a string that contains all fields of current form */ String getFullAdress() {