Class TransliteratorInputMethod
- java.lang.Object
-
- com.ibm.icu.dev.tool.ime.translit.TransliteratorInputMethod
-
- All Implemented Interfaces:
java.awt.im.spi.InputMethod
public class TransliteratorInputMethod extends java.lang.Object implements java.awt.im.spi.InputMethod
-
-
Field Summary
Fields Modifier and Type Field Description private static java.awt.Rectangle
attachedLimits
private java.awt.Point
attachedLocation
private static boolean
attachedStatusWindow
private java.lang.StringBuffer
buffer
private static javax.swing.JComboBox
choices
private int
desiredContext
private boolean
enabled
private static int
gid
private int
id
(package private) java.awt.im.spi.InputMethodContext
imc
private Transliterator.Position
index
private ReplaceableString
replaceableText
private int
selectedIndex
private static java.awt.Window
statusWindow
private static TransliteratorInputMethod
statusWindowOwner
private static boolean
TRACE_BUFFER
private static boolean
TRACE_EVENT
private static boolean
TRACE_MESSAGES
private Transliterator
transliterator
-
Constructor Summary
Constructors Constructor Description TransliteratorInputMethod()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
private boolean
backspace()
private boolean
canBackspace()
private boolean
canDelete()
private void
caretToLimit()
private void
caretToStart()
private boolean
caretTowardsLimit()
private boolean
caretTowardsStart()
private void
clearAll()
private boolean
commitAll()
void
deactivate(boolean isTemporary)
private boolean
delete()
void
dispatchEvent(java.awt.AWTEvent event)
void
dispose()
private void
doDelete(int start, int limit)
void
dumpStatus(java.lang.String msg)
private boolean
editing()
void
endComposition()
private java.lang.String
eventInfo(java.awt.AWTEvent event)
java.lang.Object
getControlObject()
java.util.Locale
getLocale()
private boolean
handlePressed(int code)
Handle keyPressed events.private boolean
handleTyped(char ch)
The big problem is that from release to release swing changes how it handles some characters like tab and backspace.void
hideWindows()
private static void
initStatusWindow(java.awt.im.spi.InputMethodContext context)
private boolean
insert(char c)
boolean
isCompositionEnabled()
void
notifyClientWindowChange(java.awt.Rectangle location)
private static void
pin(java.awt.Point p, java.awt.Rectangle r)
void
reconvert()
void
removeNotify()
private void
reset()
Wipe cleanvoid
setCharacterSubsets(java.lang.Character.Subset[] subsets)
void
setCompositionEnabled(boolean enable)
void
setInputMethodContext(java.awt.im.spi.InputMethodContext context)
boolean
setLocale(java.util.Locale locale)
private void
statusWindowAction(java.awt.event.ActionEvent e)
java.lang.String
toString()
private void
traceBuffer(java.lang.String msg, int cc, int off)
private void
update(boolean flush)
private void
updateCaret()
private static boolean
usesAttachedIME()
-
-
-
Field Detail
-
attachedStatusWindow
private static final boolean attachedStatusWindow
-
statusWindow
private static java.awt.Window statusWindow
-
statusWindowOwner
private static TransliteratorInputMethod statusWindowOwner
-
attachedLimits
private static java.awt.Rectangle attachedLimits
-
choices
private static javax.swing.JComboBox choices
-
attachedLocation
private java.awt.Point attachedLocation
-
gid
private static int gid
-
id
private int id
-
imc
java.awt.im.spi.InputMethodContext imc
-
enabled
private boolean enabled
-
selectedIndex
private int selectedIndex
-
transliterator
private Transliterator transliterator
-
desiredContext
private int desiredContext
-
buffer
private java.lang.StringBuffer buffer
-
replaceableText
private ReplaceableString replaceableText
-
index
private Transliterator.Position index
-
TRACE_EVENT
private static boolean TRACE_EVENT
-
TRACE_MESSAGES
private static boolean TRACE_MESSAGES
-
TRACE_BUFFER
private static boolean TRACE_BUFFER
-
-
Method Detail
-
usesAttachedIME
private static boolean usesAttachedIME()
-
dumpStatus
public void dumpStatus(java.lang.String msg)
-
setInputMethodContext
public void setInputMethodContext(java.awt.im.spi.InputMethodContext context)
- Specified by:
setInputMethodContext
in interfacejava.awt.im.spi.InputMethod
-
initStatusWindow
private static void initStatusWindow(java.awt.im.spi.InputMethodContext context)
-
statusWindowAction
private void statusWindowAction(java.awt.event.ActionEvent e)
-
pin
private static void pin(java.awt.Point p, java.awt.Rectangle r)
-
notifyClientWindowChange
public void notifyClientWindowChange(java.awt.Rectangle location)
- Specified by:
notifyClientWindowChange
in interfacejava.awt.im.spi.InputMethod
-
activate
public void activate()
- Specified by:
activate
in interfacejava.awt.im.spi.InputMethod
-
deactivate
public void deactivate(boolean isTemporary)
- Specified by:
deactivate
in interfacejava.awt.im.spi.InputMethod
-
hideWindows
public void hideWindows()
- Specified by:
hideWindows
in interfacejava.awt.im.spi.InputMethod
-
setLocale
public boolean setLocale(java.util.Locale locale)
- Specified by:
setLocale
in interfacejava.awt.im.spi.InputMethod
-
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocale
in interfacejava.awt.im.spi.InputMethod
-
setCharacterSubsets
public void setCharacterSubsets(java.lang.Character.Subset[] subsets)
- Specified by:
setCharacterSubsets
in interfacejava.awt.im.spi.InputMethod
-
reconvert
public void reconvert()
- Specified by:
reconvert
in interfacejava.awt.im.spi.InputMethod
-
removeNotify
public void removeNotify()
- Specified by:
removeNotify
in interfacejava.awt.im.spi.InputMethod
-
endComposition
public void endComposition()
- Specified by:
endComposition
in interfacejava.awt.im.spi.InputMethod
-
dispose
public void dispose()
- Specified by:
dispose
in interfacejava.awt.im.spi.InputMethod
-
getControlObject
public java.lang.Object getControlObject()
- Specified by:
getControlObject
in interfacejava.awt.im.spi.InputMethod
-
setCompositionEnabled
public void setCompositionEnabled(boolean enable)
- Specified by:
setCompositionEnabled
in interfacejava.awt.im.spi.InputMethod
-
isCompositionEnabled
public boolean isCompositionEnabled()
- Specified by:
isCompositionEnabled
in interfacejava.awt.im.spi.InputMethod
-
eventInfo
private java.lang.String eventInfo(java.awt.AWTEvent event)
-
dispatchEvent
public void dispatchEvent(java.awt.AWTEvent event)
- Specified by:
dispatchEvent
in interfacejava.awt.im.spi.InputMethod
-
reset
private void reset()
Wipe clean
-
traceBuffer
private void traceBuffer(java.lang.String msg, int cc, int off)
-
update
private void update(boolean flush)
-
updateCaret
private void updateCaret()
-
caretToStart
private void caretToStart()
-
caretToLimit
private void caretToLimit()
-
caretTowardsStart
private boolean caretTowardsStart()
-
caretTowardsLimit
private boolean caretTowardsLimit()
-
canBackspace
private boolean canBackspace()
-
backspace
private boolean backspace()
-
canDelete
private boolean canDelete()
-
delete
private boolean delete()
-
doDelete
private void doDelete(int start, int limit)
-
commitAll
private boolean commitAll()
-
clearAll
private void clearAll()
-
insert
private boolean insert(char c)
-
editing
private boolean editing()
-
handleTyped
private boolean handleTyped(char ch)
The big problem is that from release to release swing changes how it handles some characters like tab and backspace. Sometimes it handles them as keyTyped events, and sometimes it handles them as keyPressed events. If you want to allow the event to go through so swing handles it, you have to allow one or the other to go through. If you don't want the event to go through so you can handle it, you have to stop the event both places.- Returns:
- whether the character was handled
-
handlePressed
private boolean handlePressed(int code)
Handle keyPressed events.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-