Class AbstractDefaultAjaxBehavior

    • Method Detail

      • renderAjaxAttributes

        protected final CharSequence renderAjaxAttributes​(Component component)
                                                u: 'editable-label?6-1.IBehaviorListener.0-text1-label',  // url
                                                m: 'POST',          // method name. Default: 'GET'
                                                c: 'label7',        // component id (String) or window for page
                                                e: 'click',         // event name
                                                sh: [],             // list of success handlers
                                                fh: [],             // list of failure handlers
                                                pre: [],            // list of preconditions. If empty set default : Wicket.$(settings{c}) !== null
                                                ep: {},             // extra parameters
                                                async: true|false,  // asynchronous XHR or not
                                                ch: 'someName|d',   // AjaxChannel
                                                i: 'indicatorId',   // indicator component id
                                                ad: true,           // allow default
        component - the component with that behavior
        the attributes as string in JSON format
      • postprocessConfiguration

        protected void postprocessConfiguration​(com.github.openjson.JSONObject attributesJson,
                                                Component component)
                                         throws com.github.openjson.JSONException
        Gives a chance to modify the JSON attributesJson that is going to be used as attributes for the Ajax call.
        attributesJson - the JSON object created by #renderAjaxAttributes()
        component - the component with the attached Ajax behavior
        com.github.openjson.JSONException - thrown if an error occurs while modifying attributesJson argument
      • getCallbackScript

        public CharSequence getCallbackScript()
        javascript that will generate an ajax GET request to this behavior with its assigned component
      • getCallbackScript

        protected CharSequence getCallbackScript​(Component component)
        component - the component to use when generating the attributes
        script that can be used to execute this Ajax behavior.
      • getCallbackFunction

        public CharSequence getCallbackFunction​(CallbackParameter... extraParameters)
        Generates a javascript function that can take parameters and performs an AJAX call which includes these parameters. The generated code looks like this:
         function(param1, param2) {
            var attrs = attrsJson;
            var params = {'param1': param1, 'param2': param2};
            attrs.ep = jQuery.extend(attrs.ep, params);
        extraParameters -
        A function that can be used as a callback function in javascript
      • findIndicatorId

        protected String findIndicatorId()
        Finds the markup id of the indicator. The default search order is: component, behavior, component's parent hierarchy.
        markup id or null if no indicator found
      • onRequest

        public final void onRequest()
        Description copied from interface: IRequestListener
        Called when a request is received.