org.eclipse.ercp.swt.mobile
Class TextExtension

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Text
                  extended byorg.eclipse.ercp.swt.mobile.TextExtension
All Implemented Interfaces:
Drawable

public class TextExtension
extends Text

This class contains methods for extending the functionality of the Text control. The functionality is specific to non-full keyboard devices. Applications can request certain text input modes when a TextExtension control gets focused. The effective input mode takes into account two style aspects. One aspect is based on the content semantics. The other is based on the content character set.

The editing behavior and appearance are otherwise identical to the Text control. The differences in TextExtension are to ease the possible switch of initial input modes, such as to enable/disable predictive input, changing initial casing styles and particular input modes of some languages. The initial input mode does not persist if changed by the end-user during editing. Whether the mode will be persist during the application life-cycle is implementation-dependent.

TextExtension Styles:
Content Styles (exclusive):
EMAILADDRESS: an e-mail address
URL: a web address

These are different semantic styles but basically all characters are allowed in each style. The implementation may use the content style to implement a device-dependent UI for assisting user input, for example, providing a UI to access the device's PIM or browser bookmarks, if available.

Input Modifier Styles:
NON_PREDICTIVE: hint for turning off possible predictive text input. By default any predictive input facilities should be turned on if available
LATIN_INPUT_ONLY: force that locale specific input modes should not be available. This is used in some situations when only Latin characters are allowed, for example, password text field
Casing Modifiers (exclusive): Casing modifiers define which case modes are available for input. Only one casing modifier may be specified.
UPPERCASE: The capital letters of a typeface
LOWERCASE: The small letters of a typeface, as opposed to the capital letters, or uppercase letters
TEXTCASE: The first word of a sentence is capitalized. Note: Determination of where a sentence ends is implementation-dependent.
TITLECASE: Every word is capitalized.
Events:
(none)

IMPORTANT: This class is not intended to be subclassed.


Field Summary
static int EMAILADDRESS
          E-mail address.
static int LATIN_INPUT_ONLY
          Force that locale specific input modes should not be available.
static int LOWERCASE
          The lower case letters of a typeface.
static int NON_PREDICTIVE
          Hint for turning off predictive text input.
static int TEXTCASE
          The first word of each sentence is capitalized.
static int TITLECASE
          Every word is capitalized.
static int UPPERCASE
          The capital letters of a typeface.
static int URL
          Uniform Resource Locator.
 
Fields inherited from class org.eclipse.swt.widgets.Text
DELIMITER, LIMIT
 
Constructor Summary
TextExtension(Composite parent, int style)
          Constructs a new instance of Text class when specific styles are not used.
TextExtension(Composite parent, int style, int extensionStyle)
          Constructs a new instance of this class given its parent, a style value describing behaviour and appearance, and an additional style specifying the text types defined above.
 
Method Summary
 void setInitialInputMode(int casingModifier, java.lang.String mode)
          Hints to the implementation as to the input mode that should be used when the user initiates editing of this control.
 
Methods inherited from class org.eclipse.swt.widgets.Text
addModifyListener, addSelectionListener, addVerifyListener, append, clearSelection, copy, cut, getCaretLineNumber, getCaretLocation, getCaretPosition, getCharCount, getDoubleClickEnabled, getEchoChar, getEditable, getLineCount, getLineDelimiter, getLineHeight, getOrientation, getSelection, getSelectionCount, getSelectionText, getText, getText, getTextLimit, getTopIndex, getTopPixel, insert, paste, removeModifyListener, removeSelectionListener, removeVerifyListener, selectAll, setDoubleClickEnabled, setEchoChar, setEditable, setOrientation, setSelection, setSelection, setSelection, setText, setTextLimit, setTopIndex, showSelection
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addKeyListener, addMouseListener, addMouseMoveListener, addPaintListener, addTraverseListener, computeSize, computeSize, forceFocus, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setEnabled, setFocus, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMAILADDRESS

public static final int EMAILADDRESS
E-mail address.

See Also:
Constant Field Values

URL

public static final int URL
Uniform Resource Locator.

See Also:
Constant Field Values

NON_PREDICTIVE

public static final int NON_PREDICTIVE
Hint for turning off predictive text input. By default any predictive input facilities should be turned on if available.

