Class AjaxHelper


  • public final class AjaxHelper
    extends Object
    AjaxHelper provides convenience methods to register components for use with the AJAX servlet.
    Since:
    1.0.0
    Author:
    Yiannis Paschalidis
    • Method Detail

      • isCurrentAjaxTrigger

        public static boolean isCurrentAjaxTrigger​(WComponent trigger)
        Parameters:
        trigger - the AJAX trigger to check
        Returns:
        true if this is the current AJAX trigger
      • setCurrentOperationDetails

        public static void setCurrentOperationDetails​(AjaxOperation operation,
                                                      ComponentWithContext trigger)
        Sets the current AJAX operation details.
        Parameters:
        operation - the current AJAX operation.
        trigger - the current AJAX operation trigger and its context.
      • getCurrentOperation

        public static AjaxOperation getCurrentOperation()
        Returns:
        the current Ajax operation (if any).
      • getCurrentTriggerAndContext

        public static ComponentWithContext getCurrentTriggerAndContext()
        Returns:
        the current AJAX trigger component and its context.
      • clearCurrentOperationDetails

        public static void clearCurrentOperationDetails()
        Clear the details of the current AJAX operation on the thread.
      • registerComponents

        public static AjaxOperation registerComponents​(List<String> targetIds,
                                                       String triggerId)
        Registers one or more components as being AJAX capable.
        Parameters:
        targetIds - the components to register. Each component will be re-painted when the trigger occurs.
        triggerId - the id of the trigger that will cause the components to be painted.
        Returns:
        the AjaxOperation control configuration object.
      • registerComponent

        public static AjaxOperation registerComponent​(String targetId,
                                                      String triggerId)
        Registers a single component as being AJAX capable.
        Parameters:
        targetId - the component to register. The component will be re-painted when the trigger occurs.
        triggerId - the id of the trigger that will cause the component to be painted.
        Returns:
        the AjaxOperation control configuration object.
      • getAjaxOperation

        public static AjaxOperation getAjaxOperation​(String triggerId)
        Retrieves the AjaxOperation that has been registered for the given trigger. This method will return null if there is no corresponding operation registered.
        Parameters:
        triggerId - the trigger id.
        Returns:
        the AjaxOperation corresponding to the trigger id.
      • clearAllRegisteredOperations

        public static void clearAllRegisteredOperations()
        Clear the registered AJAX operations for this user context.
      • getRegisteredOperations

        public static Map<String,​AjaxOperation> getRegisteredOperations()
        Returns:
        the registered AJAX operations for this user context or null