Class DateValidator
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.ChangeNotifier
-
- org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator
-
- org.openstreetmap.josm.gui.dialogs.changeset.query.DateValidator
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.FocusListener
,java.beans.PropertyChangeListener
,java.util.EventListener
,javax.swing.event.DocumentListener
public class DateValidator extends AbstractTextComponentValidator
Validates dates entered as text in aJTextComponent
. Validates the input on the fly and gives feedback about whether the date is valid or not. Dates can be entered in one of four standard formats defined for the current locale.- Since:
- 11326 (extracted from AdvancedChangesetQueryPanel)
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator
ERROR_BACKGROUND, ERROR_BORDER, ERROR_COLOR, VALID_BORDER, VALID_COLOR, WARNING_BACKGROUND, WARNING_BORDER, WARNING_COLOR, WARNING_FOREGROUND
-
-
Constructor Summary
Constructors Constructor Description DateValidator(javax.swing.text.JTextComponent tc)
Constructs a newDateValidator
for the given text component.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DateValidator
decorate(javax.swing.text.JTextComponent tc)
Decorates the given text component.java.time.LocalDate
getDate()
Returns the date.java.lang.String
getStandardTooltipText()
Returns the standard tooltip text.java.lang.String
getStandardTooltipTextAsHtml()
Returns the standard tooltip text as HTML.boolean
isValid()
Replies true if the current content of the decorated text component is valid; false otherwisevoid
validate()
Implement in subclasses to validate the content of the text component.-
Methods inherited from class org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator
actionPerformed, changedUpdate, feedbackDisabled, feedbackInvalid, feedbackValid, feedbackWarning, focusGained, focusLost, getComponent, insertUpdate, propertyChange, removeUpdate
-
Methods inherited from class org.openstreetmap.josm.gui.util.ChangeNotifier
addChangeListener, fireStateChanged, removeChangeListener
-
-
-
-
Constructor Detail
-
DateValidator
public DateValidator(javax.swing.text.JTextComponent tc)
Constructs a newDateValidator
for the given text component.- Parameters:
tc
- text component
-
-
Method Detail
-
decorate
public static DateValidator decorate(javax.swing.text.JTextComponent tc)
Decorates the given text component.- Parameters:
tc
- text component to decorate- Returns:
- new date validator attached to
tc
-
isValid
public boolean isValid()
Description copied from class:AbstractTextComponentValidator
Replies true if the current content of the decorated text component is valid; false otherwise- Specified by:
isValid
in classAbstractTextComponentValidator
- Returns:
- true if the current content of the decorated text component is valid
-
getStandardTooltipTextAsHtml
public java.lang.String getStandardTooltipTextAsHtml()
Returns the standard tooltip text as HTML.- Returns:
- the standard tooltip text as HTML
-
getStandardTooltipText
public java.lang.String getStandardTooltipText()
Returns the standard tooltip text.- Returns:
- the standard tooltip text
-
validate
public void validate()
Description copied from class:AbstractTextComponentValidator
Implement in subclasses to validate the content of the text component.- Specified by:
validate
in classAbstractTextComponentValidator
-
getDate
public java.time.LocalDate getDate()
Returns the date.- Returns:
- the date
-
-