See Also:
Constant Field Values

LATIN_INPUT_ONLY

public static final int LATIN_INPUT_ONLY
Force that locale specific input modes should not be available.

See Also:
Constant Field Values

UPPERCASE

public static final int UPPERCASE
The capital letters of a typeface.

See Also:
Constant Field Values

LOWERCASE

public static final int LOWERCASE
The lower case letters of a typeface.

See Also:
Constant Field Values

TEXTCASE

public static final int TEXTCASE
The first word of each sentence is capitalized.

See Also:
Constant Field Values

TITLECASE

public static final int TITLECASE
Every word is capitalized.

See Also:
Constant Field Values
Constructor Detail

TextExtension

public TextExtension(Composite parent,
                     int style)
Constructs a new instance of Text class when specific styles are not used.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR 'ing together (that is, using the int "|" operator) two or more of those SWT style constants. Style bits are also inherited from superclasses.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
Throws:
java.lang.IllegalArgumentException -
SWTException -
See Also:
SWT.SINGLE, SWT.MULTI, SWT.READ_ONLY, SWT.WRAP, Text.Text(Composite, int)

TextExtension

public TextExtension(Composite parent,
                     int style,
                     int extensionStyle)
Constructs a new instance of this class given its parent, a style value describing behaviour and appearance, and an additional style specifying the text types defined above.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR 'ing together (that is, using the int "|" operator) two or more of those SWT style constants. Style bits are also inherited from superclasses.

The extensionStyle value is a bitwise OR 'ing of EMAILADDRESS, URL, NON_PREDICTIVE, and LATIN_INPUT_ONLY. EMAILADDRESS and URL may not be both specified. The extensionStyle value is ignored when SWT.READ_ONLY is specified in the style value.

Parameters:
parent - a composite control which is the parent of the new instance (cannot be null)
style - the style of control to construct
extensionStyle - the TextExtension specific style.
Throws:
java.lang.IllegalArgumentException -
SWTException -
See Also:
SWT.SINGLE, SWT.MULTI, SWT.READ_ONLY, SWT.WRAP, Text.Text(Composite, int)
Method Detail

setInitialInputMode

public void setInitialInputMode(int casingModifier,
                                java.lang.String mode)
Hints to the implementation as to the input mode that should be used when the user initiates editing of this control.

Input mode string format

The initial input mode is specified as a string and can be null. A "Unicode character block" may be specified by adding the prefix "UCB_" to the names of Unicode character blocks as defined in the J2SE class java.lang.Character.UnicodeBlock. Any Unicode character block can be named in this fashion. For convenience, the most common Unicode character blocks are listed below.

UCB_BASIC_LATIN
UCB_GREEK
UCB_CYRILLIC
UCB_ARMENIAN
UCB_HEBREW
UCB_ARABIC
UCB_DEVANAGARI
UCB_BENGALI
UCB_THAI
UCB_HIRAGANA
UCB_KATAKANA
UCB_HANGUL_SYLLABLES

An "Input subset" may be specified by adding the prefix "IS_" to the name of input subsets as defined by the J2SE class java.awt.im.InputSubset. Any defined input subset can be used. For convenience, the names of the currently defined input subsets are listed below.

IS_FULLWIDTH_DIGITS
IS_FULLWIDTH_LATIN
IS_HALFWIDTH_KATAKANA
IS_HANJA
IS_KANJI
IS_LATIN
IS_LATIN_DIGITS
IS_SIMPLIFIED_HANZI
IS_TRADITIONAL_HANZI

Note: Implementations need not compile in support for all the strings listed above. Instead, they need only to compile in the strings that name Unicode character subsets that they support. If the subset name passed by the application is not known by the implementation, the request is gracefully ignored, and a default input mode based on current locale configuration is used.

Parameters:
mode - a string naming a Unicode character block, input subset, or null
casingModifier - an int value. Must be one of UPPERCASE, LOWERCASE, TEXTCASE or TITLECASE.
Throws:
java.lang.IllegalArgumentException -
  • ERROR_INVALID_ARGUMENT - if the casingModifer is not one of UPPERCASE, LOWERCASE, TEXTCASE or TITLECASE
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver