APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt

public abstract Class X11InputMethodBase

extends InputMethodAdapter
Class Inheritance
Known Direct Subclasses
sun.awt.X11InputMethod
Imports
java.awt.AWTEvent, .AWTException, .Component, .Container, .EventQueue, .Window, java.awt.event.InputMethodEvent, java.awt.font.TextAttribute, .TextHitInfo, java.awt.im.InputMethodHighlight, java.awt.im.spi.InputMethodContext, java.awt.peer.ComponentPeer, java.io.BufferedReader, .File, .FileReader, .IOException, java.lang.Character.Subset, java.lang.ref.WeakReference, java.text.AttributedCharacterIterator, .AttributedString, java.util.Collections, .HashMap, .Locale, .Map, .StringTokenizer, java.util.regex.Pattern, sun.awt.im.InputMethodAdapter, sun.util.logging.PlatformLogger

Input Method Adapter for XIM
Author
JavaSoft International

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
X11InputMethodBase.IntBuffer

IntBuffer is an inner class that manipulates an int array and provides UNIX file io stream-like programming interfaces to access it.

Field Summary

Modifier and TypeField and Description
protected Component
protected Container
protected String
protected StringBuffer
protected boolean
protected boolean
private static Map<TextAttribute, ?>[]
protected static final int
protected boolean
protected boolean
protected boolean
private static boolean
protected Component
private Locale
protected static final PlatformLogger
protected boolean
private WeakReference<Component>
protected transient long
protected X11InputMethodBase.IntBuffer
protected boolean
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
protected static final int
protected static final int
protected static final int
protected static final int

Constructor Summary

AccessConstructor and Description
public
X11InputMethodBase()

Constructs an X11InputMethod instance.

Method Summary

Modifier and TypeMethod and Description
public abstract void
activate()

Redeclares java.awt.im.spi.InputMethod.activate.

Activate input method.

protected abstract void
awtLock()

Used to protect preedit data

protected abstract void
protected InputMethodHighlight

Returns:

Java input method highlight
convertVisualFeedbackToHighlight
(int feedback)

Performs mapping from an XIM visible feedback value to Java IM highlight.

protected abstract boolean
public abstract void
deactivate(boolean isTemporary)

Redeclares java.awt.im.spi.InputMethod.deactivate.

Deactivate input method.

public void
disableInputMethod()

Implements abstract sun.awt.im.InputMethodAdapter.disableInputMethod.

Explicitly disable the native IME.

pack-priv void
dispatchCommittedText(String
committed text
str
,
long
when
when
)

Dispatches committed text from XIM to the awt event queue.

private void
pack-priv abstract void
dispatchComposedText(String chgText, int[] chgStyles, int chgOffset, int chgLength, int caretPosition, long when)

Updates composed text with XIM preedit information and posts composed text to the awt event queue.

public void
dispatchEvent(AWTEvent
event
e
)

Implements java.awt.im.spi.InputMethod.dispatchEvent.

Dispatch event to input method.

public final void
dispose()

Implements java.awt.im.spi.InputMethod.dispose.

Frees all X Window resources associated with this object.

protected abstract void
protected native void
public void
endComposition()

Implements java.awt.im.spi.InputMethod.endComposition.

Ends any input composition that may currently be going on in this context.

pack-priv void
flushText()

Flushes composed and committed text held in this context.

protected Window
getClientComponentWindow()

Returns the Window instance in which the client component is contained.

protected boolean

Returns:

the composition state if isCompositionEnabled call is successful. Otherwise, it returns false.
getCompositionState
()

Query and then return the current composition state.

public Object
public Locale
getLocale()

Implements java.awt.im.spi.InputMethod.getLocale.

Returns current input locale.

public String
getNativeInputMethodInfo()

Implements abstract sun.awt.im.InputMethodAdapter.getNativeInputMethodInfo.

Returns a string with information about the current input method server, or null.

protected abstract Container
protected abstract ComponentPeer
getPeer(Component client)

Returns peer of the given client component.

public abstract void
hideWindows()

