com.vaadin.terminal.gwt.client.ui.table
Class VScrollTable

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 com.google.gwt.user.client.ui.FlowPanel
                      extended by com.vaadin.terminal.gwt.client.ui.table.VScrollTable
All Implemented Interfaces:
com.google.gwt.event.dom.client.BlurHandler, com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.dom.client.ScrollHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, 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.InsertPanel, com.google.gwt.user.client.ui.InsertPanel.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, Focusable, ActionOwner, VHasDropHandler, Iterable<com.google.gwt.user.client.ui.Widget>
Direct Known Subclasses:
VTreeTable

public class VScrollTable
extends com.google.gwt.user.client.ui.FlowPanel
implements com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.event.dom.client.ScrollHandler, VHasDropHandler, com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.dom.client.BlurHandler, Focusable, ActionOwner

VScrollTable VScrollTable is a FlowPanel having two widgets in it: * TableHead component * ScrollPanel TableHead contains table's header and widgets + logic for resizing, reordering and hiding columns. ScrollPanel contains VScrollTableBody object which handles content. To save some bandwidth and to improve clients responsiveness with loads of data, in VScrollTableBody all rows are not necessary rendered. There are "spacers" in VScrollTableBody to use the exact same space as non-rendered rows would use. This way we can use seamlessly traditional scrollbars and scrolling to fetch more rows instead of "paging". In VScrollTable we listen to scroll events. On horizontal scrolling we also update TableHeads scroll position which has its scrollbars hidden. On vertical scroll events we will check if we are reaching the end of area where we have rows rendered and TODO implement unregistering for child components in Cells


Nested Class Summary
 class VScrollTable.FooterCell
          A cell in the footer
 class VScrollTable.HeaderCell
           
 class VScrollTable.RowHeadersFooterCell
          HeaderCell that is header cell for row headers.
 class VScrollTable.RowHeadersHeaderCell
          HeaderCell that is header cell for row headers.
static class VScrollTable.SelectMode
           
 class VScrollTable.TableFooter
          The footer of the table which can be seen in the bottom of the Table.
 class VScrollTable.TableHead
           
 class VScrollTable.VScrollTableBody
          This Panel can only contain VScrollTableRow type of widgets.
 class VScrollTable.VScrollTableDropHandler
           
 
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.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.InsertPanel
com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
 
Field Summary
static char ALIGN_CENTER
           
static char ALIGN_LEFT
           
static char ALIGN_RIGHT
           
static String ATTRIBUTE_PAGEBUFFER_FIRST
           
static String ATTRIBUTE_PAGEBUFFER_LAST
           
static String CLASSNAME
           
static String CLASSNAME_SELECTION_FOCUS
           
protected  ApplicationConnection client
           
static String COLUMN_REORDER_EVENT_ID
           
static String COLUMN_RESIZE_EVENT_ID
           
protected  com.vaadin.terminal.gwt.client.ui.table.VScrollTable.ContextMenuDetails contextMenu
           
static String FOOTER_CLICK_EVENT_ID
           
static String HEADER_CLICK_EVENT_ID
           
static String ITEM_CLICK_EVENT_ID
           
protected  String paintableId
           
protected  boolean showRowHeaders
           
protected  VScrollTable.TableHead tHead
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
VScrollTable()
           
 
Method Summary
protected  void addAndRemoveRows(UIDL partialRowAdditions)
          Inserts rows in the table body or removes them from the table body based on the commands in the UIDL.
protected  String buildCaptionHtmlSnippet(UIDL uidl)
          Helper function to build html snippet for column or row headers
protected  int calcFirstRowInViewPort()
           
 void cancelScrollingVelocityTimer()
           
protected  VScrollTable.VScrollTableBody createScrollBody()
           
 void deselectAll()
          Deselects all items
protected  void discardRowsOutsideCacheWindow()
          Updates the internal cache by unlinking rows that fall outside of the caching window.
 void focus()
          Sets focus to this widget.
 String getActionCaption(String actionKey)
           
 String getActionIcon(String actionKey)
           
 Action[] getActions()
           
 ApplicationConnection getClient()
           
 VScrollTable.VScrollTableDropHandler getDropHandler()
           
protected  VScrollTable.VScrollTableBody.VScrollTableRow getFocusedRow()
           
protected  int getNavigationDownKey()
          Get the key that moves the selection head downwards.
protected  int getNavigationEndKey()
          Get the key the moves the selection to the end of the table.
protected  int getNavigationLeftKey()
          Get the key that scrolls to the left in the table.
protected  int getNavigationPageDownKey()
          Get the key the moves the selection one page down in the table.
protected  int getNavigationPageUpKey()
          Get the key the moves the selection one page up in the table.
protected  int getNavigationRightKey()
          Get the key that scroll to the right on the table.
protected  int getNavigationSelectKey()
          Get the key that selects an item in the table.
protected  int getNavigationStartKey()
          Get the key the moves the selection to the beginning of the table.
