public class ComboBox<T extends ListDataModel> extends TextButtonPanel<String> implements com.google.gwt.event.dom.client.HasAllFocusHandlers, com.google.gwt.event.dom.client.HasAllKeyHandlers, com.google.gwt.event.dom.client.HasClickHandlers, ListModelListener, com.google.gwt.event.dom.client.HasChangeHandlers, com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>
Modifier and Type | Class and Description |
---|---|
protected class |
ComboBox.ComboBoxKeyboardManager
This is a keyboard manager implementation developed for the widget.
|
protected class |
ComboBox.DelegateHandler
Universal handler that delegates all events handling to custom handlers.
|
TextButtonPanel.EnterAction
Constructor and Description |
---|
ComboBox() |
Modifier and Type | Method and Description |
---|---|
protected void |
add(ListModelEvent event)
Adds a new visual item into the drop down list every time when it's added into the data
model.
|
com.google.gwt.event.shared.HandlerRegistration |
addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
Note that handlers added by this method will receive
ComboBoxChangeEvent s. |
com.google.gwt.event.shared.HandlerRegistration |
addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.ui.PopupPanel> handler)
Adds a close handler to the popup list of items.
|
protected void |
addComponentListeners()
This method adds component listeners.
|
com.google.gwt.event.shared.HandlerRegistration |
addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler) |
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<String> handler)
Adds a value change handler to the component that will be invoked only if
HasValue.setValue(Object, boolean) has the second parameter = true . |
protected void |
clean(ListModelEvent event)
This method cleans the drop down list on each data clean.
|
void |
cleanSelection()
Cleans all the data displayed in the widget.
|
protected String |
getDefaultImageName()
This method should returns a default button image name.
|
protected ComboBox.DelegateHandler |
getDelegateHandler()
Getter for property 'delegateHandler'.
|
DropDownPosition |
getDropDownPosition()
Gets applied position of the drop down list.
|
int |
getHighlightRow()
Gets a highlight row number.
|
com.google.gwt.user.client.ui.Widget |
getItem(int index)
Gets an item by its index
If index < 0 or index >=
getItemCount() it throws an exception. |
int |
getItemCount()
This method gets an actual number of items displayed in the drop down.
|
int |
getItemIndex(com.google.gwt.user.client.ui.Widget item)
Gets an item index if it's displayed in the drop down list.
|
protected ComboBox.ComboBoxKeyboardManager |
getKeyboardManager()
This method gets a keybord manager implementation for the component.
|
ListItemFactory |
getListItemFactory()
Getter for property 'listItemFactory'.
|
protected ListPopupPanel |
getListPanel()
Getter for property 'listPanel'.
|
ListDataModel |
getModel()
Getter for property 'model'.
|
Object |
getSelected()
This method returns a selected item.
|
String |
getSelectedId()
This method returns a selected item ID.
|
int |
getSelectedIndex()
This method returns a selected item index.
|
com.google.gwt.user.client.ui.Widget |
getSelectedWidget()
This method gets a widget that is currently selected in the drop down list.
|
int |
getStartItemIndex() |
String |
getText()
Deprecated.
use
getValue() instead. |
String |
getValue()
Similar to
getText() |
int |
getVisibleRows()
Gets a number of visible rows.
|
void |
hideList()
Hides the drop down list.
|
protected boolean |
isKeyPressed()
Returns
true if cursor is moved by a control key. |
boolean |
isLazyRenderingEnabled()
Checks whether the lazy rendering option is enabled.
|
boolean |
isListPanelOpened()
This method check the list panel status.
|
void |
moveCursor(int step)
Moves the cursor up or down.
|
void |
onModelEvent(ListModelEvent event)
This method should implement actions which related widgets must do on events.
|
protected void |
prepareSelectedValue()
Prepares the selected value box for displaying.
|
protected void |
remove(ListModelEvent event)
Removes a visual item from the drop down list if the remove event is received.
|
void |
select(int row)
Selects the specified item in the model and in the drop down list.
|
protected void |
select(ListModelEvent event)
Highlights the visual item in the drop down list if it's selected in the model.
|
void |
setDropDownPosition(DropDownPosition dropDownPosition)
Sets applied position of the drop down list.
|
void |
setFocus(boolean focus)
This method sets focus on this widget.
|
void |
setHighlightRow(int row)
Sets a highlight row number and display the row as selected but not actually
select it.
|
protected void |
setKeyPressed(boolean keyPressed)
Sets the value of the key pressed flag.
|
void |
setLazyRenderingEnabled(boolean lazyRenderingEnabled)
Enables or disables lazy rendering option.
|
void |
setListItemFactory(ListItemFactory listItemFactory)
Setter for property 'listItemFactory'.
|
void |
setListPopupOpened(boolean opened)
Opens / closes list popup panel by request.
|
void |
setModel(T model)
Setter for property 'model'.
|
void |
setSelectedId(String id)
This method sets the selected item ID.
|
void |
setSelectedIndex(int index)
This method sets the selected item index.
|
void |
setStartItemIndex(int index)
Sets an item index that must be displayed on top.
|
void |
setText(String text)
Deprecated.
use
setValue(String) instead. |
void |
setValue(String value)
Similar to
setText(String) and doesn't send any event |
void |
setValue(String value,
boolean fireEvents)
|
void |
setVisibleRows(int visibleRows)
Sets visible rows number.
|
void |
showList(boolean prepareList)
This method shows the drop down list.
|
display, getChoiceButton, getChoiceButtonImage, getEnterAction, getHeight, getLayout, getLockingPanel, getMaxLength, getSelectedValue, getWidth, isChoiceButtonVisible, isCustomTextAllowed, isEnabled, isLocked, lock, prepareChoiceButton, setChoiceButtonImage, setChoiceButtonVisible, setCustomTextAllowed, setEnabled, setEnterAction, setHeight, setLocked, setMaxLength, setTabIndex, setWidth, unlock
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString, unsinkEvents
public void setModel(T model)
model
- Value to set for property 'model'.public void setListItemFactory(ListItemFactory listItemFactory)
listItemFactory
- Value to set for property 'listItemFactory'.public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)
addBlurHandler
in interface com.google.gwt.event.dom.client.HasBlurHandlers
public com.google.gwt.event.shared.HandlerRegistration addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler)
addFocusHandler
in interface com.google.gwt.event.dom.client.HasFocusHandlers
public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler handler)
addKeyUpHandler
in interface com.google.gwt.event.dom.client.HasKeyUpHandlers
public com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
addKeyDownHandler
in interface com.google.gwt.event.dom.client.HasKeyDownHandlers
public com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
addKeyPressHandler
in interface com.google.gwt.event.dom.client.HasKeyPressHandlers
public com.google.gwt.event.shared.HandlerRegistration addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
ComboBoxChangeEvent
s.addChangeHandler
in interface com.google.gwt.event.dom.client.HasChangeHandlers
handler
- the change handlerpublic com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
addClickHandler
in interface com.google.gwt.event.dom.client.HasClickHandlers
public ListDataModel getModel()
public ListItemFactory getListItemFactory()
public void setFocus(boolean focus)
focus
- is a flag of focus.public boolean isListPanelOpened()
true
if it's opened.public String getText()
getValue()
instead.public int getVisibleRows()
public void setVisibleRows(int visibleRows)
visibleRows
- is a number of rows to be displayed without scrolling.public void setStartItemIndex(int index)
index
- is an index of the item that must be displayed on top of the visible area.public int getStartItemIndex()
public void setText(String text)
setValue(String)
instead.text
- is a text to set.public Object getSelected()
public int getSelectedIndex()
public String getSelectedId()
public void setSelectedId(String id)
id
- is an item ID to select.public void setSelectedIndex(int index)
index
- a selected item index.public void setListPopupOpened(boolean opened)
opened
- true
means "show".public com.google.gwt.user.client.ui.Widget getSelectedWidget()
null
if the drop down list is collapsed.public void cleanSelection()
cleanSelection
in class TextButtonPanel<String>
public int getHighlightRow()
-1
if nothing is highlight.public void setHighlightRow(int row)
row
- is a row number to highlight. If it's out of range thus method does nothing.public int getItemCount()
public com.google.gwt.user.client.ui.Widget getItem(int index)
getItemCount()
it throws an exception.index
- is an index of the item to get.IndexOutOfBoundsException
- if index is invalid.public int getItemIndex(com.google.gwt.user.client.ui.Widget item)
-1
.item
- an item that is required to return.-1
.public void showList(boolean prepareList)
prepareList
- forces the list to be prepared (refreshed) before displaying.public void moveCursor(int step)
step
- is a number of items relative to the current cursor position.public void hideList()
public void select(int row)
row
- is a row index to selectpublic void onModelEvent(ListModelEvent event)
onModelEvent
in interface ListModelListener
event
- an event produced by the model.public boolean isLazyRenderingEnabled()
public void setLazyRenderingEnabled(boolean lazyRenderingEnabled)
SuggestionBox
and
SuggestionBoxDataModel
.lazyRenderingEnabled
- is an option value.public DropDownPosition getDropDownPosition()
public void setDropDownPosition(DropDownPosition dropDownPosition)
dropDownPosition
- is a drop down list position value.public com.google.gwt.event.shared.HandlerRegistration addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.ui.PopupPanel> handler)
addCloseHandler
in interface com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>
handler
- is a handler to add.public void setValue(String value)
setText(String)
and doesn't send any eventpublic void setValue(String value, boolean fireEvents)
setValue
in interface com.google.gwt.user.client.ui.HasValue<String>
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler)
HasValue.setValue(Object, boolean)
has the second parameter = true
.
Note that the widget doesn't fire the event if you don't use the method specified above.addValueChangeHandler
in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<String>
protected void add(ListModelEvent event)
event
- is an event containing data about the item.protected void clean(ListModelEvent event)
event
- is a clean event.protected void remove(ListModelEvent event)
event
- is an event that contains data of the removed item.protected void select(ListModelEvent event)
event
- is an event that contains data about selected item.protected String getDefaultImageName()
getDefaultImageName
in class TextButtonPanel<String>
protected boolean isKeyPressed()
true
if cursor is moved by a control key.protected void setKeyPressed(boolean keyPressed)
keyPressed
- is a key pressed flag value.protected void prepareSelectedValue()
prepareSelectedValue
in class TextButtonPanel<String>
protected void addComponentListeners()
addComponentListeners
in class TextButtonPanel<String>
protected ListPopupPanel getListPanel()
protected ComboBox.DelegateHandler getDelegateHandler()
protected ComboBox.ComboBoxKeyboardManager getKeyboardManager()
Copyright © 2008–2013. All rights reserved.