modules/controls/src/main/java/javafx/scene/control/SpinnerValueFactory.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization


   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control;
  26 
  27 import com.sun.javafx.scene.control.skin.ListViewSkin;
  28 import javafx.beans.NamedArg;
  29 import javafx.beans.property.BooleanProperty;
  30 import javafx.beans.property.DoubleProperty;
  31 import javafx.beans.property.IntegerProperty;
  32 import javafx.beans.property.LongProperty;
  33 import javafx.beans.property.ObjectProperty;
  34 import javafx.beans.property.SimpleBooleanProperty;
  35 import javafx.beans.property.SimpleDoubleProperty;
  36 import javafx.beans.property.SimpleIntegerProperty;
  37 import javafx.beans.property.SimpleLongProperty;
  38 import javafx.beans.property.SimpleObjectProperty;
  39 import javafx.beans.value.ChangeListener;
  40 import javafx.beans.value.WeakChangeListener;
  41 import javafx.collections.ListChangeListener;
  42 import javafx.collections.ObservableList;
  43 import javafx.collections.WeakListChangeListener;
  44 import javafx.util.StringConverter;
  45 import javafx.util.converter.IntegerStringConverter;
  46 
  47 import java.lang.ref.WeakReference;
  48 import java.math.BigDecimal;
  49 import java.text.DecimalFormat;
  50 import java.text.NumberFormat;
  51 import java.text.ParseException;
  52 import java.time.Duration;
  53 import java.time.Instant;
  54 import java.time.LocalDate;
  55 import java.time.LocalTime;
  56 import java.time.format.DateTimeFormatter;
  57 import java.time.format.FormatStyle;
  58 import java.time.temporal.ChronoUnit;
  59 import java.time.temporal.Temporal;
  60 import java.time.temporal.TemporalField;
  61 import java.time.temporal.TemporalUnit;
  62 import java.util.List;
  63 
  64 /**
  65  * The SpinnerValueFactory is the model behind the JavaFX
  66  * {@link Spinner Spinner control} - without a value factory installed a
  67  * Spinner is unusable. It is the role of the value factory to handle almost all
  68  * aspects of the Spinner, including:
  69  *
  70  * <ul>
  71  *     <li>Representing the current state of the {@link javafx.scene.control.SpinnerValueFactory#valueProperty() value},</li>
  72  *     <li>{@link SpinnerValueFactory#increment(int) Incrementing}
  73  *         and {@link SpinnerValueFactory#decrement(int) decrementing} the
  74  *         value, with one or more steps per call,</li>
  75  *     <li>{@link javafx.scene.control.SpinnerValueFactory#converterProperty() Converting} text input
  76  *         from the user (via the Spinner {@link Spinner#editorProperty() editor},</li>
  77  *     <li>Converting {@link javafx.scene.control.SpinnerValueFactory#converterProperty() objects to user-readable strings}
  78  *         for display on screen</li>
  79  * </ul>
  80  *




   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control;
  26 

  27 import javafx.beans.NamedArg;
  28 import javafx.beans.property.BooleanProperty;
  29 import javafx.beans.property.DoubleProperty;
  30 import javafx.beans.property.IntegerProperty;
  31 import javafx.beans.property.LongProperty;
  32 import javafx.beans.property.ObjectProperty;
  33 import javafx.beans.property.SimpleBooleanProperty;
  34 import javafx.beans.property.SimpleDoubleProperty;
  35 import javafx.beans.property.SimpleIntegerProperty;
  36 import javafx.beans.property.SimpleLongProperty;
  37 import javafx.beans.property.SimpleObjectProperty;


  38 import javafx.collections.ListChangeListener;
  39 import javafx.collections.ObservableList;
  40 import javafx.collections.WeakListChangeListener;
  41 import javafx.util.StringConverter;
  42 import javafx.util.converter.IntegerStringConverter;
  43 
  44 import java.lang.ref.WeakReference;
  45 import java.math.BigDecimal;
  46 import java.text.DecimalFormat;

  47 import java.text.ParseException;
  48 import java.time.Duration;

  49 import java.time.LocalDate;
  50 import java.time.LocalTime;
  51 import java.time.format.DateTimeFormatter;
  52 import java.time.format.FormatStyle;
  53 import java.time.temporal.ChronoUnit;


  54 import java.time.temporal.TemporalUnit;
  55 import java.util.List;
  56 
  57 /**
  58  * The SpinnerValueFactory is the model behind the JavaFX
  59  * {@link Spinner Spinner control} - without a value factory installed a
  60  * Spinner is unusable. It is the role of the value factory to handle almost all
  61  * aspects of the Spinner, including:
  62  *
  63  * <ul>
  64  *     <li>Representing the current state of the {@link javafx.scene.control.SpinnerValueFactory#valueProperty() value},</li>
  65  *     <li>{@link SpinnerValueFactory#increment(int) Incrementing}
  66  *         and {@link SpinnerValueFactory#decrement(int) decrementing} the
  67  *         value, with one or more steps per call,</li>
  68  *     <li>{@link javafx.scene.control.SpinnerValueFactory#converterProperty() Converting} text input
  69  *         from the user (via the Spinner {@link Spinner#editorProperty() editor},</li>
  70  *     <li>Converting {@link javafx.scene.control.SpinnerValueFactory#converterProperty() objects to user-readable strings}
  71  *         for display on screen</li>
  72  * </ul>
  73  *