com.irisel.swing
Class IosTextField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.TextComponent
          extended by java.awt.TextField
              extended by com.irisel.swing.IosTextField
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.TextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
TimeField

public abstract class IosTextField
extends java.awt.TextField
implements java.awt.event.KeyListener, java.awt.event.FocusListener, java.awt.event.MouseListener, java.awt.event.TextListener

Textfield, ABSTRACT basic class for any Singleline-Input-Fields. Includes support for key-substitution (to solve problems with i.e. the '@'), limited Charactersets, auto-formating on lost focus, automatic selection on gained focus.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static boolean defaultAutoSelection
          Default for auto-selection-handling.
static boolean fastSetText
          STATIC: Faster setText-Handling - if true, the Text is only set, if it differs from the current value.
static boolean restoreCaretPosition
           
static boolean restoreCaretTested
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IosTextField()
          Constructor.
IosTextField(int cols)
          Constructor.
IosTextField(int cols, java.lang.String _charSet)
          Constructor defining also the Charset.
IosTextField(int cols, java.lang.String _charSet, boolean _autoFormat, boolean _keepFocus)
          Constructor defining the charset, auto-formating and illegal-value-focus-keeping.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Add an ActionListener
 void focusGained(java.awt.event.FocusEvent evt)
          Implements FocusListener Invoked when the component gains the keyboard focus.
 void focusLost(java.awt.event.FocusEvent evt)
          Implements FocusListener Invoked when a component loses the keyboard focus.
 boolean formatValue()
          Request-Method for formating the Data (only for redefinition by inheritances).
 java.lang.String getCharSet()
          Get the "special" character set.
 java.lang.String getFormatedText()
          Get the text after formating (primary for internal use at inheritances).
 java.lang.String getInfoText()
          Implements InfoTopic.
 java.lang.String getNullText()
          Gets the text.
 java.lang.String getText()
          Overloaded, calls syncGetText().
 boolean isDisableLocked()
          Check, if the field is locked disabled.
 void keyPressed(java.awt.event.KeyEvent evt)
          Implements KeyListener.
 void keyReleased(java.awt.event.KeyEvent evt)
          Implements KeyListener.
 void keyTyped(java.awt.event.KeyEvent evt)
          Implements KeyListener.
 void lockDisable(boolean disable)
          Disable the field and lock it against any setEnable().
 IosTextField manuallyHandle(java.lang.String _keys, java.lang.String _replace)
          Define the Keys to be handled manually
 void mouseClicked(java.awt.event.MouseEvent evt)
          Implements MouseListener Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent evt)
          Implements MouseListener Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent evt)
          Implements MouseListener Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent evt)
          Implements MouseListener Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent evt)
          Implements MouseListener Invoked when a mouse button has been released on a component.
 void setAutoFormat(boolean _autoFormat)
          Set the autoformat-mode of this field.
 void setAutoSelection(boolean _autoSelection)
          Enable/disable the Auto-Selection-Mode.
 void setCharSet(java.lang.String s)
          Set a "special" character set.
 void setEnabled(boolean en)
          setEnabled() protected with the disable-lock.
 void setInfoText(java.lang.String text)
          Implements InfoTopic.
 void setKeepFocusOnIllegalValue(boolean _keepFocus)
          Defines, if to keep the Focus on illegal Values (only on active AutoFormat).
 void setText(java.lang.String text)
          Sets the text.
 java.lang.String syncGetText()
          To solve problem with blocking peers (Bug in Motif/JDK?).
 void textValueChanged(java.awt.event.TextEvent e)
          Implements Text-Listener.
 void unlockDisabled()
          Unlock a the lock on the disable of the field (does not directly enable the field, but realows enabling).
 
Methods inherited from class java.awt.TextField
addNotify, echoCharIsSet, getAccessibleContext, getActionListeners, getColumns, getEchoChar, getListeners, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, minimumSize, minimumSize, preferredSize, preferredSize, removeActionListener, setColumns, setEchoChar, setEchoCharacter
 
Methods inherited from class java.awt.TextComponent
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getSelectedText, getSelectionEnd, getSelectionStart, getTextListeners, isEditable, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fastSetText

public static boolean fastSetText
STATIC: Faster setText-Handling - if true, the Text is only set, if it differs from the current value.


defaultAutoSelection

public static boolean defaultAutoSelection
Default for auto-selection-handling.


restoreCaretTested

public static boolean restoreCaretTested

restoreCaretPosition

public static boolean restoreCaretPosition
Constructor Detail

IosTextField

public IosTextField()
Constructor.


