Class EventsHelper


  • public abstract class EventsHelper
    extends java.lang.Object
    $Id: EventsHelper.java 1714 2011-09-22 20:38:30Z hielke.hoeve $

    Helper to bind javascript scope and events

    Since:
    1.0.2
    Author:
    Julien Roche
    • Constructor Detail

      • EventsHelper

        public EventsHelper()
    • Method Detail

      • bind

        public static ChainableStatement bind​(EventLabel eventLabel,
                                              JsScope jsScope)
        Binds a handler to one or more events (like click) for each matched element.
        Parameters:
        eventLabel - Event
        jsScope - Scope to use
        Returns:
        the jQuery code
      • blur

        public static ChainableStatement blur()
        Triggers the blur event of each matched element.
        Returns:
        the jQuery code
      • blur

        public static ChainableStatement blur​(JsScope jsScope)
        Bind a function to the blur event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • change

        public static ChainableStatement change()
        Triggers the change event of each matched element.
        Returns:
        the jQuery code
      • change

        public static ChainableStatement change​(JsScope jsScope)
        Bind a function to the change event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • click

        public static ChainableStatement click()
        Triggers the click event of each matched element.
        Returns:
        the jQuery code
      • click

        public static ChainableStatement click​(JsScope jsScope)
        Bind a function to the click event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • dblclick

        public static ChainableStatement dblclick()
        Triggers the dblclick event of each matched element.
        Returns:
        the jQuery code
      • dblclick

        public static ChainableStatement dblclick​(JsScope jsScope)
        Bind a function to the dblclick event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • die

        public static ChainableStatement die​(EventLabel eventLabel,
                                             JsScope jsScope)
        This does the opposite of live, it removes a bound live event.
        Parameters:
        eventLabel - Event
        jsScope - Scope to use
        Returns:
        the jQuery code
      • error

        public static ChainableStatement error()
        Triggers the error event of each matched element.
        Returns:
        the jQuery code
      • error

        public static ChainableStatement error​(JsScope jsScope)
        Bind a function to the error event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • focus

        public static ChainableStatement focus()
        Triggers the focus event of each matched element.
        Returns:
        the jQuery code
      • focus

        public static ChainableStatement focus​(JsScope jsScope)
        Bind a function to the focus event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • hover

        public static ChainableStatement hover​(JsScope over,
                                               JsScope out)
        Simulates hovering (moving the mouse on, and off, an object). This is a custom method which provides an 'in' to a frequent task.
        Parameters:
        over - Scope to use on "over"
        out - Scope to use on "out"
        Returns:
        the jQuery code
      • keydown

        public static ChainableStatement keydown()
        Triggers the keydown event of each matched element.
        Returns:
        the jQuery code
      • keydown

        public static ChainableStatement keydown​(JsScope jsScope)
        Bind a function to the keydown event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • keypress

        public static ChainableStatement keypress()
        Triggers the keypress event of each matched element.
        Returns:
        the jQuery code
      • keypress

        public static ChainableStatement keypress​(JsScope jsScope)
        Bind a function to the keypress event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • keyup

        public static ChainableStatement keyup()
        Triggers the keyup event of each matched element.
        Returns:
        the jQuery code
      • keyup

        public static ChainableStatement keyup​(JsScope jsScope)
        Bind a function to the keyup event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • live

        public static ChainableStatement live​(EventLabel eventLabel,
                                              JsScope jsScope)
        Binds a handler to an event (like click) for all current - and future - matched element.
        Parameters:
        eventLabel - Event
        jsScope - Scope to use
        Returns:
        the jQuery code
      • load

        public static ChainableStatement load​(JsScope jsScope)
        Bind a function to the load event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mousedown

        public static ChainableStatement mousedown​(JsScope jsScope)
        Bind a function to the mousedown event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mouseenter

        public static ChainableStatement mouseenter​(JsScope jsScope)
        Bind a function to the mouseenter event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mouseleave

        public static ChainableStatement mouseleave​(JsScope jsScope)
        Bind a function to the mouseleave event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mousemove

        public static ChainableStatement mousemove​(JsScope jsScope)
        Bind a function to the mousemove event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mouseout

        public static ChainableStatement mouseout​(JsScope jsScope)
        Bind a function to the mouseout event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mouseover

        public static ChainableStatement mouseover​(JsScope jsScope)
        Bind a function to the mouseover event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • mouseup

        public static ChainableStatement mouseup​(JsScope jsScope)
        Bind a function to the mouseup event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • one

        public static ChainableStatement one​(EventLabel eventLabel,
                                             JsScope jsScope)
        Binds a handler to one or more events to be executed once for each matched element.
        Parameters:
        eventLabel - Event
        jsScope - Scope to use
        Returns:
        the jQuery code
      • ready

        public static ChainableStatement ready​(JsScope jsScope)
        Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • scroll

        public static ChainableStatement scroll​(JsScope jsScope)
        Bind a function to the scroll event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • select

        public static ChainableStatement select()
        Triggers the select event of each matched element.
        Returns:
        the jQuery code
      • select

        public static ChainableStatement select​(JsScope jsScope)
        Bind a function to the select event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • submit

        public static ChainableStatement submit()
        Triggers the submit event of each matched element.
        Returns:
        the jQuery code
      • submit

        public static ChainableStatement submit​(JsScope jsScope)
        Bind a function to the submit event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code
      • toggle

        public static ChainableStatement toggle​(JsScope jsScope,
                                                JsScope jsScope2)
        Toggle among two function calls every other click.
        Parameters:
        jsScope - Scope to use
        jsScope2 - Scope to use
        Returns:
        the jQuery code
      • toggle

        public static ChainableStatement toggle​(JsScope jsScope,
                                                JsScope jsScope2,
                                                JsScope... jsScopes)
        Toggle among two or more function calls every other click.
        Parameters:
        jsScope - Scope to use
        jsScope2 - Scope to use
        jsScopes - Additional functions
        Returns:
        the jQuery code
      • trigger

        public static ChainableStatement trigger​(EventLabel eventLabel)
        Trigger an event on every matched element.
        Parameters:
        eventLabel - Event
        Returns:
        the jQuery code
      • trigger

        public static ChainableStatement trigger​(EventLabel eventLabel,
                                                 java.lang.CharSequence... data)
        Trigger an event on every matched element.
        Parameters:
        eventLabel - Event
        data - Data for the scope
        Returns:
        the jQuery code
      • triggerHandler

        public static ChainableStatement triggerHandler​(EventLabel eventLabel)
        Triggers all bound event handlers on an element (for a specific event type) WITHOUT executing the browser's default actions, bubbling, or live events.
        Parameters:
        eventLabel - Event
        Returns:
        the jQuery code
      • triggerHandler

        public static ChainableStatement triggerHandler​(EventLabel eventLabel,
                                                        java.lang.CharSequence... data)
        Triggers all bound event handlers on an element (for a specific event type) WITHOUT executing the browser's default actions, bubbling, or live events.
        Parameters:
        eventLabel - Event
        data - Data for the scope
        Returns:
        the jQuery code
      • unbind

        public static ChainableStatement unbind​(EventLabel eventLabel,
                                                JsScope jsScope)
        This does the opposite of bind, it removes bound events from each of the matched elements.
        Parameters:
        eventLabel - Event
        jsScope - Scope to use
        Returns:
        the jQuery code
      • unload

        public static ChainableStatement unload​(JsScope jsScope)
        Bind a function to the unload event of each matched element.
        Parameters:
        jsScope - Scope to use
        Returns:
        the jQuery code