/** * adds close handler to initializer script, if use of close handler has been defined. * * @param markupId markup id * @param script base script to prepend * @return close handler script */ private String addCloseHandlerScript(final String markupId, final String script) { if (closeBehavior != null) { return script + ";$('#" + markupId + "').on('hidden', function () { " + " Wicket.Ajax.ajax({'u':'" + closeBehavior.getCallbackUrl() + "','c':'" + markupId + "'});" + "})"; } return script; }
/** * adds close handler to initializer script, if use of close handler has been defined. * * @param markupId markup id * @param script base script to prepend * @return close handler script */ private String addCloseHandlerScript(final String markupId, final String script) { if (closeBehavior != null) { return script + ";$('#" + markupId + "').on('hidden', function () { " + " Wicket.Ajax.ajax({'u':'" + closeBehavior.getCallbackUrl() + "','c':'" + markupId + "'});" + "})"; } return script; } //--------------------------------------------------------
/** * adds close handler to initializer script, if use of close handler has been defined. * * @param markupId markup id * @param script base script to prepend * @return close handler script */ private String addCloseHandlerScript(final String markupId, final String script) { if (useCloseHandler.getObject()) { return script + ";$('#" + markupId + "').on('hidden', function () { " + " Wicket.Ajax.ajax({'u':'" + closeBehavior.getCallbackUrl() + "','c':'" + markupId + "'});" + "})"; } return script; }
private String getJavaScriptAction() { final StringBuffer script = new StringBuffer(); script.append("$('#").append(getMainContainerMarkupId()).append("').modal({keyboard: ").append(escapeKeyEnabled) .append(", show: false });"); final boolean isResizable = (resizable == null && bigWindow == true) || Boolean.TRUE.equals(resizable) == true; if (draggable == true || isResizable == true) { script.append(" $('#").append(getMainContainerMarkupId()).append("')"); } if (draggable == true) { script.append(".draggable()"); } if (isResizable) { script.append(".resizable({ alsoResize: '#") .append(getMainContainerMarkupId()) // max-height of .modal-body is 600px, need to enlarge this setting for resizing. .append( ", .modal-body', resize: function( event, ui ) {$('.modal-body').css('max-height', '4000px');}, minWidth: 300, minHeight: 200 })"); } if (useCloseHandler.getObject()) { script.append(";$('#").append(getMainContainerMarkupId()).append("').on('hidden', function () { ") .append(" Wicket.Ajax.ajax({'u':'").append(closeBehavior.getCallbackUrl()).append("','c':'").append(getMainContainerMarkupId()) .append("'});").append("})"); } return script.toString(); }
@Override public CharSequence getCallbackUrl() { final Url url = Url.parse(super.getCallbackUrl().toString()); final PageParameters params = getPageParameters(); return StatelessEncoder.mergeParameters(url, params).toString(); }
@Override protected final CharSequence getCallbackScript(boolean onlyTargetActivePage) { /* * Encode the callback script appending to the url the current client side value of the component values. */ CharSequence baseUrl = super.getCallbackUrl(onlyTargetActivePage); CharSequence callbackScript = baseUrl; List<String> parameterList = new ArrayList<String>(); for (String parameter : dependencyProcessor .getQueryParameterToComponentMap().keySet()) { Component c = dependencyProcessor.getQueryParameterToComponentMap() .get(parameter); String adjustedUrl = "&" + parameter + "='+ encodeURIComponent (Wicket.$('" + c.getMarkupId() + "').value)"; parameterList.add(adjustedUrl); } callbackScript = StringUtils.join (new StringBuffer(callbackScript), parameterList, "+'").toString(); String script = "wicketAjaxGet('" + callbackScript + ");"; if (dependencyProcessor.getThrottingDuration() != null) return AbstractDefaultAjaxBehavior.throttleScript(script, getComponent().getMarkupId(), dependencyProcessor.getThrottingDuration()); else return script; }
@Override protected final CharSequence getCallbackScript() { /* * Encode the callback script appending to the url the current client side value of the * component values. */ CharSequence baseUrl = super.getCallbackUrl(); CharSequence callbackScript = baseUrl; List<String> parameterList = new ArrayList<String>(); for (String parameter : dependencyProcessor.getQueryParameterToComponentMap().keySet()) { Component c = dependencyProcessor.getQueryParameterToComponentMap().get(parameter); String adjustedUrl = "&" + parameter + "='+Wicket.$('" + c.getMarkupId() + "').value"; parameterList.add(adjustedUrl); } callbackScript = StringUtils.join(new StringBuffer(callbackScript), parameterList, "+'") .toString(); String script = "wicketAjaxGet('" + callbackScript + ");"; if (dependencyProcessor.getThrottingDuration() != null) return AbstractDefaultAjaxBehavior.throttleScript(script, getComponent().getMarkupId(), dependencyProcessor.getThrottingDuration()); else return script; }