com.sencha.gxt.cell.core.client.form
Class ComboBoxCell<T>

java.lang.Object
  extended by com.google.gwt.cell.client.AbstractCell<C>
      extended by com.google.gwt.cell.client.AbstractEditableCell<C,V>
          extended by com.google.gwt.cell.client.AbstractInputCell<T,V>
              extended by com.sencha.gxt.cell.core.client.AbstractEventInputCell<T,FieldCell.FieldViewData>
                  extended by com.sencha.gxt.cell.core.client.form.FieldCell<T>
                      extended by com.sencha.gxt.cell.core.client.form.ValueBaseInputCell<T>
                          extended by com.sencha.gxt.cell.core.client.form.TriggerFieldCell<T>
                              extended by com.sencha.gxt.cell.core.client.form.ComboBoxCell<T>
All Implemented Interfaces:
Cell<T>, HasBeforeSelectionHandlers<T>, HasSelectionHandlers<T>, HasHandlers, ResizableCell, ParseErrorEvent.HasParseErrorHandlers
Direct Known Subclasses:
TimeFieldCell

public class ComboBoxCell<T>
extends TriggerFieldCell<T>
implements HasBeforeSelectionHandlers<T>, HasSelectionHandlers<T>


Nested Class Summary
static class ComboBoxCell.QueryMode
           
static class ComboBoxCell.TriggerAction
          TriggerAction enum.
 
Nested classes/interfaces inherited from class com.sencha.gxt.cell.core.client.form.TriggerFieldCell
TriggerFieldCell.TriggerFieldAppearance
 
Nested classes/interfaces inherited from class com.sencha.gxt.cell.core.client.form.ValueBaseInputCell
ValueBaseInputCell.ValueBaseFieldAppearance
 
Nested classes/interfaces inherited from class com.sencha.gxt.cell.core.client.form.FieldCell
FieldCell.FieldAppearance, FieldCell.FieldAppearanceOptions, FieldCell.FieldViewData
 
Nested classes/interfaces inherited from interface com.google.gwt.cell.client.Cell
Cell.Context
 
Constructor Summary
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider)
          Creates a combo box cell that renders all items with the given label provider.
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, ListView<T,?> view)
          Creates a combo box cell that renders the input value with the label provider.
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, ListView<T,?> view, TriggerFieldCell.TriggerFieldAppearance appearance)
          Creates a combo box cell that renders the input value with the label provider.
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, SafeHtmlRenderer<T> renderer)
          Creates a combo box cell that renders the input value with the label provider and the drop down values with the renderer.
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, SafeHtmlRenderer<T> renderer, TriggerFieldCell.TriggerFieldAppearance appearance)
          Creates a combo box cell that renders the input value with the label provider and the drop down values with the renderer.
ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, TriggerFieldCell.TriggerFieldAppearance appearance)
          Creates a combo box cell that renders both the input value and drop down values with the given label provider.
 
Method Summary
 HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<T> handler)
          Adds a BeforeSelectionEvent handler.
 HandlerRegistration addSelectionHandler(SelectionHandler<T> handler)
          Adds a SelectionEvent handler.
 void collapse(Cell.Context context, XElement parent)
           
 void doQuery(Cell.Context context, XElement parent, ValueUpdater<T> updater, T value, java.lang.String query, boolean force)
           
 void expand(Cell.Context context, XElement parent, ValueUpdater<T> updater, T value)
           
 java.lang.String getAllQuery()
          Returns the all query.
 LabelProvider<? super T> getLabelProvider()
          Returns the label provider.
 ListView<T,?> getListView()
          Returns the list view.
 Loader<?,?> getLoader()
           
 int getMinChars()
          Returns the min characters used for autocompete and typeahead.
 int getMinListWidth()
          Returns the dropdown list's min width.
 ComboBoxCell.QueryMode getMode()
           
 int getPageSize()
          Returns the page size.
 PagingToolBar getPagingToolBar()
          Returns the combo's paging tool bar.
 ListStore<T> getStore()
          Returns the combo's list store.
 ComboBoxCell.TriggerAction getTriggerAction()
          Returns the trigger action.
 int getTypeAheadDelay()
          Returns the type ahead delay in milliseconds.
 boolean isExpanded()
          Returns true if the dropdown is expanded.
 boolean isForceSelection()
          Returns true if the field's value is forced to one of the value in the list.
 boolean isTypeAhead()
          Returns true if type ahead is enabled.
 void onBrowserEvent(Cell.Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater)
           
 void render(Cell.Context context, T value, SafeHtmlBuilder sb)
           
 void select(int index)
          Select an item in the dropdown list by its numeric index in the list.
 void select(T item)
          Select an item in the dropdown list.
 void setAllQuery(java.lang.String allQuery)
          The text query to send to the server to return all records for the list with no filtering (defaults to '').
 void setForceSelection(boolean forceSelection)
          Sets whether the combo's value is restricted to one of the values in the list, false to allow the user to set arbitrary text into the field (defaults to false).
 void setLoader(Loader<?,?> loader)
          Sets the loader for use with remote queries.
 void setMinChars(int minChars)
          Sets the minimum number of characters the user must type before autocomplete and typeahead active (defaults to 4 if remote, or 0 if local).
 void setMinListWidth(int minListWidth)
          Sets the minimum width of the dropdown list in pixels (defaults to 70, will be ignored if listWidth has a higher value).
 void setPageSize(int pageSize)
          Sets the page size.
 void setStore(ListStore<T> store)
          Sets the combo's store.
 void setTriggerAction(ComboBoxCell.TriggerAction triggerAction)
           
 void setTypeAhead(boolean typeAhead)
           
 void setTypeAheadDelay(int typeAheadDelay)
           
 
