com.sencha.gxt.widget.core.client
Class ListView<M,N>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.ListView<M,N>
Type Parameters:
M - the model type
N - the cell data type
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, BeforeHideEvent.HasBeforeHideHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, RefreshEvent.HasRefreshHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId

public class ListView<M,N>
extends Component
implements RefreshEvent.HasRefreshHandlers

Displays a list of data.


Nested Class Summary
static interface ListView.ListViewAppearance<M>
          The appearance of a list view.
static interface ListView.ListViewDefaultResources
          The default resources for the list view.
static interface ListView.ListViewDefaultStyle
          The default styles for the list view.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ListView(ListStore<M> store, ValueProvider<? super M,N> valueProvider)
          Creates a new list view.
ListView(ListStore<M> store, ValueProvider<? super M,N> valueProvider, Cell<N> cell)
          Creates a new list view.
ListView(ListStore<M> store, ValueProvider<? super M,N> valueProvider, ListView.ListViewAppearance<M> appearance)
          Creates a new list view.
 
Method Summary
 HandlerRegistration addRefreshHandler(RefreshEvent.RefreshHandler handler)
          Adds a RefreshEvent.RefreshHandler handler for RefreshEvent events.
 Element findElement(Element element)
          Returns the matching element.
 int findElementIndex(Element element)
          Returns the element's index.
 Cell<N> getCell()
          Returns the view's cell.
 XElement getElement(int index)
          Returns the element at the given index.
 List<Element> getElements()
          Returns all of the child elements.
 int getItemCount()
          Returns the number of models in the view.
 String getLoadingText()
          Returns the view's loading text.
 QuickTip getQuickTip()
          Returns the view's quick tip instance.
 ListViewSelectionModel<M> getSelectionModel()
          Returns the view's selection model.
 boolean getSelectOnOver()
          Returns true if select on hover is enabled.
static ListView.ListViewDefaultResources getStandardResources()
          Returns the default resources for the list view.
 ListStore<M> getStore()
          Returns the combo's store.
 int indexOf(Element element)
          Returns the index of the element.
 boolean isEnableQuickTips()
          Returns true if quicktips are enabled.
 void moveSelectedDown()
          Moves the current selections down one level.
 void moveSelectedUp()
          Moves the current selections up one level.
 void onBrowserEvent(Event event)
           
 void refresh()
          Refreshes the view by reloading the data from the store and re-rendering the template.
 void refreshNode(int index)
          Refreshes an individual node's data from the store.
 void setCell(Cell<N> cell)
          Optionally sets the view's cell.
 void setEnableQuickTips(boolean enableQuickTip)
          True to enable quicktips (defaults to true, pre-render).
 void setLoadingText(String loadingText)
          Sets the text loading text to be displayed during a load request.
 void setSelectionModel(ListViewSelectionModel<M> sm)
          Sets the selection model.
 void setSelectOnOver(boolean selectOnHover)
          True to select the item when mousing over a element (defaults to false).
 void setStore(ListStore<M> store)
          Changes the data store bound to this view and refreshes it.
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListView

public ListView(ListStore<M> store,
                ValueProvider<? super M,N> valueProvider)
Creates a new list view.

Parameters:
store - the store
valueProvider - the value provider

ListView

public ListView(ListStore<M> store,
                ValueProvider<? super M,N> valueProvider,
                Cell<N> cell)
Creates a new list view.

Parameters:
store - the store
valueProvider - the value provider
cell - the cell

ListView

public ListView(ListStore<M> store,
                ValueProvider<? super M,N> valueProvider,
                ListView.ListViewAppearance<M> appearance)
Creates a new list view.

Parameters:
store - the store
valueProvider - the value provider
appearance - the appearance
Method Detail

getStandardResources

public static ListView.ListViewDefaultResources getStandardResources()
Returns the default resources for the list view.

Returns:
the default resources

addRefreshHandler

public HandlerRegistration addRefreshHandler(RefreshEvent.RefreshHandler handler)
Description copied from interface: RefreshEvent.HasRefreshHandlers
Adds a RefreshEvent.RefreshHandler handler for RefreshEvent events.

Specified by:
addRefreshHandler in interface RefreshEvent.HasRefreshHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

findElement

public Element findElement(Element element)
Returns the matching element.

Parameters:
element - the element or any child element
Returns:
the parent element

findElementIndex

public int findElementIndex(Element element)
Returns the element's index.

Parameters:
element - the element or any child element
Returns:
the element index or -1 if no match

getCell

public Cell<N> getCell()
Returns the view's cell.

Returns:
the cell, or null if none specified

getElement

public XElement getElement(int index)
Returns the element at the given index.

Parameters:
index - the index
Returns:
the element

getElements

public List<Element> getElements()
Returns all of the child elements.

Returns:
the elements

getItemCount

public int getItemCount()
Returns the number of models in the view.

Returns:
the count

getLoadingText

public String getLoadingText()
Returns the view's loading text.

Returns:
the loading text

getQuickTip

public QuickTip getQuickTip()
Returns the view's quick tip instance.

Returns:
the quicktip instance or null if not enabled

getSelectionModel

public ListViewSelectionModel<M> getSelectionModel()
Returns the view's selection model.

Returns:
the selection model

getSelectOnOver

public boolean getSelectOnOver()
Returns true if select on hover is enabled.

Returns:
the select on hover state

getStore

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

Returns:
the store

indexOf

public int indexOf(Element element)
Returns the index of the element.

Parameters:
element - the element
Returns:
the index

isEnableQuickTips

public boolean isEnableQuickTips()
Returns true if quicktips are enabled.

Returns:
true for enabled

moveSelectedDown

public void moveSelectedDown()
Moves the current selections down one level.


moveSelectedUp

public void moveSelectedUp()
Moves the current selections up one level.


onBrowserEvent

public void onBrowserEvent(Event event)
Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Component

refresh

public void refresh()
Refreshes the view by reloading the data from the store and re-rendering the template.


refreshNode

public void refreshNode(int index)
Refreshes an individual node's data from the store.

Parameters:
index - the items data index in the store

setCell

public void setCell(Cell<N> cell)
Optionally sets the view's cell. If a cell is not provided, toString is called on the value returned by the view's value provider.

Parameters:
cell - the cell

setEnableQuickTips

public void setEnableQuickTips(boolean enableQuickTip)
True to enable quicktips (defaults to true, pre-render).

Parameters:
enableQuickTip - true to enable quicktips

setLoadingText

public void setLoadingText(String loadingText)
Sets the text loading text to be displayed during a load request.

Parameters:
loadingText - the loading text

setSelectionModel

public void setSelectionModel(ListViewSelectionModel<M> sm)
Sets the selection model.

Parameters:
sm - the selection model

setSelectOnOver

public void setSelectOnOver(boolean selectOnHover)
True to select the item when mousing over a element (defaults to false).

Parameters:
selectOnHover - true to select on mouse over

setStore

public void setStore(ListStore<M> store)
Changes the data store bound to this view and refreshes it.

Parameters:
store - the store to bind this view


Copyright © 2012. All Rights Reserved.