javax.swing.text
Class MaskFormatter.LiteralCharacter

java.lang.Object
  extended byjavax.swing.text.MaskFormatter.MaskCharacter
      extended byjavax.swing.text.MaskFormatter.LiteralCharacter
Enclosing class:
MaskFormatter

private class MaskFormatter.LiteralCharacter
extends MaskFormatter.MaskCharacter

Used to represent a fixed character in the mask.


Field Summary
private  char fixedChar
           
 
Constructor Summary
MaskFormatter.LiteralCharacter(char fixedChar)
           
 
Method Summary
 void append(StringBuffer buff, String formatting, int[] index, String placeholder)
          Appends the necessary character in formatting at index to buff.
 char getChar(char aChar)
          Returns the character to insert for aChar.
 boolean isLiteral()
          Subclasses should override this returning true if the instance represents a literal character.
 boolean isValidCharacter(char aChar)
          Returns true if aChar is a valid reprensentation of the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fixedChar

private char fixedChar
Constructor Detail

MaskFormatter.LiteralCharacter

public MaskFormatter.LiteralCharacter(char fixedChar)
Method Detail

isLiteral

public boolean isLiteral()
Description copied from class: MaskFormatter.MaskCharacter
Subclasses should override this returning true if the instance represents a literal character. The default implementation returns false.

Overrides:
isLiteral in class MaskFormatter.MaskCharacter

getChar

public char getChar(char aChar)
Description copied from class: MaskFormatter.MaskCharacter
Returns the character to insert for aChar. The default implementation returns aChar. Subclasses that wish to do some sort of mapping, perhaps lower case to upper case should override this and do the necessary mapping.

Overrides:
getChar in class MaskFormatter.MaskCharacter

isValidCharacter

public boolean isValidCharacter(char aChar)
Returns true if aChar is a valid reprensentation of the receiver. The default implementation returns true if the receiver represents a literal character and getChar == aChar. Otherwise, this will return true is aChar is contained in the valid characters and not contained in the invalid characters.


append

public void append(StringBuffer buff,
                   String formatting,
                   int[] index,
                   String placeholder)
            throws ParseException
Appends the necessary character in formatting at index to buff.

Throws:
ParseException