Class HopGuiEventsHandler


  • public class HopGuiEventsHandler
    extends Object
    This event handler contains event listeners per event ID and GUI ID. Suggestions for event IDs are present in HopGuiEvents The GUI ID can be anything you want but we suggest using the class name of the dialog or perspective you're using.

    When you no longer need to listener for events make sure to remove a listener when you close GUI component like a dialog for example. This way you're not going to try to update a dialog which was disposed off earlier.

    • Constructor Detail

      • HopGuiEventsHandler

        public HopGuiEventsHandler()
    • Method Detail

      • removeEventListener

        public void removeEventListener​(String guiId,
                                        String... eventIds)
        Remove the event listeners for the given GUI ID and event IDs
        Parameters:
        guiId -
        eventIds -
      • removeEventListeners

        public void removeEventListeners​(String guiId)
        Remove all the event listeners for the given GUI ID
        Parameters:
        guiId - The unique ID of the GUI component
      • fire

        public <T> void fire​(T eventSubject,
                             boolean all,
                             String... eventIds)
                      throws HopException
        Fire on one or more of the specified events with the provided subject.
        Type Parameters:
        T - The type of the event subject
        Parameters:
        eventSubject - The subject to pass in the event
        all - Set to true if you want to fire on all the given eventIds. Use false if you only want to stop after you found the first registered listener
        eventIds - The event IDs to look up
        Throws:
        HopException - In case something goes wrong executing the listener lambdas.
      • fire

        public void fire​(boolean all,
                         String... eventIds)
                  throws HopException
        Fire one or more events without a subject.
        Parameters:
        all - Set to true if you want to fire on all the given eventIds. Use false if you only want to stop after you found the first registered listener
        eventIds - The event IDs to look up
        Throws:
        HopException - In case something goes wrong executing the listener lambdas.
      • fire

        public <T> void fire​(T eventSubject,
                             String... eventIds)
                      throws HopException
        Fire once for a list of possible events once with the provided subject. Stop executing after the first event is found and the listener is executed.
        Type Parameters:
        T - The type of the event subject
        Parameters:
        eventSubject - The subject to pass in the event
        eventIds - The event IDs to look up
        Throws:
        HopException - In case something goes wrong executing the listener lambda.
      • fire

        public void fire​(String... eventIds)
                  throws HopException
        Fire once for a list of possible events once without a provided subject. Stop executing after the first event is found and the listener is executed.
        Parameters:
        eventIds - The event IDs to look up
        Throws:
        HopException - In case something goes wrong executing the listener lambda.
      • setGuiEventListenerMap

        public void setGuiEventListenerMap​(Map<String,​Map<String,​IHopGuiEventListener>> guiEventListenerMap)
        Parameters:
        guiEventListenerMap - The guiEventListenerMap to set