Package io.jmix.ui.screen
Class Extensions
java.lang.Object
io.jmix.ui.screen.Extensions
Extensions API for
Screen
and ScreenFragment
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
get
(FrameOwner frameOwner, Class<T> extensionClass) Get extension instance.static org.springframework.context.ApplicationContext
getApplicationContext
(FrameOwner frameOwner) Returns Spring ApplicationContext associated with the frame owner.static <T> Optional<T>
getOptional
(FrameOwner frameOwner, Class<T> extensionClass) Get optional extension instance.static <T> void
register
(FrameOwner frameOwner, Class<T> extensionClass, T extension) Register extension class in screen.static void
remove
(FrameOwner frameOwner, Class<?> extensionClass) Remove extension instance.
-
Method Details
-
register
Register extension class in screen.- Type Parameters:
T
- type of the extension- Parameters:
frameOwner
- screen or screen fragmentextensionClass
- class of the extensionextension
- extension
-
get
Get extension instance.- Type Parameters:
T
- type of extension- Parameters:
frameOwner
- screen or screen fragmentextensionClass
- class of the extension- Returns:
- extension
- Throws:
IllegalStateException
- in case extension class is not registered
-
getOptional
Get optional extension instance.- Type Parameters:
T
- type of extension- Parameters:
frameOwner
- screen or screen fragmentextensionClass
- class of the extension- Returns:
- optional extension
-
remove
Remove extension instance.- Parameters:
frameOwner
- screen or screen fragmentextensionClass
- class of the extension
-
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext(FrameOwner frameOwner) Returns Spring ApplicationContext associated with the frame owner. Extensions can use it to get application beans.
Example:ApplicationContext applicationContext = Extensions.getApplicationContext(screen); Messages messages = applicationContext.getBean(Messages.class);
- Parameters:
frameOwner
- UI controller
-