Methods inherited from class com.sencha.gxt.cell.core.client.form.TriggerFieldCell
finishEditing, getAppearance, isEditable, isHideTrigger, isMonitorTab, setEditable, setHideTrigger, setMonitorTab, setSize
 
Methods inherited from class com.sencha.gxt.cell.core.client.form.ValueBaseInputCell
addParseErrorHandler, disable, enable, getCursorPos, getEmptyText, getInputElement, getName, getPropertyEditor, getText, isAllowBlank, isClearValueOnParseError, isSelectOnFocus, onEmpty, resetFocus, select, selectAll, setAllowBlank, setClearValueOnParseError, setCursorPos, setEmptyText, setName, setPropertyEditor, setSelectOnFocus, setText
 
Methods inherited from class com.sencha.gxt.cell.core.client.form.FieldCell
getHeight, getWidth, handlesSelection, isDisabled, isReadOnly, onValid, redrawOnResize, setHeight, setReadOnly, setSize, setWidth
 
Methods inherited from class com.sencha.gxt.cell.core.client.AbstractEventInputCell
addHandler, fireEvent, isDisableEvents, setDisableEvents
 
Methods inherited from class com.google.gwt.cell.client.AbstractInputCell
isEditing
 
Methods inherited from class com.google.gwt.cell.client.AbstractEditableCell
clearViewData, getViewData, setViewData
 
Methods inherited from class com.google.gwt.cell.client.AbstractCell
dependsOnSelection, getConsumedEvents, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider)
Creates a combo box cell that renders all items with the given label provider.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider,
                    ListView<T,?> view)
Creates a combo box cell that renders the input value with the label provider.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box
view - the list view

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider,
                    ListView<T,?> view,
                    TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box cell that renders the input value with the label provider.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box
view - the list view
appearance - the appearance

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider,
                    SafeHtmlRenderer<T> renderer)
Creates a combo box cell that renders the input value with the label provider and the drop down values with the renderer.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box
renderer - draws the current model as html in the drop down

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider,
                    SafeHtmlRenderer<T> renderer,
                    TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box cell that renders the input value with the label provider and the drop down values with the renderer.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box
renderer - draws the current model as html in the drop down
appearance - the appearance

ComboBoxCell

public ComboBoxCell(ListStore<T> store,
                    LabelProvider<? super T> labelProvider,
                    TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box cell that renders both the input value and drop down values with the given label provider.

Parameters:
store - the store containing the data that can be selected
labelProvider - converts the current model type into a string value to display in the text box and the drop down values
appearance - the appearance
Method Detail

addBeforeSelectionHandler

public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<T> handler)
Adds a BeforeSelectionEvent handler. The handler will be passed an instance of CellBeforeSelectionEvent which can be cast to.

Specified by:
addBeforeSelectionHandler in interface HasBeforeSelectionHandlers<T>
Parameters:
handler - the handler
Returns:
the registration for the event

addSelectionHandler

public HandlerRegistration addSelectionHandler(SelectionHandler<T> handler)
Adds a SelectionEvent handler. The handler will be passed an instance of CellSelectionEvent which can be cast to.

Specified by:
addSelectionHandler in interface HasSelectionHandlers<T>
Parameters:
handler - the handler
Returns:
the registration for the event

