Top Inners Fields Constructors Methods
com.dlsc.gemsfx.skins

public Class TimePickerPopup

extends HBox
Class Inheritance
Imports
com.dlsc.gemsfx.TimePicker, .TimePicker.Format, javafx.application.Platform, javafx.beans.InvalidationListener, .Observable, javafx.beans.binding.Bindings, javafx.scene.control.ContentDisplay, .Label, .ListCell, .ListView, javafx.scene.layout.HBox, .Region, java.time.LocalTime, java.util.Objects

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
private class
private class
public abstract static class

Field Summary

Modifier and TypeField and Description
private final ListView<Integer>
private final ListView<Integer>
private final ListView<Integer>
private final ListView<Integer>
private final TimePicker

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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.

private void
private int
millisecondToNano(int millisecond)

private int
private boolean
shouldDisable(Integer hour, Integer minute, Integer second, Integer millisecond)

private void
private void
private void
updateSecondMillisecondView(boolean secondVisible, boolean millisecondVisible)

private void
Inherited from javafx.scene.layout.HBox:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthfillHeightPropertygetAlignmentgetBaselineOffsetgetClassCssMetaDatagetContentBiasgetCssMetaDatagetHgrowgetMargingetSpacingisFillHeightlayoutChildrenrequestLayoutsetAlignmentsetFillHeightsetHgrowsetMarginsetSpacingspacingProperty

Field Detail

hourListViewback to summary
private final ListView<Integer> hourListView
millisecondListViewback to summary
private final ListView<Integer> millisecondListView
minuteListViewback to summary
private final ListView<Integer> minuteListView
secondListViewback to summary
private final ListView<Integer> secondListView
timePickerback to summary
private final TimePicker timePicker

Constructor Detail

TimePickerPopupback to summary
public TimePickerPopup(TimePicker timePicker)

Method Detail

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
initializePopupViewback to summary
private void initializePopupView()
millisecondToNanoback to summary
private int millisecondToNano(int millisecond)
nanoToMillisecondback to summary
private int nanoToMillisecond(int nano)
shouldDisableback to summary
private boolean shouldDisable(Integer hour, Integer minute, Integer second, Integer millisecond)
updateListsback to summary
private void updateLists()
updateListViewSelectionback to summary
private void updateListViewSelection()
updateSecondMillisecondViewback to summary
private void updateSecondMillisecondView(boolean secondVisible, boolean millisecondVisible)
updateTimeUnitback to summary
private void updateTimeUnit()
com.dlsc.gemsfx.skins back to summary

private Class TimePickerPopup.HourCell

extends TimeCell
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Constructor Detail

HourCellback to summary
public HourCell()

Method Detail

updateItemback to summary
protected void updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override
com.dlsc.gemsfx.skins back to summary

private Class TimePickerPopup.MillisecondCell

extends TimeCell
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Constructor Detail

MillisecondCellback to summary
public MillisecondCell()

Method Detail

updateItemback to summary
protected void updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override
com.dlsc.gemsfx.skins back to summary

private Class TimePickerPopup.MinuteCell

extends TimeCell
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Constructor Detail

MinuteCellback to summary
public MinuteCell()

Method Detail

updateItemback to summary
protected void updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override
com.dlsc.gemsfx.skins back to summary

private Class TimePickerPopup.SecondCell

extends TimeCell
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Constructor Detail

SecondCellback to summary
public SecondCell()

Method Detail

updateItemback to summary
protected void updateItem(Integer item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override
com.dlsc.gemsfx.skins back to summary

public abstract Class TimePickerPopup.TimeCell

extends ListCell<Integer>
Class Inheritance
Known Direct Subclasses
com.dlsc.gemsfx.skins.TimePickerPopup.HourCell, com.dlsc.gemsfx.skins.TimePickerPopup.MinuteCell, com.dlsc.gemsfx.skins.TimePickerPopup.SecondCell, com.dlsc.gemsfx.skins.TimePickerPopup.MillisecondCell

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from javafx.scene.control.ListCell:
cancelEditcommitEditcreateDefaultSkinexecuteAccessibleActiongetListViewlayoutChildrenlistViewPropertyqueryAccessibleAttributestartEditupdateListView

Constructor Detail

TimeCellback to summary
public TimeCell()