com.vaadin.client.ui
Class VTextField

java.lang.Object
  extended by TextBoxBase
      extended by com.vaadin.client.ui.VTextField
All Implemented Interfaces:
Field
Direct Known Subclasses:
VPasswordField, VTextArea

public class VTextField
extends TextBoxBase
implements Field

This class represents a basic text input field with one row.

Author:
Vaadin Ltd.

Field Summary
static java.lang.String CLASSNAME
          The input node CSS classname.
static java.lang.String CLASSNAME_FOCUS
          This CSS classname is added to the input node on hover.
 ApplicationConnection client
          For internal use only.
 boolean listenTextChangeEvents
          For internal use only.
 java.lang.String paintableId
          For internal use only.
static int TEXTCHANGE_EVENTS
          For internal use only.
 java.lang.String textChangeEventMode
          For internal use only.
 int textChangeEventTimeout
           
 java.lang.String valueBeforeEdit
          For internal use only.
 
Constructor Summary
  VTextField()
           
protected VTextField(Element node)
           
 
Method Summary
 void attachCutEventListener(Element el)
          For internal use only.
protected  void detachCutEventListener(Element el)
           
static void flushChangesFromFocusedTextField()
           
 int getMaxLength()
           
protected  boolean isWordwrap()
           
protected  void onAttach()
           
 void onBlur(BlurEvent event)
           
 void onBrowserEvent(Event event)
           
 void onChange(ChangeEvent event)
           
protected  void onCut()
           
protected  void onDetach()
           
 void onFocus(FocusEvent event)
           
 void onKeyDown(KeyDownEvent event)
           
 void setColumns(int columns)
           
 void setImmediate(boolean immediate)
           
 void setInputPrompt(java.lang.String inputPrompt)
           
 void setMaxLength(int newMaxLength)
          For internal use only.
protected  void setMaxLengthToElement(int newMaxLength)
           
 void setReadOnly(boolean readOnly)
           
protected  boolean updateCursorPosition()
          Updates the cursor position variable if it has changed since the last update.
 void updateFieldContent(java.lang.String text)
          For internal use only.
protected  void updateMaxLength(int maxLength)
          This method is responsible for updating the DOM or otherwise ensuring that the given max length is enforced.
 void valueChange(boolean blurred)
          Called when the field value might have changed and/or the field was blurred.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME
The input node CSS classname.

See Also:
Constant Field Values

CLASSNAME_FOCUS

public static final java.lang.String CLASSNAME_FOCUS
This CSS classname is added to the input node on hover.

See Also:
Constant Field Values

paintableId

public java.lang.String paintableId
For internal use only. May be removed or replaced in the future.


client

public ApplicationConnection client
For internal use only. May be removed or replaced in the future.


valueBeforeEdit

public java.lang.String valueBeforeEdit
For internal use only. May be removed or replaced in the future.


TEXTCHANGE_EVENTS

public static final int TEXTCHANGE_EVENTS
For internal use only. May be removed or replaced in the future.

TODO When GWT adds ONCUT, add it there and remove workaround. See http://code.google.com/p/google-web-toolkit/issues/detail?id=4030

Also note that the cut/paste are not totally crossbrowsers compatible. E.g. in Opera mac works via context menu, but on via File->Paste/Cut. Opera might need the polling method for 100% working textchanceevents. Eager polling for a change is bit dum and heavy operation, so I guess we should first try to survive without.


listenTextChangeEvents

public boolean listenTextChangeEvents
For internal use only. May be removed or replaced in the future.


textChangeEventMode

public java.lang.String textChangeEventMode
For internal use only. May be removed or replaced in the future.


textChangeEventTimeout

public int textChangeEventTimeout
Constructor Detail

VTextField

public VTextField()

VTextField

protected VTextField(Element node)
Method Detail

onBrowserEvent

public void onBrowserEvent(Event event)

setReadOnly

public void setReadOnly(boolean readOnly)

updateFieldContent

public void updateFieldContent(java.lang.String text)
For internal use only. May be removed or replaced in the future.


onCut

protected void onCut()

attachCutEventListener

public void attachCutEventListener(Element el)
For internal use only. May be removed or replaced in the future.


detachCutEventListener

protected void detachCutEventListener(Element el)

onDetach

protected void onDetach()

onAttach

protected void onAttach()

setMaxLength

public void setMaxLength(int newMaxLength)
For internal use only. May be removed or replaced in the future.


updateMaxLength

protected void updateMaxLength(int maxLength)
This method is responsible for updating the DOM or otherwise ensuring that the given max length is enforced. Called when the max length for the field has changed.

Parameters:
maxLength - The new max length

setMaxLengthToElement

protected void setMaxLengthToElement(int newMaxLength)

getMaxLength

public int getMaxLength()

onChange

public void onChange(ChangeEvent event)

valueChange

public void valueChange(boolean blurred)
Called when the field value might have changed and/or the field was blurred. These are combined so the blur event is sent in the same batch as a possible value change event (these are often connected).

Parameters:
blurred - true if the field was blurred

updateCursorPosition

protected boolean updateCursorPosition()
Updates the cursor position variable if it has changed since the last update.

Returns:
true iff the value was updated

flushChangesFromFocusedTextField

public static void flushChangesFromFocusedTextField()

onFocus

public void onFocus(FocusEvent event)

onBlur

public void onBlur(BlurEvent event)

setColumns

public void setColumns(int columns)

onKeyDown

public void onKeyDown(KeyDownEvent event)

setImmediate

public void setImmediate(boolean immediate)

setInputPrompt

public void setInputPrompt(java.lang.String inputPrompt)

isWordwrap

protected boolean isWordwrap()


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.