protected  int getNavigationUpKey()
          Get the key that moves the selection head upwards.
 String getPaintableId()
           
 VScrollTable.VScrollTableBody.VScrollTableRow getRenderedRowByKey(String key)
          Get a rendered row by its key
 int getTotalRows()
           
 com.google.gwt.user.client.ui.Widget getWidgetForPaintable()
           
protected  boolean handleNavigation(int keycode, boolean ctrl, boolean shift)
          Handles the keyboard events handled by the table
 void init(ApplicationConnection client)
           
 boolean isFocusable()
          Can the Table be focused?
protected  boolean isSelectable()
           
 void lazyRevertFocusToRow(VScrollTable.VScrollTableBody.VScrollTableRow currentlyFocusedRow)
           
protected  int measureRowHeightOffset(int rowIx)
           
 void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
           
protected  void onDetach()
           
 void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
           
 void onScroll(com.google.gwt.event.dom.client.ScrollEvent event)
          This method has logic which rows needs to be requested from server when user scrolls
protected  void reOrderColumn(String columnKey, int newIndex)
           
protected  void sendSelectedRows()
          Sends the selection to the server if changed since the last update/visit.
protected  void sendSelectedRows(boolean immediately)
          Sends the selection to the server if it has been changed since the last update/visit.
 void setHeight(String height)
           
 boolean setRowFocus(VScrollTable.VScrollTableBody.VScrollTableRow row)
          Moves the selection head to a specific row
protected  void setTotalRows(int newTotalRows)
           
 void setVisible(boolean visible)
           
 void startScrollingVelocityTimer()
           
 void triggerLazyColumnAdjustment(boolean now)
           
 void updatePageLength()
          Determines the pagelength when the table height is fixed.
protected  void updateTotalRows(UIDL uidl)
           
protected  boolean willHaveScrollbars()
          Note, this method is not official api although declared as protected.
 
Methods inherited from class com.google.gwt.user.client.ui.FlowPanel
add, clear, insert, insert
 
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, adopt, adopt, 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, 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, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setWidth, 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.user.client.ui.HasWidgets
add, clear, iterator, remove
 
Methods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
add
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
 

Field Detail

CLASSNAME

public static final String CLASSNAME
See Also:
Constant Field Values

CLASSNAME_SELECTION_FOCUS

public static final String CLASSNAME_SELECTION_FOCUS
See Also:
Constant Field Values

ATTRIBUTE_PAGEBUFFER_FIRST

public static final String ATTRIBUTE_PAGEBUFFER_FIRST
See Also:
Constant Field Values

ATTRIBUTE_PAGEBUFFER_LAST

public static final String ATTRIBUTE_PAGEBUFFER_LAST
See Also:
Constant Field Values

ITEM_CLICK_EVENT_ID

public static final String ITEM_CLICK_EVENT_ID
See Also:
Constant Field Values

HEADER_CLICK_EVENT_ID

public static final String HEADER_CLICK_EVENT_ID
See Also:
Constant Field Values

FOOTER_CLICK_EVENT_ID

public static final String FOOTER_CLICK_EVENT_ID
See Also:
Constant Field Values

COLUMN_RESIZE_EVENT_ID

public static final String COLUMN_RESIZE_EVENT_ID
See Also:
Constant Field Values

COLUMN_REORDER_EVENT_ID

public static final String COLUMN_REORDER_EVENT_ID
See Also:
Constant Field Values

ALIGN_CENTER

public static final char ALIGN_CENTER
See Also:
Constant Field Values

ALIGN_LEFT

public static final char ALIGN_LEFT
See Also:
Constant Field Values

ALIGN_RIGHT

public static final char ALIGN_RIGHT
See Also:
Constant Field Values

showRowHeaders

protected boolean showRowHeaders

client

protected ApplicationConnection client

paintableId

protected String paintableId

tHead

protected final VScrollTable.TableHead tHead

contextMenu

protected com.vaadin.terminal.gwt.client.ui.table.VScrollTable.ContextMenuDetails contextMenu
Constructor Detail

VScrollTable

public VScrollTable()
Method Detail

init

public void init(ApplicationConnection client)

sendSelectedRows

protected void sendSelectedRows()
Sends the selection to the server if changed since the last update/visit.


sendSelectedRows

protected void sendSelectedRows(boolean immediately)
Sends the selection to the server if it has been changed since the last update/visit.

Parameters:
immediately - set to true to immediately send the rows

getNavigationUpKey

protected int getNavigationUpKey()
Get the key that moves the selection head upwards. By default it is the up arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationDownKey

protected int getNavigationDownKey()
Get the key that moves the selection head downwards. By default it is the down arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationLeftKey

protected int getNavigationLeftKey()
Get the key that scrolls to the left in the table. By default it is the left arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationRightKey

protected int getNavigationRightKey()
Get the key that scroll to the right on the table. By default it is the right arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationSelectKey

protected int getNavigationSelectKey()
Get the key that selects an item in the table. By default it is the space bar key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationPageUpKey

protected int getNavigationPageUpKey()
Get the key the moves the selection one page up in the table. By default this is the Page Up key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationPageDownKey

