- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- javafx.scene.layout.BorderPane
-
- com.gluonhq.charm.glisten.mvc.View
-
- com.gluonhq.charm.glisten.mvc.SplashView
-
- All Implemented Interfaces:
Styleable
,EventTarget
public class SplashView extends View
SplashView is a subclass ofView
intended to be used only as a first-time splash view. It will be the first view displayed and, should aDuration
be specified, it will be hidden after that time passes, switching to the home view, or to any other specific view. Otherwise, it will be the developer's responsibility managing that transition. It should provide minimum content so it can be loaded fast enough to prevent a black screen on a mobile device, that most of the times may occur due to complex content loaded at startup. SplashView will be added to the factory of views with the keyMobileApplication.SPLASH_VIEW
. There are a few constructors available. IfDuration
is not specified as an argument, hiding the splash and switching to the first view will be responsibility of the developer. Typically this can be done by directly callinghideSplashView()
, as a result of some event:addViewFactory(MobileApplication.SPLASH_VIEW, () -> { SplashView splashView = new SplashView(); Button button = new Button("Click to close"); button.setOnAction(e -> splashView.hideSplashView()); splashView.setCenter(button); return splashView; });
PauseTransition
:addViewFactory(MobileApplication.SPLASH_VIEW, () -> { SplashView splashView = new SplashView(new Label("This is a splash")); splashView.setOnShown(e -> { PauseTransition pause = new PauseTransition(Duration.seconds(3)); pause.setOnFinished(e -> splashView.hideSplashView()); pause.play()); }); return splashView; });
Duration
is set, the lifecycle of the splash view will be managed internally:addViewFactory(MobileApplication.SPLASH_VIEW, () -> { return new SplashView(HOME_VIEW, new Label("This is a splash"), Duration.seconds(3)); });
MobileApplication.switchView(SPLASH_VIEW)
- Since:
- 3.0.1
-
-
Property Summary
Properties Type Property Description ReadOnlyObjectProperty<Duration>
duration
A read only object property with the duration of the pause transition used to hide the splash, if the duration is set with the three-argument constructor, or null otherwise.ReadOnlyStringProperty
nextView
A read only string property with the name of the view that will be loaded after the splash is hidden-
Properties inherited from class com.gluonhq.charm.glisten.mvc.View
onCloseRequest, onHidden, onHiding, onShowing, onShown, showing, showTransitionFactory
-
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
-
Properties inherited from class javafx.scene.Parent
needsLayout
-
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
-
Field Summary
-
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
-
Constructor Summary
Constructors Constructor Description SplashView()
Default empty constructor.SplashView(String nextView)
Creates a Splash View, that will switch to the view registered in the factory with the key "nextView", after the splash is hidden.SplashView(String nextView, Node content)
Creates a Splash View with the defined content placed at its center, that will switch to the view registered in the factory with the key "nextView", after the splash is hidden.SplashView(String nextView, Node content, Duration duration)
Creates a Splash View with the defined content placed at its center, that will switch to the view registered in the factory with the key "nextView", when a pause transition with the defined duration, and starting after the splash view is shown, finishes.SplashView(Node content)
Creates a Splash View with the defined content placed at its center, and it will switch to the HOME_VIEW after the splash is hidden.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReadOnlyObjectProperty<Duration>
durationProperty()
A read only object property with the duration of the pause transition used to hide the splash, if the duration is set with the three-argument constructor, or null otherwise.Duration
getDuration()
Gets the value of the property duration.String
getNextView()
Gets the value of the property nextView.void
hideSplashView()
IfDuration
is not specified as an argument when creating the SplashView, hiding the splash and switching to the first view will be responsibility of the developer.ReadOnlyStringProperty
nextViewProperty()
A read only string property with the name of the view that will be loaded after the splash is hiddenprotected void
updateAppBar(AppBar appBar)
If the view uses anAppBar
it is the responsibility of the developer to appropriately set it up in this method.-
Methods inherited from class com.gluonhq.charm.glisten.mvc.View
getApplication, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getShowTransition, getShowTransitionFactory, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setShowTransitionFactory, showingProperty, showTransitionFactoryProperty
-
Methods inherited from class javafx.scene.layout.BorderPane
bottomProperty, centerProperty, clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAlignment, getBottom, getCenter, getContentBias, getLeft, getMargin, getRight, getTop, layoutChildren, leftProperty, rightProperty, setAlignment, setBottom, setCenter, setLeft, setMargin, setRight, setTop, topProperty
-
Methods inherited from class javafx.scene.layout.Pane
getChildren
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
-
Methods inherited from class javafx.scene.Parent
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
Methods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
-
-
-
Property Detail
-
nextView
public final ReadOnlyStringProperty nextViewProperty
A read only string property with the name of the view that will be loaded after the splash is hidden- See Also:
getNextView()
-
duration
public final ReadOnlyObjectProperty<Duration> durationProperty
A read only object property with the duration of the pause transition used to hide the splash, if the duration is set with the three-argument constructor, or null otherwise.- See Also:
getDuration()
-
-
Constructor Detail
-
SplashView
public SplashView()
Default empty constructor. Creates a Splash View, that will switch to the HOME_VIEW after the splash is hidden. Developer has to provide its content, as in a regularView
, and also a way to hide the splash (callinghideSplashView()
) or switch to another view.
-
SplashView
public SplashView(String nextView)
Creates a Splash View, that will switch to the view registered in the factory with the key "nextView", after the splash is hidden. Developer has to provide its content, as in a regularView
, and also a way to hide the splash (callinghideSplashView()
) or switch to another view.- Parameters:
nextView
- The name of the view that will be loaded after the splash is hidden
-
SplashView
public SplashView(Node content)
Creates a Splash View with the defined content placed at its center, and it will switch to the HOME_VIEW after the splash is hidden. Developer has to provide a way to hide the splash (callinghideSplashView()
) or switch to another view.- Parameters:
content
- The content of the splash view to be placed at the center of the view
-
SplashView
public SplashView(String nextView, Node content)
Creates a Splash View with the defined content placed at its center, that will switch to the view registered in the factory with the key "nextView", after the splash is hidden. Developer has to provide a way to hide the splash (callinghideSplashView()
) or switch to another view.- Parameters:
nextView
- The name of the view that will be loaded after the splash is hiddencontent
- The content of the splash view to be placed at the center of the view
-
SplashView
public SplashView(String nextView, Node content, Duration duration)
Creates a Splash View with the defined content placed at its center, that will switch to the view registered in the factory with the key "nextView", when a pause transition with the defined duration, and starting after the splash view is shown, finishes.- Parameters:
nextView
- The name of the view that will be loaded after the splash is hiddencontent
- The content of the splash view to be placed at the center of the viewduration
- of thePauseTransition
-
-
Method Detail
-
getNextView
public final String getNextView()
Gets the value of the property nextView.- Property description:
- A read only string property with the name of the view that will be loaded after the splash is hidden
-
nextViewProperty
public final ReadOnlyStringProperty nextViewProperty()
A read only string property with the name of the view that will be loaded after the splash is hidden- See Also:
getNextView()
-
getDuration
public final Duration getDuration()
Gets the value of the property duration.- Property description:
- A read only object property with the duration of the pause transition used to hide the splash, if the duration is set with the three-argument constructor, or null otherwise.
-
durationProperty
public final ReadOnlyObjectProperty<Duration> durationProperty()
A read only object property with the duration of the pause transition used to hide the splash, if the duration is set with the three-argument constructor, or null otherwise.- See Also:
getDuration()
-
hideSplashView
public void hideSplashView()
-
updateAppBar
protected void updateAppBar(AppBar appBar)
If the view uses anAppBar
it is the responsibility of the developer to appropriately set it up in this method. Every time the view is shown, this method will be called with a "clean"AppBar
i.e. without any elements in it.- Overrides:
updateAppBar
in classView
- Parameters:
appBar
- theAppBar
- See Also:
AppBar.clear()
-
-