Package org.apache.hop.ui.core.bus
Class HopGuiEventsHandler
- java.lang.Object
-
- org.apache.hop.ui.core.bus.HopGuiEventsHandler
-
public class HopGuiEventsHandler extends Object
This event handler contains event listeners per event ID and GUI ID. Suggestions for event IDs are present inHopGuiEventsThe 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 Summary
Constructors Constructor Description HopGuiEventsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaddEventListener(String guiId, IHopGuiEventListener<T> listener, String... eventIds)voidfire(boolean all, String... eventIds)Fire one or more events without a subject.voidfire(String... eventIds)Fire once for a list of possible events once without a provided subject.<T> voidfire(T eventSubject, boolean all, String... eventIds)Fire on one or more of the specified events with the provided subject.<T> voidfire(T eventSubject, String... eventIds)Fire once for a list of possible events once with the provided subject.Map<String,Map<String,IHopGuiEventListener>>getGuiEventListenerMap()Gets guiEventListenerMapvoidremoveEventListener(String guiId, String... eventIds)Remove the event listeners for the given GUI ID and event IDsvoidremoveEventListeners(String guiId)Remove all the event listeners for the given GUI IDvoidsetGuiEventListenerMap(Map<String,Map<String,IHopGuiEventListener>> guiEventListenerMap)
-
-
-
Method Detail
-
addEventListener
public <T> void addEventListener(String guiId, IHopGuiEventListener<T> listener, String... eventIds)
-
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 HopExceptionFire 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 eventall- 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 listenereventIds- 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 HopExceptionFire 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 listenereventIds- 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 HopExceptionFire 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 eventeventIds- 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.
-
getGuiEventListenerMap
public Map<String,Map<String,IHopGuiEventListener>> getGuiEventListenerMap()
Gets guiEventListenerMap- Returns:
- value of guiEventListenerMap
-
setGuiEventListenerMap
public void setGuiEventListenerMap(Map<String,Map<String,IHopGuiEventListener>> guiEventListenerMap)
- Parameters:
guiEventListenerMap- The guiEventListenerMap to set
-
-