net.sourceforge.vietpad.inputmethod
Class VietKeyInput

java.lang.Object
  extended by net.sourceforge.vietpad.inputmethod.VietKeyInput

public class VietKeyInput
extends Object

Vietnamese keyboard driver (input engine) for Java text components. An instance of the VietKeyListener class serves as a preprocessor to this class. Together, they give Swing text components the capability of Vietnamese text input.

Input keys for diacritical marks follow VNI convention:

    1: ', 2: `, 3: ?, 4: ~, 5: ., 6: ^, 7: +, 8: (, 9: -, 0: remove diacritics.
 
Also, repeating the accent key deletes the accent just entered.


Method Summary
static char getAccentInTelex(String curWord, char key, char accent)
          Determines the correct accent for Telex mode.
static boolean isAccentRemoved()
          Determines if accent is removed by repeating accent key, not by designated accent-removing key.
static void setDiacriticsPosClassic(boolean classic)
          Sets the diacritics position to follow the classic style.
static String shiftAccent(String curWord, char key)
          Shifts the accent mark to the correct vowel in a multiple-vowel sequence, as in tòa + n -> toàn.
static char toVietChar(char curChar, char accentKey)
          Composes the Vietnamese character.
static char toVietChar(char curChar, int accentIndex)
          Composes the Vietnamese character.
static String toVietWord(String curWord, char accentKey)
          Composes the Vietnamese word.
static String toVietWord(String curWord, int accentIndex)
          Composes the Vietnamese word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toVietChar

public static char toVietChar(char curChar,
                              char accentKey)
Composes the Vietnamese character.

Parameters:
curChar - the character at current caret position
accentKey - the accent key, ranging from '0' - '9'
Returns:
the result Vietnamese character

toVietChar

public static char toVietChar(char curChar,
                              int accentIndex)
Composes the Vietnamese character.

Parameters:
curChar - the character at current caret position
accentIndex - the code point value of the accent key, ranging from 0 - 9
Returns:
the result Vietnamese character

toVietWord

public static String toVietWord(String curWord,
                                char accentKey)
Composes the Vietnamese word.

Parameters:
curWord - the word at current caret position
accentKey - accent key, ranging from '0' - '9'
Returns:
the result Vietnamese word

toVietWord

public static String toVietWord(String curWord,
                                int accentIndex)
Composes the Vietnamese word.

Parameters:
curWord - the word at current caret position
accentIndex - the code point value of the accent key, ranging from 0 - 9
Returns:
the result Vietnamese word

shiftAccent

public static String shiftAccent(String curWord,
                                 char key)
Shifts the accent mark to the correct vowel in a multiple-vowel sequence, as in tòa + n -> toàn.

Parameters:
curWord - the word at current caret position
key - the key input
Returns:
the new word if shifting occurs
curWord, otherwise

getAccentInTelex

public static char getAccentInTelex(String curWord,
                                    char key,
                                    char accent)
Determines the correct accent for Telex mode.

Parameters:
curWord - the word at current caret position
key - the key input
accent - the accent key for Telex
Returns:
the correct accent: '6', '7', or '8'; '\0' for invalid accent input

isAccentRemoved

public static boolean isAccentRemoved()
Determines if accent is removed by repeating accent key, not by designated accent-removing key.

Returns:
true if accent is removed by repeating accent key
false if accent is removed by VNI '0' key, VIQR '-' key, or Telex 'z' key

setDiacriticsPosClassic

public static void setDiacriticsPosClassic(boolean classic)
Sets the diacritics position to follow the classic style.

Parameters:
classic - true for classic (òa, òe, úy); false for modern (oà, oè, uý)


Copyright © 2002 VietUnicode. All Rights Reserved.