Redeclares java.awt.im.spi.InputMethod.hideWindows.

Closes or hides all windows opened by this input method instance or its class.

private static native void
initIDs()

Initialize JNI field and method IDs for fields that may be accessed from C.

private synchronized boolean

Returns:

true if openXIM() is successful or it's already been opened.
initXIM
()

Invokes openIM() that invokes XOpenIM() if it's not opened yet.

public boolean
isCompositionEnabled()

Implements java.awt.im.spi.InputMethod.isCompositionEnabled.

Determines whether this input method is enabled.

private native boolean
protected boolean
public static Map<TextAttribute, ?>
protected abstract boolean
protected void
postInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition, long when)

Creates an input method event from the arguments given and posts it on the AWT event queue.

private void
postInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)

public synchronized void
removeNotify()

Implements java.awt.im.spi.InputMethod.removeNotify.

Notifies the input method that a client component has been removed from its containment hierarchy, or that input method support has been disabled for the component.

protected abstract void
resetCompositionState()

Reset the composition state to the current composition state.

private native String
protected final void
protected void
setAWTFocussedComponent(Component component)

Overrides sun.awt.im.InputMethodAdapter.setAWTFocussedComponent.

Informs the input method adapter about the component that has the AWT focus if it's using the input context owning this adapter instance.

public void
setCharacterSubsets(Character.Subset[] subsets)

Implements java.awt.im.spi.InputMethod.setCharacterSubsets.

Does nothing - XIM doesn't let you specify which characters you expect.

public abstract void
setCompositionEnabled(boolean enable)

Redeclares java.awt.im.spi.InputMethod.setCompositionEnabled.

Enables or disables this input method for composition, depending on the value of the parameter enable.

protected native boolean
public void
setInputMethodContext(InputMethodContext context)

Implements java.awt.im.spi.InputMethod.setInputMethodContext.

Does nothing - this adapter doesn't use the input method context.

public boolean

Returns:

the true is returned when specified locale is supported.
setLocale
(Locale
locale to input
lang
)

Implements java.awt.im.spi.InputMethod.setLocale.

Set locale to input.

protected abstract void
setXICFocus(ComponentPeer peer, boolean value, boolean active)

protected void
stopListening()

Overrides sun.awt.im.InputMethodAdapter.stopListening.

Informs the input method adapter not to listen to the native events.

protected native void
Inherited from sun.awt.im.InputMethodAdapter:
getClientComponenthaveActiveClientnotifyClientWindowChangereconvertsupportsBelowTheSpot

Field Detail

awtFocussedComponentback to summary
protected Component awtFocussedComponent
clientComponentWindowback to summary
protected Container clientComponentWindow
committedTextback to summary
protected String committedText
composedTextback to summary
protected StringBuffer composedText
compositionEnableSupportedback to summary
protected boolean compositionEnableSupported
disposedback to summary
protected boolean disposed
highlightStylesback to summary
private static Map<TextAttribute, ?>[] highlightStyles
INITIAL_SIZEback to summary
protected static final int INITIAL_SIZE
isActiveback to summary
protected boolean isActive
isLastTemporaryback to summary
protected boolean isLastTemporary
isLastXICActiveback to summary
protected boolean isLastXICActive
isXIMOpenedback to summary
private static boolean isXIMOpened
lastXICFocussedComponentback to summary
protected Component lastXICFocussedComponent
localeback to summary
private Locale locale
logback to summary
protected static final PlatformLogger log
needResetXICback to summary
protected boolean needResetXIC
needResetXICClientback to summary
private WeakReference<Component> needResetXICClient
pDataback to summary
protected transient long pData
rawFeedbacksback to summary
protected X11InputMethodBase.IntBuffer rawFeedbacks
savedCompositionStateback to summary
protected boolean savedCompositionState
XIMHighlightback to summary
private static final int XIMHighlight
XIMPrimaryback to summary
private static final int XIMPrimary
XIMReverseback to summary
private static final int XIMReverse
XIMSecondaryback to summary
private static final int XIMSecondary
XIMTertiaryback to summary
private static final int XIMTertiary
XIMUnderlineback to summary
private static final int XIMUnderline
XIMVisibleCenterback to summary
protected static final int XIMVisibleCenter
XIMVisibleMaskback to summary
protected static final int XIMVisibleMask
XIMVisibleToBackwardback to summary
protected static final int XIMVisibleToBackward
XIMVisibleToForwardback to summary
protected static final int XIMVisibleToForward

