Module is.codion.javafx.framework
Package is.codion.javafx.framework.ui
Class EntityApplicationView<M extends FXEntityApplicationModel>
- java.lang.Object
-
- javafx.application.Application
-
- is.codion.javafx.framework.ui.EntityApplicationView<M>
-
- Type Parameters:
M
- the type ofFXEntityApplicationModel
used by this application view
- All Implemented Interfaces:
ViewTreeNode<EntityView>
public abstract class EntityApplicationView<M extends FXEntityApplicationModel> extends javafx.application.Application implements ViewTreeNode<EntityView>
A root application View.
-
-
Constructor Summary
Constructors Constructor Description EntityApplicationView(String applicationTitle)
Instantiates a newEntityApplicationView
instance.EntityApplicationView(String applicationTitle, String iconFileName)
Instantiates a newEntityApplicationView
instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addEntityView(EntityView entityView)
Adds aEntityView
to this applicationprotected String
applicationIdentifier()
List<EntityView>
childViews()
protected abstract M
createApplicationModel(EntityConnectionProvider connectionProvider)
Initializes the application modelprotected javafx.scene.Scene
createApplicationScene(javafx.stage.Stage primaryStage)
Creates the application scene from the availableEntityView
s.protected abstract void
createEntityViews()
Initialized all entity views and adds them viaaddEntityView(EntityView)
protected javafx.scene.control.MenuBar
createMainMenu()
protected User
defaultUser()
protected EntityConnectionProvider
initializeConnectionProvider(User user, String clientTypeId)
Initializes the connection provider to use in this applicationprotected User
loginUser()
Displays a login panel in case authentication is required, otherwise returns the default user.M
model()
Optional<EntityView>
nextSiblingView()
Optional<ViewTreeNode<EntityView>>
parentView()
Optional<EntityView>
previousSiblingView()
protected void
savePreferences()
Called on application exit, override to save user preferences on program exit, remember to call super.savePreferences() when overridingprotected User
showLoginPanel(User defaultUser)
Displays a login panelvoid
start(javafx.stage.Stage stage)
Starts this application
-
-
-
Constructor Detail
-
EntityApplicationView
public EntityApplicationView(String applicationTitle)
Instantiates a newEntityApplicationView
instance.- Parameters:
applicationTitle
- the title to display in the view header
-
EntityApplicationView
public EntityApplicationView(String applicationTitle, String iconFileName)
Instantiates a newEntityApplicationView
instance.- Parameters:
applicationTitle
- the title to display in the view headericonFileName
- the name of an icon file on the classpath to display
-
-
Method Detail
-
model
public final M model()
- Returns:
- the application model
-
addEntityView
public final void addEntityView(EntityView entityView)
Adds aEntityView
to this application- Parameters:
entityView
- theEntityView
to add
-
parentView
public final Optional<ViewTreeNode<EntityView>> parentView()
- Specified by:
parentView
in interfaceViewTreeNode<M extends FXEntityApplicationModel>
- Returns:
- null, since
EntityApplicationView
does not have a parent view
-
previousSiblingView
public final Optional<EntityView> previousSiblingView()
- Specified by:
previousSiblingView
in interfaceViewTreeNode<M extends FXEntityApplicationModel>
- Returns:
- null, since
EntityApplicationView
does not have a previous sibling view
-
nextSiblingView
public final Optional<EntityView> nextSiblingView()
- Specified by:
nextSiblingView
in interfaceViewTreeNode<M extends FXEntityApplicationModel>
- Returns:
- null, since
EntityApplicationView
does not have a next sibling view
-
childViews
public final List<EntityView> childViews()
- Specified by:
childViews
in interfaceViewTreeNode<M extends FXEntityApplicationModel>
- Returns:
- the
EntityView
s associated with this application - See Also:
addEntityView(EntityView)
-
start
public final void start(javafx.stage.Stage stage)
Starts this application- Specified by:
start
in classjavafx.application.Application
- Parameters:
stage
- the State on which to set this application
-
initializeConnectionProvider
protected EntityConnectionProvider initializeConnectionProvider(User user, String clientTypeId)
Initializes the connection provider to use in this application- Parameters:
user
- the user on which to base the connectionclientTypeId
- a String identifying the client type- Returns:
- a
EntityConnectionProvider
based on the given user and client type
-
defaultUser
protected User defaultUser()
- Returns:
- the default user when logging into this application
-
applicationIdentifier
protected String applicationIdentifier()
- Returns:
- a String identifying this application, the class name by default
-
createMainMenu
protected javafx.scene.control.MenuBar createMainMenu()
- Returns:
- the main menu for this application
-
loginUser
protected final User loginUser()
Displays a login panel in case authentication is required, otherwise returns the default user.- Returns:
- the user to use when logging into this application.
- See Also:
EntityApplicationModel.AUTHENTICATION_REQUIRED
,defaultUser()
-
showLoginPanel
protected final User showLoginPanel(User defaultUser)
Displays a login panel- Parameters:
defaultUser
- the default user to display- Returns:
- the user retrieved from the login panel
- Throws:
CancelException
- in case the login action is cancelled
-
savePreferences
protected void savePreferences()
Called on application exit, override to save user preferences on program exit, remember to call super.savePreferences() when overriding- See Also:
EntityApplicationModel.savePreferences()
-
createEntityViews
protected abstract void createEntityViews()
Initialized all entity views and adds them viaaddEntityView(EntityView)
-
createApplicationScene
protected javafx.scene.Scene createApplicationScene(javafx.stage.Stage primaryStage)
Creates the application scene from the availableEntityView
s.- Parameters:
primaryStage
- the primary stage- Returns:
- the application scene
-
createApplicationModel
protected abstract M createApplicationModel(EntityConnectionProvider connectionProvider)
Initializes the application model- Parameters:
connectionProvider
- the connection provider- Returns:
- the application model
-
-