Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class YearPicker

extends CustomComboBox<Year>
Class Inheritance
Imports
com.dlsc.gemsfx.skins.YearPickerSkin, javafx.application.Platform, javafx.beans.property.ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, javafx.css.PseudoClass, javafx.scene.control.Skin, .TextField, .TextFormatter, javafx.scene.input.KeyCode, .KeyEvent, javafx.scene.layout.Region, javafx.util.converter.NumberStringConverter, org.apache.commons.lang3.StringUtils, java.text.DecimalFormat, .ParsePosition, java.time.Year, java.util.Objects, java.util.function.UnaryOperator

A control for selecting a year. This class utilizes the YearView control inside of its popup.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final YearPicker.NumberStringFilteredConverter
private final TextField
private final ReadOnlyObjectWrapper<Integer>
private YearView

Constructor Summary

AccessConstructor and Description
public
YearPicker()

Constructs a new year picker.

Method Summary

Modifier and TypeMethod and Description
private void
private void
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

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

public final TextField

Returns:

the editor / text field
getEditor
()

Returns the text field control used for manual input.

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 Integer
public YearView

Returns:

the view showing the years
getYearView
()

Returns the view that is being used by the picker to let the user chose a year.

private void
private void
public final ReadOnlyObjectProperty<Integer>
Inherited from com.dlsc.gemsfx.CustomComboBox:
buttonDisplayPropertygetButtonDisplaygetClassCssMetaDatagetControlCssMetaDatasetButtonDisplay

Field Detail

converterback to summary
private final YearPicker.NumberStringFilteredConverter converter
editorback to summary
private final TextField editor
yearback to summary
private final ReadOnlyObjectWrapper<Integer> year
yearViewback to summary
private YearView yearView

Constructor Detail

YearPickerback to summary
public YearPicker()

Constructs a new year picker.

Method Detail

commitback to summary
private void commit()
commitValueAndShowback to summary
private void commitValueAndShow()
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
getEditorback to summary
public final TextField getEditor()

Returns the text field control used for manual input.

Returns:TextField

the editor / text field

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
getYearback to summary
public final Integer getYear()
getYearViewback to summary
public YearView getYearView()

Returns the view that is being used by the picker to let the user chose a year.

Returns:YearView

the view showing the years

placeCaretAtEndback to summary
private void placeCaretAtEnd()
updateTextAndHidePopupback to summary
private void updateTextAndHidePopup(Year value)
yearPropertyback to summary
public final ReadOnlyObjectProperty<Integer> yearProperty()
com.dlsc.gemsfx back to summary

pack-priv Class YearPicker.NumberStringFilteredConverter

extends NumberStringConverter
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv UnaryOperator<TextFormatter.Change>
Inherited from javafx.util.converter.NumberStringConverter:
fromStringgetNumberFormattoString

Constructor Detail

NumberStringFilteredConverterback to summary
public NumberStringFilteredConverter()

Method Detail

getFilterback to summary
pack-priv UnaryOperator<TextFormatter.Change> getFilter()