org.exoplatform.gwtframework.ui.client.component
Class TextItemBase

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by org.exoplatform.gwtframework.ui.client.component.TextItemBase
All Implemented Interfaces:
com.google.gwt.event.dom.client.HasAllKeyHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.TakesValue<java.lang.String>, com.google.gwt.user.client.ui.HasValue<java.lang.String>, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IndexedPanel, com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, java.lang.Iterable<com.google.gwt.user.client.ui.Widget>, TextFieldItem
Direct Known Subclasses:
PasswordField, TextAreaItem, TextField

public class TextItemBase
extends com.google.gwt.user.client.ui.ComplexPanel
implements TextFieldItem

Represents the base complex component, which consists of component for displaying text input and title(label) near it. This is super class for such text inputs as text field, text area and password field. It consists of TextInputBase - field for editing text and SpanElement - title of the field.
User can change the title's position (on top, on the right or left side of the text field):
textField.setTitleOrientation(TitleOrientation.RIGHT); The title's align can be set (left, right, center):
textField.setTitleAlign(Align.CENTER); When component is disabled - the style of it is changed to show the state. For not to show disabled state, use setShowDisabled(false).

Version:
$Id: Feb 22, 2011 10:27:20 AM anya $
Author:
Ann Zhuleva

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
 
Field Summary
static TextInputResource resource
          CSS and image resources.
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
TextItemBase(TextInputBase textElement)
           
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.String> handler)
           
 void clearValue()
          Clear value of the text input.
 void disable()
          Disable the element (cannot change text in input).
 void enable()
          Enable the element (can change text in input).
 void focusInItem()
          Give browser focus to text input.
 int getHeight()
           
 java.lang.String getId()
           
 java.lang.String getName()
           
protected  com.google.gwt.user.client.ui.TextBoxBase getTextElement()
           
 java.lang.String getTitle()
           
 Align getTitleAlign()
           
 com.google.gwt.dom.client.SpanElement getTitleElement()
           
 TitleOrientation getTitleOrientation()
           
 int getTitleWidth()
           
 java.lang.String getValue()
           
 int getWidth()
           
 boolean hasBorder()
           
 void hide()
          Hide component on HTML page.
 boolean isEnabled()
           
 boolean isShowDisabled()
           
 boolean isShowTitle()
           
 void redraw()
           
 void selectValue()
          Select the text in text input.
 void setDisabled(boolean isDisabled)
          Set the disabled state of the component.
 void setEnabled(boolean enabled)
          Change the enabled state of the component.
 void setHasBorder(boolean hasBorder)
           
 void setHeight(int height)
           
 void setId(java.lang.String id)
           
 void setName(java.lang.String name)
           
 void setReadOnly(boolean b)
          Set text input read only
 void setShowDisabled(boolean isShowDisabled)
          if false the disabled state of the component is not shown.
 void setShowTitle(boolean isShowTitle)
           
 void setTextItemHeight(int height)
          Sets new height of text field.
 void setTitle(java.lang.String title)
          Sets the text of the title to display near text field.
 void setTitleAlign(Align titleAlign)
           
 void setTitleOrientation(java.lang.String orientation)
          Sets position of item's Title
 void setTitleOrientation(TitleOrientation titleOrientation)
          Set the title's position near text field.
 void setTitleWidth(int titleWidth)
           
 void setValue(java.lang.String value)
           
 void setValue(java.lang.String value, boolean fireEvents)
           
 void setWidth(int width)
          Sets new width of this item
 void setWidth(java.lang.String width)
           
 void show()
          Show component.
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Field Detail

resource

public static final TextInputResource resource
CSS and image resources.

Constructor Detail

TextItemBase

public TextItemBase(TextInputBase textElement)
Parameters:
textElement - the text input element
Method Detail

getTextElement

protected com.google.gwt.user.client.ui.TextBoxBase getTextElement()
Returns:
the textItem

getWidth

public int getWidth()
Returns:
the width

setWidth

public void setWidth(int width)
Sets new width of this item

Parameters:
width - the width to set

setWidth

public void setWidth(java.lang.String width)
Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject

getHeight

public int getHeight()
Returns:
the height

setHeight

public void setHeight(int height)
Parameters:
height - the height to set

setTextItemHeight

public void setTextItemHeight(int height)
Sets new height of text field.

Parameters:
height -

getId

public java.lang.String getId()
Returns:
the id

setId