protected int getNavigationPageDownKey()
Get the key the moves the selection one page down in the table. By default this is the Page Down key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationStartKey

protected int getNavigationStartKey()
Get the key the moves the selection to the beginning of the table. By default this is the Home key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationEndKey

protected int getNavigationEndKey()
Get the key the moves the selection to the end of the table. By default this is the End key but by overriding this you can change the key to whatever you want.

Returns:

measureRowHeightOffset

protected int measureRowHeightOffset(int rowIx)

updateTotalRows

protected void updateTotalRows(UIDL uidl)

setTotalRows

protected void setTotalRows(int newTotalRows)

getTotalRows

public int getTotalRows()

createScrollBody

protected VScrollTable.VScrollTableBody createScrollBody()

getActionCaption

public String getActionCaption(String actionKey)

getActionIcon

public String getActionIcon(String actionKey)

discardRowsOutsideCacheWindow

protected void discardRowsOutsideCacheWindow()
Updates the internal cache by unlinking rows that fall outside of the caching window.


addAndRemoveRows

protected void addAndRemoveRows(UIDL partialRowAdditions)
Inserts rows in the table body or removes them from the table body based on the commands in the UIDL.

Parameters:
partialRowAdditions - the UIDL containing row updates.

isSelectable

protected boolean isSelectable()

getRenderedRowByKey

public VScrollTable.VScrollTableBody.VScrollTableRow getRenderedRowByKey(String key)
Get a rendered row by its key

Parameters:
key - The key to search with
Returns:

reOrderColumn

protected void reOrderColumn(String columnKey,
                             int newIndex)

onDetach

protected void onDetach()
Overrides:
onDetach in class com.google.gwt.user.client.ui.Widget

willHaveScrollbars

protected boolean willHaveScrollbars()
Note, this method is not official api although declared as protected. Extend at you own risk.

Returns:
true if content area will have scrollbars visible.

deselectAll

public void deselectAll()
Deselects all items


updatePageLength

public void updatePageLength()
Determines the pagelength when the table height is fixed.


setHeight

public void setHeight(String height)
Overrides:
setHeight in class com.google.gwt.user.client.ui.UIObject

setVisible

public void setVisible(boolean visible)
Specified by:
setVisible in interface com.google.gwt.user.client.ui.HasVisibility
Overrides:
setVisible in class com.google.gwt.user.client.ui.UIObject

buildCaptionHtmlSnippet

protected String buildCaptionHtmlSnippet(UIDL uidl)
Helper function to build html snippet for column or row headers

Parameters:
uidl - possibly with values caption and icon
Returns:
html snippet containing possibly an icon + caption text

onScroll

public void onScroll(com.google.gwt.event.dom.client.ScrollEvent event)
This method has logic which rows needs to be requested from server when user scrolls

Specified by:
onScroll in interface com.google.gwt.event.dom.client.ScrollHandler

calcFirstRowInViewPort

protected int calcFirstRowInViewPort()

getDropHandler

public VScrollTable.VScrollTableDropHandler getDropHandler()
Specified by:
getDropHandler in interface VHasDropHandler

getFocusedRow

protected VScrollTable.VScrollTableBody.VScrollTableRow getFocusedRow()

setRowFocus

public boolean setRowFocus(VScrollTable.VScrollTableBody.VScrollTableRow row)
Moves the selection head to a specific row

Parameters:
row - The row to where the selection head should move
Returns:
Returns true if focus was moved successfully, else false

handleNavigation

protected boolean handleNavigation(int keycode,
                                   boolean ctrl,
                                   boolean shift)
Handles the keyboard events handled by the table

Parameters:
event - The keyboard event received
Returns:
true iff the navigation event was handled

onFocus

public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
Specified by:
onFocus in interface com.google.gwt.event.dom.client.FocusHandler

onBlur

public void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
Specified by:
onBlur in interface com.google.gwt.event.dom.client.BlurHandler

isFocusable

public boolean isFocusable()
Can the Table be focused?

Returns:
True if the table can be focused, else false

focus

public void focus()
Description copied from interface: Focusable
Sets focus to this widget.

Specified by:
focus in interface Focusable

startScrollingVelocityTimer

public void startScrollingVelocityTimer()

cancelScrollingVelocityTimer

public void cancelScrollingVelocityTimer()

lazyRevertFocusToRow

public void lazyRevertFocusToRow(VScrollTable.VScrollTableBody.VScrollTableRow currentlyFocusedRow)

getActions

public Action[] getActions()
Specified by:
getActions in interface ActionOwner
Returns:
Array of IActions

getClient

public ApplicationConnection getClient()
Specified by:
getClient in interface ActionOwner

getPaintableId

public String getPaintableId()
Specified by:
getPaintableId in interface ActionOwner

triggerLazyColumnAdjustment

public void triggerLazyColumnAdjustment(boolean now)

getWidgetForPaintable

public com.google.gwt.user.client.ui.Widget getWidgetForPaintable()


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