Module is.codion.swing.framework.ui
Package is.codion.swing.framework.ui
Interface EntityApplicationPanel.Builder<M extends SwingEntityApplicationModel,P extends EntityApplicationPanel<M>>
- Type Parameters:
M
- the application model typeP
- the application panel type
- Enclosing class:
- EntityApplicationPanel<M extends SwingEntityApplicationModel>
public static interface EntityApplicationPanel.Builder<M extends SwingEntityApplicationModel,P extends EntityApplicationPanel<M>>
Builds a
EntityApplicationPanel
and starts the application.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A factory for aEntityConnectionProvider
instance.static interface
Provides a way for a user to login. -
Method Summary
Modifier and TypeMethodDescriptionapplicationIcon
(ImageIcon applicationIcon) applicationModelFactory
(Function<EntityConnectionProvider, M> applicationModelFactory) applicationName
(String applicationName) applicationPanelFactory
(Function<M, P> applicationPanelFactory) applicationVersion
(Version applicationVersion) automaticLoginUser
(User automaticLoginUser) beforeApplicationStarted
(Runnable beforeApplicationStarted) Runs before the application is started, but after Look and Feel initialization.connectionProviderFactory
(EntityApplicationPanel.Builder.ConnectionProviderFactory connectionProviderFactory) defaultLoginUser
(User defaultLoginUser) defaultLookAndFeelClassName
(String defaultLookAndFeelClassName) Sets the default look and feel classname, used in case no look and feel settings are found in user preferences.displayFrame
(boolean displayFrame) displayStartupDialog
(boolean displayStartupDialog) domainType
(DomainType domainType) frameSupplier
(Supplier<JFrame> frameSupplier) frameTitle
(String frameTitle) frameTitleProvider
(ValueObserver<String> frameTitle) For a dynamic frame title.includeMainMenu
(boolean includeMainMenu) loginPanelSouthComponent
(Supplier<JComponent> loginPanelSouthComponentSupplier) Note that this does not apply when a customEntityApplicationPanel.Builder.LoginProvider
has been specified.loginProvider
(EntityApplicationPanel.Builder.LoginProvider loginProvider) loginRequired
(boolean loginRequired) If this is set to false, theconnectionProviderFactory(ConnectionProviderFactory)
User
argument will be null.lookAndFeelClassName
(String lookAndFeelClassName) Sets the look and feel classname, overrides any look and feel settings found in user preferences.maximizeFrame
(boolean maximizeFrame) onApplicationStarted
(Consumer<P> onApplicationStarted) saveDefaultUsername
(boolean saveDefaultUsername) setUncaughtExceptionHandler
(boolean setUncaughtExceptionHandler) Specifies whether or not to set the default uncaught exception handler when starting the application, true by default.void
start()
Starts the application on the Event Dispatch Thread.void
start
(boolean onEventDispatchThread) Starts the application.
-
Method Details
-
domainType
- Parameters:
domainType
- the domain type- Returns:
- this Builder instance
-
applicationName
- Parameters:
applicationName
- the application name- Returns:
- this Builder instance
-
applicationIcon
- Parameters:
applicationIcon
- the application icon- Returns:
- this Builder instance
-
applicationVersion
- Parameters:
applicationVersion
- the application version- Returns:
- this Builder instance
-
defaultLookAndFeelClassName
Sets the default look and feel classname, used in case no look and feel settings are found in user preferences. Note that for an external Look and Feels to be enabled, it must be registered viaLookAndFeelProvider.addLookAndFeelProvider(LookAndFeelProvider)
before starting the application.- Parameters:
defaultLookAndFeelClassName
- the default look and feel classname- Returns:
- this Builder instance
-
lookAndFeelClassName
Sets the look and feel classname, overrides any look and feel settings found in user preferences. Note that for an external Look and Feels to be enabled, it must be registered viaLookAndFeelProvider.addLookAndFeelProvider(LookAndFeelProvider)
before starting the application.- Parameters:
lookAndFeelClassName
- the look and feel classname- Returns:
- this Builder instance
-
connectionProviderFactory
EntityApplicationPanel.Builder<M,P> connectionProviderFactory(EntityApplicationPanel.Builder.ConnectionProviderFactory connectionProviderFactory) - Parameters:
connectionProviderFactory
- the connection provider factory- Returns:
- this Builder instance
-
applicationModelFactory
EntityApplicationPanel.Builder<M,P> applicationModelFactory(Function<EntityConnectionProvider, M> applicationModelFactory) - Parameters:
applicationModelFactory
- the application model factory- Returns:
- this Builder instance
-
applicationPanelFactory
- Parameters:
applicationPanelFactory
- the application panel factory- Returns:
- this Builder instance
-
loginProvider
EntityApplicationPanel.Builder<M,P> loginProvider(EntityApplicationPanel.Builder.LoginProvider loginProvider) - Parameters:
loginProvider
- provides a way for a user to login- Returns:
- this Builder instance
-
defaultLoginUser
- Parameters:
defaultLoginUser
- the default user credentials to display in the login dialog- Returns:
- this Builder instance
-
automaticLoginUser
- Parameters:
automaticLoginUser
- if specified the application is started automatically with the given user, instead of displaying a login dialog- Returns:
- this Builder instance
-
saveDefaultUsername
- Parameters:
saveDefaultUsername
- true if the username should be saved in user preferences after a successful login- Returns:
- this Builder instance
-
loginPanelSouthComponent
EntityApplicationPanel.Builder<M,P> loginPanelSouthComponent(Supplier<JComponent> loginPanelSouthComponentSupplier) Note that this does not apply when a customEntityApplicationPanel.Builder.LoginProvider
has been specified.- Parameters:
loginPanelSouthComponentSupplier
- supplies the component to add to theBorderLayout.SOUTH
position of the default login panel- Returns:
- this Builder instance
-
beforeApplicationStarted
Runs before the application is started, but after Look and Feel initialization. ThrowCancelException
in order to cancel the application startup.- Parameters:
beforeApplicationStarted
- run before the application is started- Returns:
- this Builder instance
-
onApplicationStarted
- Parameters:
onApplicationStarted
- called after a successful application start- Returns:
- this Builder instance
-
frameSupplier
- Parameters:
frameSupplier
- the frame supplier- Returns:
- this Builder instance
-
frameTitle
- Parameters:
frameTitle
- the frame title- Returns:
- this Builder instance
-
frameTitleProvider
For a dynamic frame title.- Parameters:
frameTitle
- the value observer controlling the frame title- Returns:
- this Builder instance
-
includeMainMenu
- Parameters:
includeMainMenu
- if true then a main menu is included- Returns:
- this Builder instance
-
maximizeFrame
- Parameters:
maximizeFrame
- specifies whether the frame should be maximized or use it's preferred size- Returns:
- this Builder instance
-
displayFrame
- Parameters:
displayFrame
- specifies whether the frame should be displayed or left invisible- Returns:
- this Builder instance
-
setUncaughtExceptionHandler
EntityApplicationPanel.Builder<M,P> setUncaughtExceptionHandler(boolean setUncaughtExceptionHandler) Specifies whether or not to set the default uncaught exception handler when starting the application, true by default.- Parameters:
setUncaughtExceptionHandler
- if true the default uncaught exception handler is set on application start- Returns:
- this Builder instance
- See Also:
-
displayStartupDialog
- Parameters:
displayStartupDialog
- if true then a progress dialog is displayed while the application is being initialized- Returns:
- this Builder instance
-
frameSize
- Parameters:
frameSize
- the frame size when not maximized- Returns:
- this Builder instance
-
loginRequired
If this is set to false, theconnectionProviderFactory(ConnectionProviderFactory)
User
argument will be null.- Parameters:
loginRequired
- true if a user login is required for this application, false if the user is supplied differently- Returns:
- this Builder instance
-
start
void start()Starts the application on the Event Dispatch Thread. -
start
void start(boolean onEventDispatchThread) Starts the application.- Parameters:
onEventDispatchThread
- if true then startup is performed on the EDT
-