Class AuInvoke


  • public class AuInvoke
    extends AuResponse
    A response to ask the client to invoke a function. Unlike AuScript, it invokes the given function (rather than evaluates a JavaScript snippet).

    There are basically two approaches. First, AuInvoke(Component, String, Object...) is used to invoke the method of the peer widget of the given component. Second, AuInvoke(String, Object...) is used to invoke a global function (at the client).

    data[0]: the component
    data[1]: the client function name (i.e., JavaScript function)
    data[2]: the second argument
    data[3]: the third argument...

    Note: the first argument is always the component itself.

    Since:
    3.0.0
    Author:
    tomyeh
    • Constructor Summary

      Constructors 
      Constructor Description
      AuInvoke​(java.lang.String function, java.lang.Object... args)
      Construct AuInvoke to call a global function at the client with the given arguments.
      AuInvoke​(Component comp, java.lang.String function)
      Construct AuInvoke to call the peer widget's member function with no argument.
      AuInvoke​(Component comp, java.lang.String function, boolean arg)
      Construct AuInvoke to call the peer widget's member function with one boolean argument.
      AuInvoke​(Component comp, java.lang.String function, double arg)
      Construct AuInvoke to call the peer widget's member function with one double argument.
      AuInvoke​(Component comp, java.lang.String function, int arg)
      Construct AuInvoke to call the peer widget's member function with one int argument.
      AuInvoke​(Component comp, java.lang.String function, java.lang.Object arg)
      Construct AuInvoke to call the peer widget's member function with one argument.
      AuInvoke​(Component comp, java.lang.String function, java.lang.Object... args)
      Construct AuInvoke to call the peer widget's member function with an array of the given arguments.
      AuInvoke​(Component comp, java.lang.String function, java.lang.Object arg1, java.lang.Object arg2)
      Construct AuInvoke to call the peer widget's member function with two arguments.
      AuInvoke​(Component comp, java.lang.String function, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
      Construct AuInvoke to call the peer widget's member function with three arguments.
      AuInvoke​(Component comp, java.lang.String function, java.lang.String... args)
      Construct AuInvoke to call a client function with variable number of arguments.
    • Constructor Detail

      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function)
        Construct AuInvoke to call the peer widget's member function with no argument.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        java.lang.Object arg)
        Construct AuInvoke to call the peer widget's member function with one argument.

        Notice that if you want to pass an array-type argument, you have to cast it to Object as follows:
        new AuInvoke(comp, "setOverride", (Object)new Object[] {"a", "b"}).
        Otherwise, the third argument will be handled by AuInvoke(Component, String, Object[]), and then considered as an array of arguments (rather than an argument with an array-type value.

        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg - the additional argument. It could be null, String, Date, DeferredValue, and any kind of objects that the client accepts (marshaled by JSON).
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        boolean arg)
        Construct AuInvoke to call the peer widget's member function with one boolean argument.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg - the additional argument. Different devices might support more types.
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        int arg)
        Construct AuInvoke to call the peer widget's member function with one int argument.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg - the additional argument.
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        double arg)
        Construct AuInvoke to call the peer widget's member function with one double argument.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg - the additional argument.
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        java.lang.Object arg1,
                        java.lang.Object arg2)
        Construct AuInvoke to call the peer widget's member function with two arguments.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg1 - the additional argument. It could be null, String, Date, DeferredValue, and any kind of objects that the client accepts (marshaled by JSON).
        arg2 - the 2nd additional argument.
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        java.lang.Object arg1,
                        java.lang.Object arg2,
                        java.lang.Object arg3)
        Construct AuInvoke to call the peer widget's member function with three arguments.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        arg1 - the additional argument. It could be null, String, Date, DeferredValue, and any kind of objects that the client accepts (marshaled by JSON).
        arg2 - the 2nd additional argument.
        arg3 - the 3rd additional argument.
        Since:
        5.0.0
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        java.lang.Object... args)
        Construct AuInvoke to call the peer widget's member function with an array of the given arguments.
        Parameters:
        comp - the component that the widget is associated with. It cannot be null.
        function - the function name
        args - the additional arguments. It could be null, String, Date, DeferredValue, Component, JavaScriptValue, and any kind of objects that the client accepts (notice that they are marshaled by JSON).
        Since:
        3.6.1
      • AuInvoke

        public AuInvoke​(Component comp,
                        java.lang.String function,
                        java.lang.String... args)
        Construct AuInvoke to call a client function with variable number of arguments. Notice that the component itself will be inserted in front of the specified argument array. In other words, the first argument is the component itself, the second is the first item in the argument array, and so on.
        zkType.function(comp, args[0], args[1], args[2]...)
        Parameters:
        comp - the component that this script depends on. It cannot be null.
        function - the function name
        Since:
        3.6.0
      • AuInvoke

        public AuInvoke​(java.lang.String function,
                        java.lang.Object... args)
        Construct AuInvoke to call a global function at the client with the given arguments.
        Parameters:
        function - the function name
        args - the additional arguments. It could be null, String, Date, DeferredValue, Component, JavaScriptValue, and any kind of objects that the client accepts (notice that they are marshaled by JSON).
        Since:
        6.0.0