Constructor Detail

X11InputMethodBaseback to summary
public X11InputMethodBase() throws AWTException

Constructs an X11InputMethod instance. It initializes the XIM environment if it's not done yet.

Exceptions
AWTException:
if XOpenIM() failed.

Method Detail

activateback to summary
public abstract void activate()

Redeclares java.awt.im.spi.InputMethod.activate.

Activate input method.

Annotations
@Override
awtLockback to summary
protected abstract void awtLock()

Used to protect preedit data

awtUnlockback to summary
protected abstract void awtUnlock()
convertVisualFeedbackToHighlightback to summary
protected InputMethodHighlight convertVisualFeedbackToHighlight(int feedback)

Performs mapping from an XIM visible feedback value to Java IM highlight.

Returns:InputMethodHighlight

Java input method highlight

createXICback to summary
protected abstract boolean createXIC()
deactivateback to summary
public abstract void deactivate(boolean isTemporary)

Redeclares java.awt.im.spi.InputMethod.deactivate.

Deactivate input method.

Annotations
@Override
disableInputMethodback to summary
public void disableInputMethod()

Implements abstract sun.awt.im.InputMethodAdapter.disableInputMethod.

Explicitly disable the native IME. Native IME is not disabled when deactivate is called.

Annotations
@Override
dispatchCommittedTextback to summary
pack-priv void dispatchCommittedText(String str, long when)

Dispatches committed text from XIM to the awt event queue. This method is invoked from the event handler in canvas.c in the AWT Toolkit thread context and thus inside the AWT Lock.

Parameters
str:String

committed text

when:long

when

dispatchCommittedTextback to summary
private void dispatchCommittedText(String str)
dispatchComposedTextback to summary
pack-priv abstract void dispatchComposedText(String chgText, int[] chgStyles, int chgOffset, int chgLength, int caretPosition, long when)

Updates composed text with XIM preedit information and posts composed text to the awt event queue. The args of this method correspond to the XIM preedit callback information. The XIM highlight attributes are translated via fixed mapping (i.e., independent from any underlying input method engine). This method is invoked in the AWT Toolkit (X event loop) thread context and thus inside the AWT Lock.

dispatchEventback to summary
public void dispatchEvent(AWTEvent e)

Implements java.awt.im.spi.InputMethod.dispatchEvent.

Dispatch event to input method. InputContext dispatch event with this method. Input method set consume flag if event is consumed in input method.

Parameters
e:AWTEvent

event

Annotations
@Override
disposeback to summary
public final void dispose()

Implements java.awt.im.spi.InputMethod.dispose.

Frees all X Window resources associated with this object.

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#dispose
disposeImplback to summary
protected abstract void disposeImpl()
disposeXICback to summary
protected native void disposeXIC()
endCompositionback to summary
public void endComposition()

Implements java.awt.im.spi.InputMethod.endComposition.

Ends any input composition that may currently be going on in this context. Depending on the platform and possibly user preferences, this may commit or delete uncommitted text. Any changes to the text are communicated to the active component using an input method event.

A text editing component may call this in a variety of situations, for example, when the user moves the insertion point within the text (but outside the composed text), or when the component's text is saved to a file or copied to the clipboard.

Annotations
@Override
flushTextback to summary
pack-priv void flushText()

Flushes composed and committed text held in this context. This method is invoked in the AWT Toolkit (X event loop) thread context and thus inside the AWT Lock.

getClientComponentWindowback to summary
protected Window getClientComponentWindow()

Returns the Window instance in which the client component is contained. If not found, null is returned. (IS THIS POSSIBLE?)

getCompositionStateback to summary
protected boolean getCompositionState()

