Class DateSpinner3D

All Implemented Interfaces:
Animation, Editable, StyleListener, InternalPickerWidget, Iterable<Component>

public class DateSpinner3D extends Container implements InternalPickerWidget

Three wheels -- day, month and year -- that together select one date inside a configured range.

The body of a lightweight Picker of type date, and usable on its own as an ordinary Container when a form wants the wheels inline rather than in a dialog. The range is set with #setStartYear(int) and #setEndYear(int); a value outside it is clamped.

getValue() and setValue(Object) carry a java.util.Date. The wheels select only the date, but the time of day of whatever was last passed to setValue is remembered and handed back by getValue, so a round trip through this widget does not silently move a timestamp to midnight.

  • Constructor Details

    • DateSpinner3D

      public DateSpinner3D()
      Default constructor
  • Method Details

    • initComponent

      protected void initComponent()
      Description copied from class: Component
      Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
      Overrides:
      initComponent in class Component
    • setDateRange

      public void setDateRange(Date start, Date end)

      Sets the start and end dates in this spinner. Month range is only limited if the year of the start and end dates are the same. Day range is only limited if both the year and month of the start and end dates are the same.

      Parameters
      • start: The start date.

      • end: The end date

    • getStartMonth

      public int getStartMonth()
      Gets the start month of this Spinner.
    • getEndMonth

      public int getEndMonth()
      Gets the end month of this spinner.
    • getStartDay

      public int getStartDay()
      Gets the start day of month.
    • getEndDay

      public int getEndDay()
      Gets the end day of month.
    • getStartYear

      public int getStartYear()
      Returns

      the startYear

    • setStartYear

      public void setStartYear(int startYear)
      Parameters
      • startYear: the startYear to set
    • getEndYear

      public int getEndYear()
      Returns

      the endYear

    • setEndYear

      public void setEndYear(int endYear)
      Parameters
      • endYear: the endYear to set
    • getCurrentYear

      public int getCurrentYear()
      Returns

      the currentYear

    • setCurrentYear

      public void setCurrentYear(int currentYear)
      Parameters
      • currentYear: the currentYear to set
    • getCurrentDay

      public int getCurrentDay()
      Returns

      the currentDay

    • setCurrentDay

      public void setCurrentDay(int currentDay)
      Parameters
      • currentDay: the currentDay to set
    • getCurrentMonth

      public int getCurrentMonth()
      Returns

      the currentMonth

    • setCurrentMonth

      public void setCurrentMonth(int currentMonth)
      Parameters
      • currentMonth: the currentMonth to set
    • isMonthDayYear

      public boolean isMonthDayYear()
      Returns

      the monthDayYear

    • setMonthDayYear

      public void setMonthDayYear(boolean monthDayYear)
      Parameters
      • monthDayYear: the monthDayYear to set
    • isNumericMonths

      public boolean isNumericMonths()
      Returns

      the numericMonths

    • setNumericMonths

      public void setNumericMonths(boolean numericMonths)
      Parameters
      • numericMonths: the numericMonths to set
    • getPropertyNames

      public String[] getPropertyNames()

      A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

      Returns

      the property names allowing mutation

      Overrides:
      getPropertyNames in class Component
    • getPropertyTypes

      public Class[] getPropertyTypes()

      Matches the property names method (see that method for further details).

      Returns

      the types of the properties

      Overrides:
      getPropertyTypes in class Component
    • getPropertyValue

      public Object getPropertyValue(String name)

      Returns the current value of the property name, this method is used by the GUI builder

      Parameters
      • name: the name of the property
      Returns

      the value of said property

      Overrides:
      getPropertyValue in class Component
    • setPropertyValue

      public String setPropertyValue(String name, Object value)

      Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

      Parameters
      • name: the name of the property

      • value: new value for the property

      Returns

      error message or null

      Overrides:
      setPropertyValue in class Component
    • getValue

      public Object getValue()
      Description copied from interface: InternalPickerWidget

      The currently selected value.

      Returns

      the selection, in whatever type this implementation documents; never null once the widget has been laid out

      Specified by:
      getValue in interface InternalPickerWidget
    • setValue

      public void setValue(Object value)
      Description copied from interface: InternalPickerWidget

      Moves the selection to value.

      The widget scrolls to the new selection rather than jumping, when it is already on screen.

      Parameters
      • value: the new selection, in the type this implementation documents. A value outside the widget's range is clamped into it.
      Specified by:
      setValue in interface InternalPickerWidget
    • paint

      public void paint(Graphics g)
      Description copied from class: Container

      This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

      Parameters
      • g: the component graphics
      Specified by:
      paint in interface Animation
      Overrides:
      paint in class Container