Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class BeforeAfterView

extends Control
Class Inheritance
Imports
com.dlsc.gemsfx.skins.BeforeAfterViewSkin, javafx.beans.property.DoubleProperty, .ObjectProperty, .SimpleDoubleProperty, .SimpleObjectProperty, javafx.css.CssMetaData, .PseudoClass, .Styleable, .StyleableObjectProperty, .StyleableProperty, javafx.css.converter.EnumConverter, javafx.geometry.Orientation, .Pos, javafx.scene.Node, javafx.scene.control.Control, .Label, .Skin, javafx.scene.image.Image, .ImageView, java.util.ArrayList, .Collections, .List, .Objects

A view capable of managing / displaying two nodes in such a way that the user can show more or less of each node at the same time. This is very useful to display before and after scenarios.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Node>
private final ObjectProperty<Node>
private static final Orientation
private final DoubleProperty
private ObjectProperty<Orientation>
private static final PseudoClass
private static final PseudoClass

Constructor Summary

AccessConstructor and Description
public
BeforeAfterView()

Constructs a new view.

public
BeforeAfterView(Node
the node showing the "before" state
beforeNode
,
Node
the node showing the "after" state
afterNode
)

Constructs a new view with the given before and after nodes.

public
BeforeAfterView(Image
a "before" image that will be wrapped in an image view
beforeImage
,
Image
an "after" image that will be wrapped in an image view
afterImage
)

Constructs a new view with the given before and after images.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Node>

Returns:

the node used to visualize "after"
afterProperty
()

Stores the node used for displaying the "after" state.

public final ObjectProperty<Node>

Returns:

the node used to visualize "before"
beforeProperty
()

Stores the node used for displaying the "before" state.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final DoubleProperty

Returns:

the divider position
dividerPositionProperty
()

Stores the position of the divider within the value range of zero to 1.

public final Node
public final Node
public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final double
public final Orientation
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<Orientation>

Returns:

the orientation property
orientationProperty
()

Sets the orientation of the before / after view.

public final void
setAfter(Node after)

public final void
setBefore(Node before)

public final void
setDividerPosition(double dividerPosition)

public final void
private void
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

afterback to summary
private final ObjectProperty<Node> after
beforeback to summary
private final ObjectProperty<Node> before
DEFAULT_ORIENTATIONback to summary
private static final Orientation DEFAULT_ORIENTATION
dividerPositionback to summary
private final DoubleProperty dividerPosition
orientationback to summary
private ObjectProperty<Orientation> orientation
PSEUDO_CLASS_HORIZONTALback to summary
private static final PseudoClass PSEUDO_CLASS_HORIZONTAL
PSEUDO_CLASS_VERTICALback to summary
private static final PseudoClass PSEUDO_CLASS_VERTICAL

Constructor Detail

BeforeAfterViewback to summary
public BeforeAfterView()

Constructs a new view. the two nodes have to be set or bound later.

See Also
beforeProperty(), afterProperty()
BeforeAfterViewback to summary
public BeforeAfterView(Node beforeNode, Node afterNode)

Constructs a new view with the given before and after nodes.

Parameters
beforeNode:Node

the node showing the "before" state

afterNode:Node

the node showing the "after" state

BeforeAfterViewback to summary
public BeforeAfterView(Image beforeImage, Image afterImage)

Constructs a new view with the given before and after images.

Parameters
beforeImage:Image

a "before" image that will be wrapped in an image view

afterImage:Image

an "after" image that will be wrapped in an image view

Method Detail

afterPropertyback to summary
public final ObjectProperty<Node> afterProperty()

Stores the node used for displaying the "after" state.

Returns:ObjectProperty<Node>

the node used to visualize "after"

beforePropertyback to summary
public final ObjectProperty<Node> beforeProperty()

Stores the node used for displaying the "before" state.

Returns:ObjectProperty<Node>

the node used to visualize "before"

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
dividerPositionPropertyback to summary
public final DoubleProperty dividerPositionProperty()

Stores the position of the divider within the value range of zero to 1.

Returns:DoubleProperty

the divider position

getAfterback to summary
public final Node getAfter()
getBeforeback to summary
public final Node getBefore()
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Doc from javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
getDividerPositionback to summary
public final double getDividerPosition()
getOrientationback to summary
public final Orientation getOrientation()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
orientationPropertyback to summary
public final ObjectProperty<Orientation> orientationProperty()

Sets the orientation of the before / after view.

Default value is Orientation#HORIZONTAL

Returns:ObjectProperty<Orientation>

the orientation property

setAfterback to summary
public final void setAfter(Node after)
setBeforeback to summary
public final void setBefore(Node before)
setDividerPositionback to summary
public final void setDividerPosition(double dividerPosition)
setOrientationback to summary
public final void setOrientation(Orientation orientation)
updatePseudoClassback to summary
private void updatePseudoClass()
com.dlsc.gemsfx back to summary

private Class BeforeAfterView.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<BeforeAfterView, Orientation>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ORIENTATIONback to summary
private static final CssMetaData<BeforeAfterView, Orientation> ORIENTATION
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()