public final class EventUtil extends Object
Modifier and Type | Method and Description |
---|---|
static List<AfterNavigationObserver> |
collectAfterNavigationObservers(UI ui)
Collect all Components implementing
AfterNavigationObserver that
are found in the given UI. |
static List<BeforeEnterObserver> |
collectBeforeEnterObservers(Collection<? extends HasElement> oldChain,
Collection<? extends HasElement> newChain)
Collect before enter observer instances based on what will be attached
when a new view chain is applied.
|
static List<BeforeEnterObserver> |
collectBeforeEnterObserversFromChain(Collection<? extends HasElement> chain,
Collection<? extends HasElement> childrenExclusions)
Collect before enter observer instances based on what will be attached
when a new view chain is applied.
|
static List<BeforeEnterObserver> |
collectBeforeEnterObserversFromChainElement(HasElement element,
Collection<? extends HasElement> childrenExclusions)
Collect before enter observer instances in the
element 's
hierarchy. |
static List<BeforeLeaveObserver> |
collectBeforeLeaveObservers(UI ui)
Collect all Components implementing
BeforeLeaveObserver connected
to the given UI. |
static List<LocaleChangeObserver> |
collectLocaleChangeObservers(Element element)
Collect all Components implementing
LocaleChangeObserver
connected to the given element tree. |
static List<LocaleChangeObserver> |
collectLocaleChangeObservers(List<HasElement> components)
Collect all Components implementing
LocaleChangeObserver
connected to the tree of all given Components in list. |
static <T> Stream<T> |
getImplementingComponents(Stream<Element> elementStream,
Class<T> type)
Collect elements with Component implementing listener of type T.
|
static void |
informLocaleChangeObservers(UI ui)
Inform components connected to the given ui that implement
LocaleChangeObserver about locale change. |
static void |
informLocaleChangeObservers(UI ui,
List<HasElement> components)
Inform components implementing
LocaleChangeObserver about locale
change. |
static void |
inspectHierarchy(Element node,
Collection<Element> descendants,
Predicate<Element> filter)
Collect all children for given node as a Element stream.
|
public static List<BeforeEnterObserver> collectBeforeEnterObservers(Collection<? extends HasElement> oldChain, Collection<? extends HasElement> newChain)
oldChain
- the view chain prior to the navigationnewChain
- the view chain after the navigationpublic static List<BeforeEnterObserver> collectBeforeEnterObserversFromChain(Collection<? extends HasElement> chain, Collection<? extends HasElement> childrenExclusions)
chain
- the view chain after the navigationchildrenExclusions
- any children of any element in the chain input that is found
in this collection will be excluded from the resultpublic static List<BeforeEnterObserver> collectBeforeEnterObserversFromChainElement(HasElement element, Collection<? extends HasElement> childrenExclusions)
element
's
hierarchy.element
- an elementchildrenExclusions
- any children of the element input that is found in this
collection will be excluded from the resultpublic static List<BeforeLeaveObserver> collectBeforeLeaveObservers(UI ui)
BeforeLeaveObserver
connected
to the given UI.ui
- UI to search frompublic static List<AfterNavigationObserver> collectAfterNavigationObservers(UI ui)
AfterNavigationObserver
that
are found in the given UI.ui
- UI to search frompublic static List<LocaleChangeObserver> collectLocaleChangeObservers(Element element)
LocaleChangeObserver
connected to the given element tree.element
- element to search frompublic static List<LocaleChangeObserver> collectLocaleChangeObservers(List<HasElement> components)
LocaleChangeObserver
connected to the tree of all given Components in list.components
- components to searchpublic static void informLocaleChangeObservers(UI ui)
LocaleChangeObserver
about locale change.ui
- UI for locale changepublic static void informLocaleChangeObservers(UI ui, List<HasElement> components)
LocaleChangeObserver
about locale
change.ui
- UI for locale changecomponents
- components to searchpublic static <T> Stream<T> getImplementingComponents(Stream<Element> elementStream, Class<T> type)
T
- type that is used in filteringelementStream
- collected elementstype
- class type to filter bypublic static void inspectHierarchy(Element node, Collection<Element> descendants, Predicate<Element> filter)
node
- start node to collect child elements fromdescendants
- a collector of descendants to fillfilter
- predicate to check whether a given element and its descendants
should be includedCopyright © 2022. All rights reserved.