Interface WebEventHandler

    • Method Detail

      • getWebEvent

        WebEvent getWebEvent​(int eventID)
        Returns the specified WebEvent instance which this event handler supports.
        Parameters:
        eventID - the event id of the WebEvent.
        Returns:
        the specified WebEvent; null if the event is not supported by this event handler.
      • handleRequest

        boolean handleRequest​(RequestKeys keys)
                       throws WebException
        Handles the WebEvent specified in the RequestKeys object. By default, this method invokes processRequest(RequestKeys) followed by delegateRequest(RequestKeys). In most cases, only processRequest is implemented (or overridden) to provide the event processing logic.
        Parameters:
        keys - the RequestKeys object containing event ID, sources, and any other information.
        Returns:
        true if handling succeeds in processRequest or one of its children.
        Throws:
        WebException - thrown if handling of the request fails.
      • processRequest

        boolean processRequest​(RequestKeys keys)
                        throws WebException
        This method encapsulates the logic to process incoming events without regard as to how it was triggered or be concerned with delegation the request (see processRequest(RequestKeys)). Normally, this is invoked by handleRequest(RequestKeys).
        Parameters:
        keys - the RequestKeys object containing event ID, sources, and any other information.
        Returns:
        true if handling succeeds; false if the event is ignored and not handled.
        Throws:
        WebException - thrown if handling of the request fails.
      • delegateRequest

        boolean delegateRequest​(RequestKeys keys)
                         throws WebException
        This method encapsulates the mechanism by which a request is delegated to child WebComponents. By default, the request will be delegated to the child WebComponent along the event source path irrespective of what was returned by processRequest(RequestKeys). Normally, this is invoked by handleRequest(RequestKeys). The request keys must also define an event ID otherwise the event will not be propagated.
        Parameters:
        keys - the RequestKeys object containing event ID, sources, and any other information.
        Returns:
        true if handling succeeds in processRequest or one of its children.
        Throws:
        WebException - thrown if handling of the request fails.
      • getWebComponent

        WebComponent getWebComponent()
        Returns the WebComponent object associated with the current event handler.
        Returns:
        the WebComponent object.
      • setWebComponent

        void setWebComponent​(WebComponent component)
        Sets a WebComponent instance on this WebEventHandler. A WebComponent must maintain a one-one relationship with an event handler instance. After this method call, the WebComponent previously associated with this event handler should have a null instance of WebEventHandler, and the event handler instance previously associate the specified WebComponent should have a null WebComponent.
        Parameters:
        component - a new WebComponent object.
      • addEventsFromXML

        void addEventsFromXML​(java.lang.String eventsXML)
        Adds one or more WebEvent into the current event handler.
        Parameters:
        eventsXML - the XML representation of web events.
      • addEvent

        void addEvent​(WebEvent event)
        Adds WebEvent into the current event handler. If there is an event already defined with the id of the event that is passed in, then it is overwritten
        Parameters:
        event - the event to be added
      • getHandlerType

        int getHandlerType()
        Returns the type of the current WebEventHandle.
        Returns:
        the type of the current event handler.
      • getWebEvents

        java.util.Enumeration getWebEvents()
        Returns an enumeration over the WebEvent objects suppored by this event handler. The WebEvent objects are returned in no particular order.
        Returns:
        an Enumeration over the WebEvent objects supported.
      • getWebEventsFromRequest

        java.util.Enumeration getWebEventsFromRequest​(RequestKeys keys)
        Returns an enumeration over the WebEvent suppored by this event handler that are present in the request keys provided. The WebEvent are returned in no particular order.
        Parameters:
        keys - the RequestKeys object.
        Returns:
        an Enumeration over the WebEvent supported.
      • getSupportedWebComponentType

        java.lang.Class getSupportedWebComponentType()
        Returns the Class type of the WebComponent this event handler is associated with.
        Returns:
        the Class of the WebComponent this event handler is associated with.
      • getPendingEvents

        SimpleList getPendingEvents()
        Returns the list of events that were not processed.
        While handling the request, if after processing an event the page is not in Succesfull state, the EventHandler stops processing the rest of the events. This list resturns those events that remain pending.
        Returns:
        a List with the events that were not processed during handleRequest(). If handelRequest() was not invoked, it returns null.
      • appendRemainingEvent

        void appendRemainingEvent​(WebEvent event)
        Append an remaining event at the end of the remaining events' list.
        Such remaining event will be processed at the end.
        Parameters:
        event - the WebEvent object.