IDEMPIERE-750 Zk Address Editor: Address editor popup auto close after changes to state or country.
This commit is contained in:
parent
9cda551825
commit
63d373c71f
|
@ -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
|
||||
|
|
|
@ -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<Event>, 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<Event>, Pr
|
|||
setValue(ii);
|
||||
}
|
||||
});
|
||||
ld.addEventListener(Events.ON_OPEN, new EventListener<OpenEvent>() {
|
||||
@Override
|
||||
public void onEvent(OpenEvent event) throws Exception {
|
||||
if (!event.isOpen()) {
|
||||
ld.detach();
|
||||
}
|
||||
}
|
||||
});
|
||||
ld.setTitle(null);
|
||||
LayoutUtils.openPopupWindow(getComponent(), ld);
|
||||
}
|
||||
|
|
|
@ -582,6 +582,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
|||
// 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<Event>
|
|||
m_location.setCity(null);
|
||||
// refresh
|
||||
initLocation();
|
||||
lstRegion.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,6 +703,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
|||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/** returns a string that contains all fields of current form */
|
||||
String getFullAdress()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue