src/main/java/org/efaps/ui/wicket/components/picker/PickerCallBack.java
@Override
    public void onClose(final AjaxRequestTarget _target)
    {
        final AbstractUIPageObject pageObject = (AbstractUIPageObject) this.pageReference.getPage()
                        .getDefaultModelObject();
        if (pageObject.isOpenedByPicker()) {
            final UIPicker picker = pageObject.getPicker();
            pageObject.setPicker(null);
            if (picker.isExecuted()) {
                final Map<String, Object> map = picker.getReturnMap();
                final boolean escape = escape(map);
                final StringBuilder js = new StringBuilder();
                final String value = (String) map.get(EFapsKey.PICKER_VALUE.getKey());
                if (value != null) {
                    js.append("require(['dojo/dom'], function(dom){\n")
                        .append("dom.byId('").append(this.targetMarkupId).append("').value ='")
                        .append(escape ? StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(value))
                                                    : value).append("';").append("});");
                }
                for (final String keyString : map.keySet()) {
                    // if the map contains a key that is not defined in this
                    // class it is assumed to be the name of a field
                    if (!(EFapsKey.PICKER_JAVASCRIPT.getKey().equals(keyString)
                                    || EFapsKey.PICKER_DEACTIVATEESCAPE.getKey().equals(keyString)
                                    || EFapsKey.PICKER_VALUE.getKey().equals(keyString))) {
                        final Object valueObj = map.get(keyString);
                        final String strValue;
                        final String strLabel;
                        if (valueObj instanceof String[] && ((String[]) valueObj).length == 2) {
                            strValue = escape && !((String[]) valueObj)[0].contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(((String[]) valueObj)[0])
                                            : ((String[]) valueObj)[0];
                            strLabel = escape && !((String[]) valueObj)[0].contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(((String[]) valueObj)[1])
                                            : ((String[]) valueObj)[1];
                        } else {
                            strValue = escape && !String.valueOf(valueObj).contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(String.valueOf(valueObj))
                                            : String.valueOf(valueObj);
                            strLabel = null;
                        }

                        js.append("eFapsSetFieldValue(")
                            .append(this.targetMarkupId == null ? 0 : "'" + this.targetMarkupId + "'").append(",'")
                            .append(keyString).append("',")
                            .append(strValue.contains("Array(") ? "" : "'")
                                        .append(strValue)
                                        .append(strValue.contains("Array(") ? "" : "'");
                        if (strLabel != null) {
                            js.append(",'").append(strLabel).append("'");
                        }
                        js.append(");");
                    }
                }
                if (map.containsKey(EFapsKey.PICKER_JAVASCRIPT.getKey())) {
                    js.append(map.get(EFapsKey.PICKER_JAVASCRIPT.getKey()));
                }
                _target.prependJavaScript(js.toString());
                picker.setExecuted(false);
            }
        }
    }
@Override
    public void onClose(final AjaxRequestTarget _target)
    {
        final AbstractUIPageObject pageObject = (AbstractUIPageObject) this.pageReference.getPage()
                        .getDefaultModelObject();
        if (pageObject.isOpenedByPicker()) {
            final UIPicker picker = pageObject.getPicker();
            pageObject.setPicker(null);
            if (picker.isExecuted()) {
                final Map<String, Object> map = picker.getReturnMap();
                final boolean escape = escape(map);
                final StringBuilder js = new StringBuilder();
                final String value = (String) map.get(EFapsKey.PICKER_VALUE.getKey());
                if (value != null) {
                    js.append("require(['dojo/dom'], function(dom){\n")
                        .append("dom.byId('").append(this.targetMarkupId).append("').value ='")
                        .append(escape ? StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(value))
                                                    : value).append("';").append("});");
                }
                for (final String keyString : map.keySet()) {
                    // if the map contains a key that is not defined in this
                    // class it is assumed to be the name of a field
                    if (!(EFapsKey.PICKER_JAVASCRIPT.getKey().equals(keyString)
                                    || EFapsKey.PICKER_DEACTIVATEESCAPE.getKey().equals(keyString)
                                    || EFapsKey.PICKER_VALUE.getKey().equals(keyString))) {
                        final Object valueObj = map.get(keyString);
                        final String strValue;
                        final String strLabel;
                        if (valueObj instanceof String[] && ((String[]) valueObj).length == 2) {
                            strValue = escape && !((String[]) valueObj)[0].contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(((String[]) valueObj)[0])
                                            : ((String[]) valueObj)[0];
                            strLabel = escape && !((String[]) valueObj)[0].contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(((String[]) valueObj)[1])
                                            : ((String[]) valueObj)[1];
                        } else {
                            strValue = escape && !String.valueOf(valueObj).contains("Array(")
                                            ? StringEscapeUtils.escapeEcmaScript(String.valueOf(valueObj))
                                            : String.valueOf(valueObj);
                            strLabel = null;
                        }

                        js.append("eFapsSetFieldValue(")
                            .append(this.targetMarkupId == null ? 0 : "'" + this.targetMarkupId + "'").append(",'")
                            .append(keyString).append("',")
                            .append(strValue.contains("Array(") ? "" : "'")
                                        .append(strValue)
                                        .append(strValue.contains("Array(") ? "" : "'");
                        if (strLabel != null) {
                            js.append(",'").append(strLabel).append("'");
                        }
                        js.append(");");
                    }
                }
                if (map.containsKey(EFapsKey.PICKER_JAVASCRIPT.getKey())) {
                    js.append(map.get(EFapsKey.PICKER_JAVASCRIPT.getKey()));
                }
                _target.prependJavaScript(js.toString());
                picker.setExecuted(false);
            }
        }
    }
The actual Javascript that will be executed on close of the modal window.
@param _target Target