IosTextField

public IosTextField(int cols)
Constructor.


IosTextField

public IosTextField(int cols,
                    java.lang.String _charSet)
Constructor defining also the Charset.


IosTextField

public IosTextField(int cols,
                    java.lang.String _charSet,
                    boolean _autoFormat,
                    boolean _keepFocus)
Constructor defining the charset, auto-formating and illegal-value-focus-keeping.

Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Add an ActionListener

Overrides:
addActionListener in class java.awt.TextField

lockDisable

public void lockDisable(boolean disable)
Disable the field and lock it against any setEnable().


unlockDisabled

public void unlockDisabled()
Unlock a the lock on the disable of the field (does not directly enable the field, but realows enabling).


isDisableLocked

public boolean isDisableLocked()
Check, if the field is locked disabled.


setEnabled

public void setEnabled(boolean en)
setEnabled() protected with the disable-lock.

Overrides:
setEnabled in class java.awt.Component

setText

public void setText(java.lang.String text)
Sets the text. Watches the maximal size of the field, so that the leading part of the text is always visible, handles null-Values. (the default-implementation show the trailing part of the text, because always the caret is set to the end of the textfield.).

Overrides:
setText in class java.awt.TextField

getText

public java.lang.String getText()
Overloaded, calls syncGetText().

Overrides:
getText in class java.awt.TextComponent
See Also:
syncGetText()

syncGetText

public java.lang.String syncGetText()
To solve problem with blocking peers (Bug in Motif/JDK?).


getNullText

public java.lang.String getNullText()
Gets the text. We couldn't give that functionality to getText(), cause it's internally used by Super-Classes not expecting null-Values.


getFormatedText

public java.lang.String getFormatedText()
Get the text after formating (primary for internal use at inheritances). Does (and MUST) not request the focus.


formatValue

public boolean formatValue()
Request-Method for formating the Data (only for redefinition by inheritances). Default-Implementation does nothing.

Returns:
false, if formating fails due to an illegal Value (results in keeping the Focus, if requested by setKeepFocusOnIllegalValue).

setCharSet

public void setCharSet(java.lang.String s)
Set a "special" character set. All other characters are ignored on input.

Parameters:
s - A string with valid characters.
See Also:
#keyTyped()

getCharSet

public java.lang.String getCharSet()
Get the "special" character set.

Returns:
The "special" character set.

setInfoText

public void setInfoText(java.lang.String text)
Implements InfoTopic.


getInfoText

public java.lang.String getInfoText()
Implements InfoTopic.


setAutoSelection

public void setAutoSelection(boolean _autoSelection)
Enable/disable the Auto-Selection-Mode.


setAutoFormat

public void setAutoFormat(boolean _autoFormat)
Set the autoformat-mode of this field. If autoformat is activated the field is automaticaly formated if the focus is lost permanently.


setKeepFocusOnIllegalValue

public void setKeepFocusOnIllegalValue(boolean _keepFocus)
Defines, if to keep the Focus on illegal Values (only on active AutoFormat).


manuallyHandle

public IosTextField manuallyHandle(java.lang.String _keys,
                                   java.lang.String _replace)
Define the Keys to be handled manually


focusGained

public void focusGained(java.awt.event.FocusEvent evt)
Implements FocusListener Invoked when the component gains the keyboard focus. Marks the complet input (but leaves the caret-position).

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent evt)
Implements FocusListener Invoked when a component loses the keyboard focus. Stores the temporary-flag of the event and resets selection if autoselection is enabled.

Specified by:
focusLost in interface java.awt.event.FocusListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Implements MouseListener Invoked when the mouse has been clicked on a component. Defaultimplementation, does nothing

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Implements MouseListener Invoked when the mouse enters a component. Defaultimplementation, does nothing

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Implements MouseListener Invoked when the mouse exits a component. Defaultimplementation, does nothing

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Implements MouseListener Invoked when a mouse button has been pressed on a component. Subpress autoselection for the following focus-event.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Implements MouseListener Invoked when a mouse button has been released on a component. Defaultimplementation, does nothing

Specified by:
mouseReleased in interface java.awt.event.MouseListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Implements KeyListener. Invoked when a key has been pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Implements KeyListener. Invoked when a key has been released.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Implements KeyListener. Invoked when a key has been typed. Replaces manualy handled Characters.

Specified by:
keyTyped in interface java.awt.event.KeyListener

textValueChanged

public void textValueChanged(java.awt.event.TextEvent e)
Implements Text-Listener.

Specified by:
textValueChanged in interface java.awt.event.TextListener