collapse

public void collapse(Cell.Context context,
                     XElement parent)

doQuery

public void doQuery(Cell.Context context,
                    XElement parent,
                    ValueUpdater<T> updater,
                    T value,
                    java.lang.String query,
                    boolean force)

expand

public void expand(Cell.Context context,
                   XElement parent,
                   ValueUpdater<T> updater,
                   T value)

getAllQuery

public java.lang.String getAllQuery()
Returns the all query.

Returns:
the all query

getLabelProvider

public LabelProvider<? super T> getLabelProvider()
Returns the label provider.

Returns:
the label provider

getListView

public ListView<T,?> getListView()
Returns the list view.

Returns:
the list view

getLoader

public Loader<?,?> getLoader()

getMinChars

public int getMinChars()
Returns the min characters used for autocompete and typeahead.

Returns:
the minimum number of characters

getMinListWidth

public int getMinListWidth()
Returns the dropdown list's min width.

Returns:
the min width

getMode

public ComboBoxCell.QueryMode getMode()

getPageSize

public int getPageSize()
Returns the page size.

Returns:
the page size

getPagingToolBar

public PagingToolBar getPagingToolBar()
Returns the combo's paging tool bar.

Returns:
the tool bar

getStore

public ListStore<T> getStore()
Returns the combo's list store.

Returns:
the store

getTriggerAction

public ComboBoxCell.TriggerAction getTriggerAction()
Returns the trigger action.

Returns:
the trigger action

getTypeAheadDelay

public int getTypeAheadDelay()
Returns the type ahead delay in milliseconds.

Returns:
the type ahead delay

isExpanded

public boolean isExpanded()
Returns true if the dropdown is expanded.

Returns:
the expand state

isForceSelection

public boolean isForceSelection()
Returns true if the field's value is forced to one of the value in the list.

Returns:
the force selection state

isTypeAhead

public boolean isTypeAhead()
Returns true if type ahead is enabled.

Returns:
the type ahead state

onBrowserEvent

public void onBrowserEvent(Cell.Context context,
                           Element parent,
                           T value,
                           NativeEvent event,
                           ValueUpdater<T> valueUpdater)
Specified by:
onBrowserEvent in interface Cell<T>
Overrides:
onBrowserEvent in class TriggerFieldCell<T>

render

public void render(Cell.Context context,
                   T value,
                   SafeHtmlBuilder sb)
Specified by:
render in interface Cell<T>
Overrides:
render in class TriggerFieldCell<T>

select

public void select(int index)
Select an item in the dropdown list by its numeric index in the list. This function does NOT cause the select event to fire. The list must expanded for this function to work, otherwise use #setValue.

Parameters:
index - the index of the item to select

select

public void select(T item)
Select an item in the dropdown list. This function does NOT cause the select event to fire. The list must expanded for this function to work, otherwise use #setValue.

Parameters:
item - the item to select

setAllQuery

public void setAllQuery(java.lang.String allQuery)
The text query to send to the server to return all records for the list with no filtering (defaults to '').

Parameters:
allQuery - the all query

setForceSelection

public void setForceSelection(boolean forceSelection)
Sets whether the combo's value is restricted to one of the values in the list, false to allow the user to set arbitrary text into the field (defaults to false).

Parameters:
forceSelection - true to force selection

setLoader

public void setLoader(Loader<?,?> loader)
Sets the loader for use with remote queries.

Parameters:
loader - the loader

setMinChars

public void setMinChars(int minChars)
Sets the minimum number of characters the user must type before autocomplete and typeahead active (defaults to 4 if remote, or 0 if local).

Parameters:
minChars - minimum number of characters before activating autocomplete and typeahead

setMinListWidth

public void setMinListWidth(int minListWidth)
Sets the minimum width of the dropdown list in pixels (defaults to 70, will be ignored if listWidth has a higher value).

Parameters:
minListWidth - the min width

setPageSize

public void setPageSize(int pageSize)
Sets the page size. Only applies when using a paging toolbar.

Parameters:
pageSize - the page size

setStore

public void setStore(ListStore<T> store)
Sets the combo's store.

Parameters:
store - the store

setTriggerAction

public void setTriggerAction(ComboBoxCell.TriggerAction triggerAction)

setTypeAhead

public void setTypeAhead(boolean typeAhead)

setTypeAheadDelay

public void setTypeAheadDelay(int typeAheadDelay)


Copyright © 2012. All Rights Reserved.