Class TimeValidator
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.ChangeNotifier
-
- org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator
-
- org.openstreetmap.josm.gui.dialogs.changeset.query.TimeValidator
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.FocusListener
,java.beans.PropertyChangeListener
,java.util.EventListener
,javax.swing.event.DocumentListener
public class TimeValidator extends AbstractTextComponentValidator
Validates time values entered as text in aJTextComponent
. Validates the input on the fly and gives feedback about whether the time value is valid or not. Time values 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 TimeValidator(javax.swing.text.JTextComponent tc)
Constructs a newTimeValidator
for the given text component.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TimeValidator
decorate(javax.swing.text.JTextComponent tc)
Decorates the given text component.java.lang.String
getStandardTooltipText()
Returns the standard tooltip text.java.lang.String
getStandardTooltipTextAsHtml()
Returns the standard tooltip text as HTML.java.time.LocalTime
getTime()
Returns the time.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
-
TimeValidator
public TimeValidator(javax.swing.text.JTextComponent tc)
Constructs a newTimeValidator
for the given text component.- Parameters:
tc
- text component
-
-
Method Detail
-
decorate
public static TimeValidator decorate(javax.swing.text.JTextComponent tc)
Decorates the given text component.- Parameters:
tc
- text component to decorate- Returns:
- new time 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
-
getTime
public java.time.LocalTime getTime()
Returns the time.- Returns:
- the time
-
-