Class com.symantec.itools.swing.MaskEngine
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.swing.MaskEngine

Object
   |
   +----com.symantec.itools.swing.MaskEngine

public class MaskEngine
extends Object

Variable Index

 o datetype
 o numbtype
 o texttype
 o timetype

Constructor Index

 o com.symantec.itools.swing.MaskEngine(String, int)
 o com.symantec.itools.swing.MaskEngine()

Method Index

 o cut(String, int, int, StringBuffer)
 o getDatatype()
 o getMask()
 o getMatchedText(String)
 o initDisplay(String, StringBuffer)
 o isHandledKey(KeyEvent)
 o lastFilterPosition()
Returns the position of the last character in the mask which is a filter.
 o paste(String, String, int, StringBuffer, int, int)
 o processKey(KeyEvent, int, String, StringBuffer, int, int)
Called for every key stroke corresponding to displayable characters once editing begins.
 o setDatatype(int)
 o setMask(String)
 o stripMask(String, StringBuffer)
Strips the mask from a data string and checks if the data is complete according to the mask.

Variables

 o datetype
public static final int datetype
 o numbtype
public static final int numbtype
 o texttype
public static final int texttype
 o timetype
public static final int timetype

Constructors

 o MaskEngine
public MaskEngine(String mask,
                  int datatype)
 o MaskEngine
public MaskEngine()

Methods

 o cut
public java.lang.String cut(String data,
                            int selStart,
                            int selEnd,
                            StringBuffer newData)
 o getDatatype
public int getDatatype()
 o getMask
public java.lang.String getMask()
 o getMatchedText
public java.lang.String getMatchedText(String t)
 o initDisplay
public int initDisplay(String data,
                       StringBuffer newData)
 o isHandledKey
public boolean isHandledKey(KeyEvent e)
 o lastFilterPosition
public int lastFilterPosition()
Returns the position of the last character in the mask which is a filter. The cursor should not move past this character.

Returns:
Last character index
 o paste
public int paste(String data,
                 String pasteData,
                 int pos,
                 StringBuffer newData,
                 int selStart,
                 int selEnd)
 o processKey
public int processKey(KeyEvent e,
                      int pos,
                      String data,
                      StringBuffer newData,
                      int selStart,
                      int selEnd)
Called for every key stroke corresponding to displayable characters once editing begins. This is the main workhorse method.

Parameters:
e - User keystroke event object
pos - Current cursor position (zero based)
data - Current text from the component
newData - What should be displayed in the component (modified by this method)
selStart - Selection start
selEnd - Selection end
Returns:
  • If >= 0: new cursor position within newData
  • If == -1: the input is inconsistent (position not in range or not on a filter)
  • If == -2: the input keystroke is not accepted by the relevant filter
  • If <= -3: cursor out of range, carret should be set at position (x + 3)*(-1)
 o setDatatype
public void setDatatype(int datatype)
 o setMask
public void setMask(String mask)
 o stripMask
public boolean stripMask(String data,
                         StringBuffer newData)
Strips the mask from a data string and checks if the data is complete according to the mask.

Parameters:
data - The analyzed string
newData - Content of data without the mask characters, this is an out parameter
Returns:
Returns true if the data is complete according to the mask, false otherwise (data not complete or does not match the mask)

All Packages  Class Hierarchy  This Package  Previous  Next  Index