Package jmri.swing
Class SystemNameValidator
- java.lang.Object
-
- javax.swing.InputVerifier
-
- com.alexandriasoftware.swing.JInputValidator
-
- jmri.swing.SystemNameValidator
-
public class SystemNameValidator extends com.alexandriasoftware.swing.JInputValidator
AJInputValidatorthat validates aNamedBeansystem name.Until the component gets focus, no validation icon is shown. Once the component has focus the following icons are shown:
- If the component is blank and required was false when the validator was created, no validation is shown.
- If the component is blank and required was true when the validator was created, a warning icon is shown.
- If the component has an invalid system name, an error icon is shown.
- If the component has a potentially valid system name, a waring icon is shown.
- If the component has a valid system name, a success icon is shown.
-
-
Constructor Summary
Constructors Constructor Description SystemNameValidator(javax.swing.JComponent component, Manager<?> manager)Create a SystemNameValidator.SystemNameValidator(javax.swing.JComponent component, Manager<?> manager, boolean required)Create a SystemNameValidator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.alexandriasoftware.swing.ValidationgetValidation(javax.swing.JComponent component, com.alexandriasoftware.swing.JInputValidatorPreferences preferences)booleanisRequired()voidsetManager(Manager<?> manager)Set the Manager used to validate system names.voidsetRequired(boolean required)-
Methods inherited from class com.alexandriasoftware.swing.JInputValidator
addPropertyChangeListener, addPropertyChangeListener, getComponent, getNoneValidation, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getToolTipText, getValidation, isVerifying, removePropertyChangeListener, removePropertyChangeListener, setToolTipText, setValidationPreferences, setVerifying, trimHtmlTags, verify
-
-
-
-
Constructor Detail
-
SystemNameValidator
public SystemNameValidator(@Nonnull javax.swing.JComponent component, @Nonnull Manager<?> manager)
Create a SystemNameValidator. Same as callingSystemNameValidator(javax.swing.JComponent, jmri.Manager, boolean)withrequired == false.- Parameters:
component- the component to validate has a valid system namemanager- the manager that will be used for validation
-
SystemNameValidator
public SystemNameValidator(@Nonnull javax.swing.JComponent component, @Nonnull Manager<?> manager, boolean required)
Create a SystemNameValidator.- Parameters:
component- the component to validate has a valid system namemanager- the manager that will be used for validationrequired- true if input must be valid andInputVerifier.verify(javax.swing.JComponent)must return true to allow focus change; false otherwise
-
-
Method Detail
-
getValidation
protected com.alexandriasoftware.swing.Validation getValidation(javax.swing.JComponent component, com.alexandriasoftware.swing.JInputValidatorPreferences preferences)
- Specified by:
getValidationin classcom.alexandriasoftware.swing.JInputValidator
-
isRequired
public boolean isRequired()
-
setRequired
public void setRequired(boolean required)
-
setManager
public void setManager(@Nonnull Manager<?> manager)
Set the Manager used to validate system names.If the manager changes, fires the a property change for the property
managerand callsJInputValidator.verify(javax.swing.JComponent)to verify any text against the new manager.- Parameters:
manager- the new manager
-
-