📄 iajaxcalldecorator.java
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.wicket.ajax;import org.apache.wicket.IClusterable;/** * Interface used to decorate a wicket generated javascript that performs an ajax callback * <p> * The returned scripts are rendered in the HTML as follow: * * <pre> * <a href="javascript:[script]var wcall=wicketAjaxGet('[url]', function() {[onSuccessScript]}, * function() {[onFailureScript});" ...>[text of the link]</a> * </pre> * * As a result, using double quotes in the script will break the link syntax and make it fail (or * fallback in the case of an AjaxFallbackLink). So, if single quotes have to be inserted in strings * contained in the scripts, they must be properly escaped to pass through Java and Javascript, for * example: * * <pre> * return "alert('It\\'s ok!')"; * </pre> * * Also note that <tt>decorateScript(CharSequence script)</tt> should generally append to the * script rather than replace it: * * <pre> * return "alert('Before ajax call');" + script; * </pre> * * Both following examples will break the link: * * <pre> * return "alert('Before ajax call');"; // missing to append the script * return "alert('Before ajax call')" + script; // missing ";" * </pre> * * @since 1.2 * * @author Igor Vaynberg (ivaynberg) * */public interface IAjaxCallDecorator extends IClusterable{ /** * Name of javascript variable that will be true if ajax call was made, false otherwise. This * variable is available in the after script only. */ public static final String WICKET_CALL_RESULT_VAR = "wcall"; /** * Decorates the script that performs the ajax call * * @param script * @return decorated script */ CharSequence decorateScript(CharSequence script); /** * Decorates the onSuccess handler script * * @param script * @return decorated onSuccess handler script */ CharSequence decorateOnSuccessScript(CharSequence script); /** * Decorates the onFailure handler script * * @param script * @return decorated onFailure handler script */ CharSequence decorateOnFailureScript(CharSequence script);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -