Class RegExFormatter
- java.lang.Object
- 
- javax.swing.JFormattedTextField.AbstractFormatter
- 
- javax.swing.text.DefaultFormatter
- 
- com.inductiveautomation.factorypmi.application.components.util.RegExFormatter
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 
 public class RegExFormatter extends javax.swing.text.DefaultFormatterA regular expression based implementation ofAbstractFormatter.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description RegExFormatter()RegExFormatter(java.lang.String pattern)Creates a regular expression basedAbstractFormatter.RegExFormatter(java.util.regex.Pattern pattern)Creates a regular expression basedAbstractFormatter.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.regex.MatchergetMatcher()Returns theMatcherfrom the most test.java.util.regex.PatterngetPattern()Returns thePatternused to determine if a value is legal.protected voidsetMatcher(java.util.regex.Matcher matcher)Sets theMatcherused in the most recent test if a value is legal.voidsetPattern(java.lang.String strPattern)Sets the pattern that will be used to determine if a value is legal.voidsetPattern(java.util.regex.Pattern pattern)Sets the pattern that will be used to determine if a value is legal.java.lang.ObjectstringToValue(java.lang.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, valueToString
 
- 
 
- 
- 
- 
Constructor Detail- 
RegExFormatterpublic RegExFormatter() 
 - 
RegExFormatterpublic RegExFormatter(java.lang.String pattern) throws java.util.regex.PatternSyntaxExceptionCreates a regular expression basedAbstractFormatter.patternspecifies the regular expression that will be used to determine if a value is legal.- Throws:
- java.util.regex.PatternSyntaxException
 
 - 
RegExFormatterpublic RegExFormatter(java.util.regex.Pattern pattern) Creates a regular expression basedAbstractFormatter.patternspecifies the regular expression that will be used to determine if a value is legal.
 
- 
 - 
Method Detail- 
setPatternpublic void setPattern(java.lang.String strPattern) Sets the pattern that will be used to determine if a value is legal.
 - 
setPatternpublic void setPattern(java.util.regex.Pattern pattern) Sets the pattern that will be used to determine if a value is legal.
 - 
getPatternpublic java.util.regex.Pattern getPattern() Returns thePatternused to determine if a value is legal.
 - 
setMatcherprotected void setMatcher(java.util.regex.Matcher matcher) Sets theMatcherused in the most recent test if a value is legal.
 - 
getMatcherprotected java.util.regex.Matcher getMatcher() Returns theMatcherfrom the most test.
 - 
stringToValuepublic java.lang.Object stringToValue(java.lang.String text) throws java.text.ParseExceptionParsestextreturning 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- javax.swing.text.DefaultFormatter
- Parameters:
- text- String to convert
- Returns:
- Object representation of text
- Throws:
- java.text.ParseException- if there is an error in the conversion
 
 
- 
 
-