public class SplashView extends View
View
intended to be used only as a first-time splash view.
It will be the first view displayed and, should a Duration
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 key
MobileApplication.SPLASH_VIEW
.
There are a few constructors available. If Duration
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 calling hideSplashView()
, 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;
});
Or fired when a transition ends, like in this case that makes use of a 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;
});
On the contrary, if 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));
});
Note that the SplashView will be removed from the factory after it is hidden, to avoid
returning to it if the Android Back button is pressed.
The only way to load the splash again will be registering it and calling
MobileApplication.switchView(SPLASH_VIEW)
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyObjectProperty<javafx.util.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.
|
javafx.beans.property.ReadOnlyStringProperty |
nextView
A read only string property with the name of the view that will be loaded after the
splash is hidden
|
name, onCloseRequest, onHidden, onHiding, onShowing, onShown, showing, showTransitionFactory
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, 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, visible
DEFAULT_ANIMATION_DURATION, DEFAULT_BACKGROUND_FADE_LEVEL
Constructor and Description |
---|
SplashView()
Default empty constructor.
|
SplashView(javafx.scene.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.
|
SplashView(java.lang.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(java.lang.String nextView,
javafx.scene.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(java.lang.String nextView,
javafx.scene.Node content,
javafx.util.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.
|
Modifier and Type | Method and Description |
---|---|
javafx.beans.property.ReadOnlyObjectProperty<javafx.util.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.
|
javafx.util.Duration |
getDuration()
Gets the value of the property duration.
|
java.lang.String |
getNextView()
Gets the value of the property nextView.
|
void |
hideSplashView()
If
Duration 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. |
javafx.beans.property.ReadOnlyStringProperty |
nextViewProperty()
A read only string property with the name of the view that will be loaded after the
splash is hidden
|
protected void |
updateAppBar(AppBar appBar)
If the view uses an
AppBar it is the responsibility of the developer
to appropriately set it up in this method. |
getApplication, getName, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getShowTransition, getShowTransitionFactory, isShowing, nameProperty, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, setName, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setShowTransitionFactory, showingProperty, showTransitionFactoryProperty
getLayers, layoutChildren
bottomProperty, centerProperty, clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAlignment, getBottom, getCenter, getContentBias, getLeft, getMargin, getRight, getTop, leftProperty, rightProperty, setAlignment, setBottom, setCenter, setLeft, setMargin, setRight, setTop, topProperty
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, 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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, 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, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public final javafx.beans.property.ReadOnlyStringProperty nextViewProperty
getNextView()
public final javafx.beans.property.ReadOnlyObjectProperty<javafx.util.Duration> durationProperty
getDuration()
public SplashView()
View
, and also
a way to hide the splash (calling hideSplashView()
)
or switch to another view.public SplashView(java.lang.String nextView)
View
, and also
a way to hide the splash (calling hideSplashView()
)
or switch to another view.nextView
- The name of the view that will be loaded after the splash
is hiddenpublic SplashView(javafx.scene.Node content)
hideSplashView()
)
or switch to another view.content
- The content of the splash view to be placed at the center of the viewpublic SplashView(java.lang.String nextView, javafx.scene.Node content)
hideSplashView()
)
or switch to another view.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 viewpublic SplashView(java.lang.String nextView, javafx.scene.Node content, javafx.util.Duration duration)
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 the PauseTransition
public final java.lang.String getNextView()
public final javafx.beans.property.ReadOnlyStringProperty nextViewProperty()
getNextView()
public final javafx.util.Duration getDuration()
public final javafx.beans.property.ReadOnlyObjectProperty<javafx.util.Duration> durationProperty()
getDuration()
public void hideSplashView()
Duration
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. This method can be called at the desired time to switch to
the nextView
View, hidding the splash in the process.protected void updateAppBar(AppBar appBar)
AppBar
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.updateAppBar
in class View
appBar
- the AppBar
AppBar.clear()