Class WDateEdit


public class WDateEdit
extends WLineEdit
A date edit.

A date picker is a line edit with support for date entry (using an icon and a calendar).

A WDateValidator is used to validate date entry.

In many cases, it provides a more convenient implementation of a date picker compared to WDatePicker since it is implemented as a line edit. This also makes the implementation ready for a native HTML5 control.

  • Constructor Details

  • Method Details

    • remove

      public void remove()
      Description copied from class: WFormWidget
      Destructor.
      Overrides:
      remove in class WFormWidget
      See Also:
      WWidget.removeWidget(WWidget widget)
    • setDate

      public void setDate​(WDate date)
      Sets the date.

      Does nothing if the current date is Null.

      See Also:
      getDate()
    • getDate

      public WDate getDate()
      Returns the date.

      Reads the current date.

      Returns null if the date could not be parsed using the current getFormat().

      See Also:
      setDate(WDate date), WLineEdit.getText()
    • getDateValidator

      public WDateValidator getDateValidator()
      Returns the validator.

      Most of the configuration of the date edit is stored in the validator.

    • setFormat

      public void setFormat​(java.lang.String format)
      Sets the format used for representing the date.

      This sets the format in the validator.

      The default format is based on the current WLocale.

      See Also:
      WDateValidator.setFormat(String format)
    • getFormat

      public java.lang.String getFormat()
      Returns the format.

      See Also:
      setFormat(String format)
    • setBottom

      public void setBottom​(WDate bottom)
      Sets the lower limit of the valid date range.

      This sets the lower limit of the valid date range in the validator.

      See Also:
      WDateValidator.setBottom(WDate bottom)
    • getBottom

      public WDate getBottom()
      Returns the lower limit of the valid date range.

      See Also:
      setBottom(WDate bottom)
    • setTop

      public void setTop​(WDate top)
      Sets the upper limit of the valid date range.

      This sets the upper limit of the valid date range in the validator.

      See Also:
      WDateValidator.setTop(WDate top)
    • getTop

      public WDate getTop()
      Returns the upper limit of the valid range.

      See Also:
      setTop(WDate top)
    • getCalendar

      public WCalendar getCalendar()
      Returns the calendar widget.

      The calendar may be 0 (e.g. when using a native date entry widget).

    • setHidden

      public void setHidden​(boolean hidden, WAnimation animation)
      Hide/unhide the widget.
      Overrides:
      setHidden in class WFormWidget
    • load

      public void load()
      Description copied from class: WWidget
      Loads content just before the widget is used.

      This method is called after a widget is inserted in the widget hierarchy and fully constructed, but before the widget is rendered. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). This method is called when the widget is directly or indirectly inserted into the widget tree.

      The default implementation simply propagates the load signal to its children. You may want to override this method to delay loading of resource-intensive contents.

      During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initializiation only once.

      Overrides:
      load in class WInteractWidget
    • refresh

      public void refresh()
      Description copied from class: WWidget
      Refresh the widget.

      The refresh method is invoked when the locale is changed using WApplication#setLocale() or when the user hit the refresh button.

      The widget must actualize its contents in response.

      Note: This does **not** rerender the widget! Calling refresh() usually does not have any effect (unless you've reimplemented refresh() to attach to it an effect).

      Overrides:
      refresh in class WFormWidget
    • render

      protected void render​(java.util.EnumSet<RenderFlag> flags)
      Description copied from class: WWidget
      Renders the widget.

      This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

      The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

      Overrides:
      render in class WLineEdit
    • propagateSetEnabled

      protected void propagateSetEnabled​(boolean enabled)
      Description copied from class: WWidget
      Propagates that a widget was enabled or disabled through children.

      When enabling or disabling a widget, you usually also want to disable contained children. This method is called by setDisabled() to propagate its state to all children.

      You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.

      Overrides:
      propagateSetEnabled in class WFormWidget
    • setFromCalendar

      protected void setFromCalendar()
      Sets the value from the calendar to the line edit.
    • setFromLineEdit

      protected void setFromLineEdit()
      Sets the value from the line edit to the calendar.