public void setId(java.lang.String id)
Parameters:
id - the id to set

getTitle

public java.lang.String getTitle()
Overrides:
getTitle in class com.google.gwt.user.client.ui.UIObject
Returns:
the title

setTitle

public void setTitle(java.lang.String title)
Sets the text of the title to display near text field.

Overrides:
setTitle in class com.google.gwt.user.client.ui.UIObject
Parameters:
title - title to display

isEnabled

public boolean isEnabled()
Returns:
the enabled

setEnabled

public void setEnabled(boolean enabled)
Change the enabled state of the component.

Parameters:
enabled - enabled state

enable

public void enable()
Enable the element (can change text in input).


disable

public void disable()
Disable the element (cannot change text in input).


setDisabled

public void setDisabled(boolean isDisabled)
Set the disabled state of the component.

Parameters:
isDisabled -

show

public void show()
Show component.


hide

public void hide()
Hide component on HTML page.


focusInItem

public void focusInItem()
Give browser focus to text input.


clearValue

public void clearValue()
Clear value of the text input.


addValueChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.String> handler)
Specified by:
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>
See Also:
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)

setName

public void setName(java.lang.String name)
Parameters:
name -

isShowTitle

public boolean isShowTitle()
Returns:
the isShowTitle if false title is not displayed

setShowTitle

public void setShowTitle(boolean isShowTitle)
Parameters:
isShowTitle - if false title is not displayed

setHasBorder

public void setHasBorder(boolean hasBorder)

hasBorder

public boolean hasBorder()

isShowDisabled

public boolean isShowDisabled()
Returns:
the isShowDisabled

setShowDisabled

public void setShowDisabled(boolean isShowDisabled)
if false the disabled state of the component is not shown.

Parameters:
isShowDisabled -

getTitleAlign

public Align getTitleAlign()
Returns:
the titleAlign

setTitleAlign

public void setTitleAlign(Align titleAlign)
Parameters:
titleAlign - the titleAlign to set

getTitleOrientation

public TitleOrientation getTitleOrientation()
Returns:
the titleOrientation

setTitleOrientation

public void setTitleOrientation(TitleOrientation titleOrientation)
Set the title's position near text field.

Parameters:
titleOrientation - title's orientation

setTitleOrientation

public void setTitleOrientation(java.lang.String orientation)
Sets position of item's Title

Parameters:
orientation - title's orientation. Applies only "left", "right" and "top" values

getTitleElement

public com.google.gwt.dom.client.SpanElement getTitleElement()
Returns:
the titleElement

redraw

public void redraw()

selectValue

public void selectValue()
Select the text in text input.


addKeyPressHandler

public com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
Specified by:
addKeyPressHandler in interface com.google.gwt.event.dom.client.HasKeyPressHandlers
See Also:
HasKeyPressHandlers.addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)

getName

public java.lang.String getName()

addKeyUpHandler

public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler handler)
Specified by:
addKeyUpHandler in interface com.google.gwt.event.dom.client.HasKeyUpHandlers
See Also:
HasKeyUpHandlers.addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)

addKeyDownHandler

public com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
Specified by:
addKeyDownHandler in interface com.google.gwt.event.dom.client.HasKeyDownHandlers
See Also:
HasKeyDownHandlers.addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler)

getValue

public java.lang.String getValue()
Specified by:
getValue in interface com.google.gwt.user.client.TakesValue<java.lang.String>
Specified by:
getValue in interface com.google.gwt.user.client.ui.HasValue<java.lang.String>
See Also:
HasValue.getValue()

setValue

public void setValue(java.lang.String value)
Specified by:
setValue in interface com.google.gwt.user.client.TakesValue<java.lang.String>
Specified by:
setValue in interface com.google.gwt.user.client.ui.HasValue<java.lang.String>
See Also:
HasValue.setValue(java.lang.Object)

setValue

public void setValue(java.lang.String value,
                     boolean fireEvents)
Specified by:
setValue in interface com.google.gwt.user.client.ui.HasValue<java.lang.String>
See Also:
HasValue.setValue(java.lang.Object, boolean)

getTitleWidth

public int getTitleWidth()
Returns:
the titleWidth

setTitleWidth

public void setTitleWidth(int titleWidth)
Parameters:
titleWidth - the titleWidth to set

setReadOnly

public void setReadOnly(boolean b)
Set text input read only

Parameters:
b - is read only


Copyright © 2012 eXo Platform SAS. All Rights Reserved.