Query and then return the current composition state.

Returns:boolean

the composition state if isCompositionEnabled call is successful. Otherwise, it returns false.

getControlObjectback to summary
public Object getControlObject()

Implements java.awt.im.spi.InputMethod.getControlObject.

Returns null.

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#getControlObject
getLocaleback to summary
public Locale getLocale()

Implements java.awt.im.spi.InputMethod.getLocale.

Returns current input locale.

Annotations
@Override
getNativeInputMethodInfoback to summary
public String getNativeInputMethodInfo()

Implements abstract sun.awt.im.InputMethodAdapter.getNativeInputMethodInfo.

Returns a string with information about the current input method server, or null. On both Linux & SunOS, the value of environment variable XMODIFIERS is returned if set. Otherwise, on SunOS, $HOME/.dtprofile will be parsed to find out the language service engine (atok or wnn) since there is no API in Xlib which returns the information of native IM server or language service and we want to try our best to return as much information as possible.

Note

This method could return null on Linux if XMODIFIERS is not set properly or if any IOException is thrown. See man page of XSetLocaleModifiers(3X11) for the usgae of XMODIFIERS, atok12setup(1) and wnn6setup(1) for the information written to $HOME/.dtprofile when you run these two commands.

Annotations
@Override
getParentback to summary
protected abstract Container getParent(Component client)
getPeerback to summary
protected abstract ComponentPeer getPeer(Component client)

Returns peer of the given client component. If the given client component doesn't have peer, peer of the native container of the client is returned.

hideWindowsback to summary
public abstract void hideWindows()

Redeclares java.awt.im.spi.InputMethod.hideWindows.

Doc from java.awt.im.spi.InputMethod.hideWindows.

Closes or hides all windows opened by this input method instance or its class.

This method is called

  • before calling activate on an instance of a different input method class,
  • before calling dispose on this input method.
The method is only called when the input method is inactive.
Annotations
@Override
initIDsback to summary
private static native void initIDs()

Initialize JNI field and method IDs for fields that may be accessed from C.

initXIMback to summary
private synchronized boolean initXIM()

Invokes openIM() that invokes XOpenIM() if it's not opened yet.

Returns:boolean

true if openXIM() is successful or it's already been opened.

isCompositionEnabledback to summary
public boolean isCompositionEnabled()

Implements java.awt.im.spi.InputMethod.isCompositionEnabled.

Doc from java.awt.im.spi.InputMethod.isCompositionEnabled.

Determines whether this input method is enabled. An input method that is enabled for composition interprets incoming events for both composition and control purposes, while a disabled input method does not interpret events for composition.

This method is called

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#isCompositionEnabled
isCompositionEnabledNativeback to summary
private native boolean isCompositionEnabledNative()
isDisposedback to summary
protected boolean isDisposed()
mapInputMethodHighlightback to summary
public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
See Also
java.awt.Toolkit#mapInputMethodHighlight
openXIMback to summary
protected abstract boolean openXIM()
postInputMethodEventback to summary
protected void postInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition, long when)

Creates an input method event from the arguments given and posts it on the AWT event queue. For arguments, see InputMethodEvent. Called by input method.

See Also
java.awt.event.InputMethodEvent#InputMethodEvent
postInputMethodEventback to summary
private void postInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)
removeNotifyback to summary
public synchronized void removeNotify()

Implements java.awt.im.spi.InputMethod.removeNotify.

Doc from java.awt.im.spi.InputMethod.removeNotify.

Notifies the input method that a client component has been removed from its containment hierarchy, or that input method support has been disabled for the component.

This method is called by InputContext.removeNotify.

The method is only called when the input method is inactive.

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#removeNotify
resetCompositionStateback to summary
protected abstract void resetCompositionState()

Reset the composition state to the current composition state.

resetXICback to summary
private native String resetXIC()
resetXICifneededback to summary
protected final void resetXICifneeded()
setAWTFocussedComponentback to summary
protected void setAWTFocussedComponent(Component component)

Overrides sun.awt.im.InputMethodAdapter.setAWTFocussedComponent.

