totalProperty()). The bar can be customized by setting a
factory for the creation of the segment views. Another factory can be set for
for the creation of info nodes shown by a PopOver.
SegmentedBar bar = new SegmentedBar();
bar.getSegments().addAll(
new Segment(10, "10"),
new Segment(10, "10"),
new Segment(10, "10"),
new Segment(10, "10"),
new Segment(10, "10"),
new Segment(50, "50"));
org.controlsfx.control.SegmentedBar.Segment
typesBar.setSegmentViewFactory(segment -> new TypeSegmentView(segment));
typesBar.setInfoNodeFactory(segment -> new InfoLabel(segment.getText() + " " + segment.getValue() + " GB"));
typesBar.getSegments().addAll(
new TypeSegment(14, MediaType.PHOTOS),
new TypeSegment(32, MediaType.VIDEO),
new TypeSegment(9, MediaType.APPS),
new TypeSegment(40, MediaType.MUSIC),
new TypeSegment(5, MediaType.OTHER),
new TypeSegment(35, MediaType.FREE));
setSegmentViewFactory(Callback), setInfoNodeFactory(Callback)
| Modifier and Type | Class and Description |
|---|---|
| public static class | SegmentedBar.
A model class used by the |
| public class | SegmentedBar.
The view class used by the default segment view factory. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final PseudoClass | |
| private final ObjectProperty | |
| private ObjectProperty | |
| private final ListProperty | |
| private final ObjectProperty | |
| private final InvalidationListener | |
| private final ReadOnlyDoubleWrapper | |
| private static final PseudoClass | |
| private final WeakInvalidationListener |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| public static List | Returns: The CssMetaData associated with this class, which may include the CssMetaData of its super classes.Hides javafx. Gets the |
| public List | getControlCssMetaData()
Overrides javafx. Gets the unmodifiable list of the control's CSS-styleable properties. |
| public final Callback | |
| public final Orientation | Returns: the current orientation of the controlReturns the value of the orientation property. |
| public final ObservableList | Returns: the list of segments shown by the barReturns the list of segments (the model). |
| public final Callback | Returns: the segment view factoryReturns the value of |
| public final double | Returns: the total value of the bar (sum of segments)Returns the value of |
| public String | getUserAgentStylesheet()
Overrides javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. |
| public final ObjectProperty | Returns: the info node factory propertyStores a factory callback for creating nodes that will be shown by a popover when the mouse enters a segment. |
| private void | |
| public final ObjectProperty | Returns: the orientation propertyReturns the styleable object property used for storing the orientation of the segmented bar. |
| public final ListProperty | Returns: the segment listA property used to store the list of segments shown by the bar. |
| public final ObjectProperty | Returns: the property that stores the factoryStores the segment view factory that is used to create one view for each segment added to the control. |
| public void | setInfoNodeFactory(Callback<T, Node>
the info node factory factory)Sets the value of |
| public final void | setOrientation(Orientation
the new orientation (horizontal, vertical). value)Sets the value of the orientation property. |
| public void | setSegments(ObservableList<T>
the list of segments shown by the bar segments)Sets the list of segments (the model). |
| public final void | setSegmentViewFactory(Callback<T, Node>
the segment view factory factory)Sets the value of |
| public final ReadOnlyDoubleProperty | Returns: the total value of the bar (sum of segments)A read-only property that stores the sum of all segment values attached to the bar. |
| DEFAULT_STYLE | back to summary |
|---|---|
| private static final String DEFAULT_STYLE | |
| HORIZONTAL_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass HORIZONTAL_PSEUDOCLASS_STATE | |
| infoNodeFactory | back to summary |
|---|---|
| private final ObjectProperty<Callback<T, Node>> infoNodeFactory | |
| orientation | back to summary |
|---|---|
| private ObjectProperty<Orientation> orientation | |
| segments | back to summary |
|---|---|
| private final ListProperty<T> segments | |
| segmentViewFactory | back to summary |
|---|---|
| private final ObjectProperty<Callback<T, Node>> segmentViewFactory | |
| sumListener | back to summary |
|---|---|
| private final InvalidationListener sumListener | |
| total | back to summary |
|---|---|
| private final ReadOnlyDoubleWrapper total | |
| VERTICAL_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass VERTICAL_PSEUDOCLASS_STATE | |
| weakSumListener | back to summary |
|---|---|
| private final WeakInvalidationListener weakSumListener | |
| SegmentedBar | back to summary |
|---|---|
| public SegmentedBar() Constructs a new segmented bar. | |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. 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
| |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Doc from javafx. Gets the
| |
| getControlCssMetaData | back to summary |
|---|---|
| public List Overrides javafx. Doc from javafx. Gets the unmodifiable list of the control's CSS-styleable properties.
| |
| getInfoNodeFactory | back to summary |
|---|---|
| public final Callback Returns the value of | |
| getOrientation | back to summary |
|---|---|
| public final Orientation getOrientation() Returns the value of the orientation property.
| |
| getSegments | back to summary |
|---|---|
| public final ObservableList Returns the list of segments (the model).
| |
| getSegmentViewFactory | back to summary |
|---|---|
| public final Callback Returns the value of | |
| getTotal | back to summary |
|---|---|
| public final double getTotal() Returns the value of
| |
| getUserAgentStylesheet | back to summary |
|---|---|
| public String getUserAgentStylesheet() Overrides javafx. Doc from javafx. 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.
For additional information about using CSS with the scene graph,
see the CSS Reference Guide.
| |
| infoNodeFactoryProperty | back to summary |
|---|---|
| public final ObjectProperty Stores a factory callback for creating nodes that will be shown by a popover when the mouse enters a segment. The popover / node can provide detailed information about a segment.
| |
| listenToValues | back to summary |
|---|---|
| private void listenToValues() | |
| orientationProperty | back to summary |
|---|---|
| public final ObjectProperty Returns the styleable object property used for storing the orientation of the segmented bar. The CSS property "-fx-orientation" can be used to initialize this value.
| |
| segmentsProperty | back to summary |
|---|---|
| public final ListProperty A property used to store the list of segments shown by the bar.
| |
| segmentViewFactoryProperty | back to summary |
|---|---|
| public final ObjectProperty Stores the segment view factory that is used to create one view for each segment added to the control.
| |
| setInfoNodeFactory | back to summary |
|---|---|
| public void setInfoNodeFactory(Callback<T, Node> factory) Sets the value of | |
| setOrientation | back to summary |
|---|---|
| public final void setOrientation(Orientation value) Sets the value of the orientation property.
| |
| setSegments | back to summary |
|---|---|
| public void setSegments(ObservableList<T> segments) Sets the list of segments (the model).
| |
| setSegmentViewFactory | back to summary |
|---|---|
| public final void setSegmentViewFactory(Callback<T, Node> factory) Sets the value of | |
| totalProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty totalProperty() A read-only property that stores the sum of all segment values attached to the bar.
| |
SegmentedBar control. Applications
usually subclass this type for their own specific needs. A segment always
carries a value and an optional text. Changing the value of the segment
will trigger a rebuild of the control.
| Modifier and Type | Field and Description |
|---|---|
| private final StringProperty | |
| private final DoubleProperty |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final String | |
| public final double | |
| public final void | |
| public final void | |
| public final StringProperty | |
| public final DoubleProperty |
| text | back to summary |
|---|---|
| private final StringProperty text | |
| value | back to summary |
|---|---|
| private final DoubleProperty value | |
| Segment | back to summary |
|---|---|
| public Segment(double value) Constructs a new segment with the given value.
| |
| Segment | back to summary |
|---|---|
| public Segment(double value, String text) Constructs a new segment with the given value.
| |
| getText | back to summary |
|---|---|
| public final String getText() Returns the value of
| |
| getValue | back to summary |
|---|---|
| public final double getValue() Returns the value of
| |
| setText | back to summary |
|---|---|
| public final void setText(String text) Sets the value of
| |
| setValue | back to summary |
|---|---|
| public final void setValue(double value) Sets the value of
| |
| textProperty | back to summary |
|---|---|
| public final StringProperty textProperty() Stores the text of the segment (optional).
| |
| valueProperty | back to summary |
|---|---|
| public final DoubleProperty valueProperty() Stores the current value of the segment. The value has to be larger or equal to zero.
| |
setSegmentViewFactory(Callback)
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | layoutChildren()
Overrides javafx. The layout method has been overridden to ensure that the label used for displaying the text of a segment will be made invisible when there is not enough space to show the entire text. |
| label | back to summary |
|---|---|
| private Label label | |
| SegmentView | back to summary |
|---|---|
| public SegmentView(T segment) Constructs a new segment view.
| |
| layoutChildren | back to summary |
|---|---|
| protected void layoutChildren() Overrides javafx. The layout method has been overridden to ensure that the label used for displaying the text of a segment will be made invisible when there is not enough space to show the entire text.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final CssMetaData | |
| private static final List |
| Access | Constructor and Description |
|---|---|
| private |
| ORIENTATION | back to summary |
|---|---|
| private static final CssMetaData<SegmentedBar<T extends SegmentedBar. | |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |