Class RegExFormatter
java.lang.Object
javax.swing.JFormattedTextField.AbstractFormatter
javax.swing.text.DefaultFormatter
com.inductiveautomation.factorypmi.application.components.util.RegExFormatter
- All Implemented Interfaces:
- Serializable,- Cloneable
A regular expression based implementation of 
AbstractFormatter.- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionRegExFormatter(String pattern) Creates a regular expression basedAbstractFormatter.RegExFormatter(Pattern pattern) Creates a regular expression basedAbstractFormatter.
- 
Method SummaryModifier and TypeMethodDescriptionprotected MatcherReturns theMatcherfrom the most test.Returns thePatternused to determine if a value is legal.protected voidsetMatcher(Matcher matcher) Sets theMatcherused in the most recent test if a value is legal.voidsetPattern(String strPattern) Sets the pattern that will be used to determine if a value is legal.voidsetPattern(Pattern pattern) Sets the pattern that will be used to determine if a value is legal.stringToValue(String text) Parsestextreturning an arbitrary Object.Methods inherited from class javax.swing.text.DefaultFormatterclone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, install, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass, valueToStringMethods inherited from class javax.swing.JFormattedTextField.AbstractFormattergetActions, getFormattedTextField, invalidEdit, setEditValid, uninstall
- 
Constructor Details- 
RegExFormatterpublic RegExFormatter()
- 
RegExFormatterCreates a regular expression basedAbstractFormatter.patternspecifies the regular expression that will be used to determine if a value is legal.- Throws:
- PatternSyntaxException
 
- 
RegExFormatterCreates a regular expression basedAbstractFormatter.patternspecifies the regular expression that will be used to determine if a value is legal.
 
- 
- 
Method Details- 
setPatternSets the pattern that will be used to determine if a value is legal.
- 
setPatternSets the pattern that will be used to determine if a value is legal.
- 
getPatternReturns thePatternused to determine if a value is legal.
- 
setMatcherSets theMatcherused in the most recent test if a value is legal.
- 
getMatcherReturns theMatcherfrom the most test.
- 
stringToValueParsestextreturning an arbitrary Object. Some formatters may return null.If a Patternhas been specified and the text completely matches the regular expression this will invokesetMatcher.- Overrides:
- stringToValuein class- DefaultFormatter
- Parameters:
- text- String to convert
- Returns:
- Object representation of text
- Throws:
- ParseException- if there is an error in the conversion
 
 
-