Doc from sun.awt.im.InputMethodAdapter.setAWTFocussedComponent.

Informs the input method adapter about the component that has the AWT focus if it's using the input context owning this adapter instance.

Annotations
@Override
See Also
sun.awt.im.InputMethodAdapter#setAWTFocussedComponent
setCharacterSubsetsback to summary
public void setCharacterSubsets(Character.Subset[] subsets)

Implements java.awt.im.spi.InputMethod.setCharacterSubsets.

Does nothing - XIM doesn't let you specify which characters you expect.

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#setCharacterSubsets
setCompositionEnabledback to summary
public abstract void setCompositionEnabled(boolean enable)

Redeclares java.awt.im.spi.InputMethod.setCompositionEnabled.

Doc from java.awt.im.spi.InputMethod.setCompositionEnabled.

Enables or disables this input method for composition, depending on the value of the parameter enable.

An input method that is enabled for composition interprets incoming events for both composition and control purposes, while a disabled input method does not interpret events for composition. Note however that events are passed on to the input method regardless whether it is enabled or not, and that an input method that is disabled for composition may still interpret events for control purposes, including to enable or disable itself for composition.

For input methods provided by host operating systems, it is not always possible to determine whether this operation is supported. For example, an input method may enable composition only for some locales, and do nothing for other locales. For such input methods, it is possible that this method does not throw UnsupportedOperationException, but also does not affect whether composition is enabled.

This method is called

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
setCompositionEnabledNativeback to summary
protected native boolean setCompositionEnabledNative(boolean enable)
setInputMethodContextback to summary
public void setInputMethodContext(InputMethodContext context)

Implements java.awt.im.spi.InputMethod.setInputMethodContext.

Does nothing - this adapter doesn't use the input method context.

Annotations
@Override
See Also
java.awt.im.spi.InputMethod#setInputMethodContext
setLocaleback to summary
public boolean setLocale(Locale lang)

Implements java.awt.im.spi.InputMethod.setLocale.

Set locale to input. If input method doesn't support specified locale, false will be returned and its behavior is not changed.

Parameters
lang:Locale

locale to input

Returns:boolean

the true is returned when specified locale is supported.

Annotations
@Override
setXICFocusback to summary
protected abstract void setXICFocus(ComponentPeer peer, boolean value, boolean active)
stopListeningback to summary
protected void stopListening()

Overrides sun.awt.im.InputMethodAdapter.stopListening.

Doc from sun.awt.im.InputMethodAdapter.stopListening.

Informs the input method adapter not to listen to the native events.

Annotations
@Override
See Also
sun.awt.im.InputMethodAdapter#stopListening
turnoffStatusWindowback to summary
protected native void turnoffStatusWindow()
sun.awt back to summary

protected final Class X11InputMethodBase.IntBuffer

extends Object
Class Inheritance

IntBuffer is an inner class that manipulates an int array and provides UNIX file io stream-like programming interfaces to access it. (An alternative would be to use ArrayList which may be too expensive for the work.)

Field Summary

Modifier and TypeField and Description
private int
private int[]
private int

Constructor Summary

AccessConstructor and Description
pack-priv
IntBuffer(int initialCapacity)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
pack-priv int
pack-priv void
insert(int offset, int[] values)

pack-priv void
remove(int offset, int length)

pack-priv void
pack-priv void
replace(int offset, int[] values)

pack-priv void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

indexback to summary
private int index
intArrayback to summary
private int[] intArray
sizeback to summary
private int size

Constructor Detail

IntBufferback to summary
pack-priv IntBuffer(int initialCapacity)

Method Detail

getNextback to summary
pack-priv int getNext()
getOffsetback to summary
pack-priv int getOffset()
insertback to summary
pack-priv void insert(int offset, int[] values)
removeback to summary
pack-priv void remove(int offset, int length)
removeAllback to summary
pack-priv void removeAll()
replaceback to summary
pack-priv void replace(int offset, int[] values)
rewindback to summary
pack-priv void rewind()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
ungetback to summary
pack-priv void unget()