com.vaadin.terminal.gwt.client.ui.
Class VScrollTable
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
com.google.gwt.user.client.ui.FlowPanel
com.vaadin.terminal.gwt.client.ui.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.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, Paintable, ActionOwner, VHasDropHandler, Table, Iterable<com.google.gwt.user.client.ui.Widget>
Direct Known Subclasses:
- extends com.google.gwt.user.client.ui.FlowPanel
- implements Table, com.google.gwt.event.dom.client.ScrollHandler, VHasDropHandler, com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.dom.client.BlurHandler, Focusable, ActionOwner
public class VScrollTable
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. |
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_KEY_MAPPER_RESET
Tell the client that old keys are no longer valid because the server has cleared its key map. |
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
|
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 |
Fields inherited from interface com.vaadin.terminal.gwt.client.ui.Table |
---|
SELECT_MODE_MULTI, SELECT_MODE_NONE, SELECT_MODE_SINGLE |
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 |
getHierarchyColumnIndex()
This method exists for the needs of VTreeTable only. |
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()
|
protected VScrollTable.VScrollTableBody.VScrollTableRow |
getRenderedRowByKey(String key)
Get a rendered row by its key |
protected int |
getTotalRows()
|
protected boolean |
handleNavigation(int keycode,
boolean ctrl,
boolean shift)
Handles the keyboard events handled by the table |
boolean |
isFocusable()
Can the Table be focused? |
protected boolean |
isSelectable()
|
void |
lazyRevertFocusToRow(VScrollTable.VScrollTableBody.VScrollTableRow currentlyFocusedRow)
|
protected int |
measureRowHeightOffset(int rowIx)
|
protected void |
onAttach()
|
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. |
protected void |
setColWidth(int colIndex,
int w,
boolean isDefinedWidth)
Note: not part of the official API, extend at your own risk. |
void |
setHeight(String height)
|
protected boolean |
setRowFocus(VScrollTable.VScrollTableBody.VScrollTableRow row)
Moves the selection head to a specific row |
protected void |
setTotalRows(int newTotalRows)
|
void |
setVisible(boolean visible)
|
void |
setWidth(String width)
|
void |
startScrollingVelocityTimer()
|
protected void |
triggerLazyColumnAdjustment(boolean now)
|
void |
updateFromUIDL(UIDL uidl,
ApplicationConnection client)
|
void |
updatePageLength()
Determines the pagelength when the table height is fixed. |
protected void |
updateTotalRows(UIDL uidl)
|
protected boolean |
willHaveScrollbars()
Note: this method is not part of 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, 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, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, 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.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 |
---|
getWidget, getWidgetCount, getWidgetIndex, remove |
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 |
---|
ATTRIBUTE_PAGEBUFFER_FIRST
public static final String ATTRIBUTE_PAGEBUFFER_FIRST
See Also:
ATTRIBUTE_PAGEBUFFER_LAST
public static final String ATTRIBUTE_PAGEBUFFER_LAST
See Also:
ATTRIBUTE_KEY_MAPPER_RESET
public static final String ATTRIBUTE_KEY_MAPPER_RESET
- See Also:
- Constant Field Values
Tell the client that old keys are no longer valid because the server has cleared its key map.
CLASSNAME
public static final String CLASSNAME
See Also:
CLASSNAME_SELECTION_FOCUS
public static final String CLASSNAME_SELECTION_FOCUS
See Also:
ITEM_CLICK_EVENT_ID
public static final String ITEM_CLICK_EVENT_ID
See Also:
HEADER_CLICK_EVENT_ID
public static final String HEADER_CLICK_EVENT_ID
See Also:
FOOTER_CLICK_EVENT_ID
public static final String FOOTER_CLICK_EVENT_ID
See Also:
COLUMN_RESIZE_EVENT_ID
public static final String COLUMN_RESIZE_EVENT_ID
See Also:
COLUMN_REORDER_EVENT_ID
public static final String COLUMN_REORDER_EVENT_ID
See Also:
ALIGN_CENTER
public static final char ALIGN_CENTER
See Also:
ALIGN_LEFT
public static final char ALIGN_LEFT
See Also:
ALIGN_RIGHT
public static final char ALIGN_RIGHT
See Also:
showRowHeaders
protected boolean showRowHeaders
client
protected ApplicationConnection client
paintableId
protected String paintableId
tHead
protected final VScrollTable.TableHead tHead
Constructor Detail |
---|
VScrollTable
public VScrollTable()
Method Detail |
---|
sendSelectedRows
protected void sendSelectedRows()
Sends the selection to the server if changed since the last update/visit.
sendSelectedRows
protected void sendSelectedRows(boolean immediately)
- Parameters:
immediately
- set to true to immediately send the rows
Sends the selection to the server if it has been changed since the last update/visit.
getNavigationUpKey
protected int getNavigationUpKey()
- Returns:
- The keycode of the key
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.
getNavigationDownKey
protected int getNavigationDownKey()
- Returns:
- The keycode of the key
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.
getNavigationLeftKey
protected int getNavigationLeftKey()
- Returns:
- The keycode of the key
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.
getNavigationRightKey
protected int getNavigationRightKey()
- Returns:
- The keycode of the key
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.
getNavigationSelectKey
protected int getNavigationSelectKey()
- Returns:
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.
getNavigationPageUpKey
protected int getNavigationPageUpKey()
- Returns:
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.
getNavigationPageDownKey
protected int getNavigationPageDownKey()
- Returns:
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.
getNavigationStartKey
protected int getNavigationStartKey()
- Returns:
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.
getNavigationEndKey
protected int getNavigationEndKey()
- Returns:
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.
updateFromUIDL
public void updateFromUIDL(UIDL uidl,
ApplicationConnection client)
- Specified by:
updateFromUIDL
in interfacePaintable
measureRowHeightOffset
protected int measureRowHeightOffset(int rowIx)
updateTotalRows
protected void updateTotalRows(UIDL uidl)
setTotalRows
protected void setTotalRows(int newTotalRows)
getTotalRows
protected int getTotalRows()
getHierarchyColumnIndex
protected int getHierarchyColumnIndex()
- Returns:
- index of TreeTable's hierarchy column, or -1 if not applicable
This method exists for the needs of VTreeTable
only. Not part of
the official API, extend at your own risk.
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)
- Parameters:
partialRowAdditions
- the UIDL containing row updates.
Inserts rows in the table body or removes them from the table body based on the commands in the UIDL.
isSelectable
protected boolean isSelectable()
setColWidth
protected void setColWidth(int colIndex,
int w,
boolean isDefinedWidth)
- Parameters:
colIndex
- index of the modified columnw
- new width (may be subject to modifications if doesn't meet minimum requirements)isDefinedWidth
- disables expand ratio if set true
Note: not part of the official API, extend at your own risk. Sets the indicated column's width for headers and scrollBody alike.
getRenderedRowByKey
protected VScrollTable.VScrollTableBody.VScrollTableRow getRenderedRowByKey(String key)
- Parameters:
key
- The key to search with- Returns:
Get a rendered row by its key
reOrderColumn
protected void reOrderColumn(String columnKey,
int newIndex)
onAttach
protected void onAttach()
- Overrides:
onAttach
in classcom.google.gwt.user.client.ui.Widget
onDetach
protected void onDetach()
- Overrides:
onDetach
in classcom.google.gwt.user.client.ui.Widget
willHaveScrollbars
protected boolean willHaveScrollbars()
- Returns:
- true if content area will have scrollbars visible.
Note: this method is not part of official API although declared as protected. Extend at your own risk.
deselectAll
public void deselectAll()
Deselects all items
updatePageLength
public void updatePageLength()
Determines the pagelength when the table height is fixed.
setWidth
public void setWidth(String width)
- Overrides:
setWidth
in classcom.google.gwt.user.client.ui.UIObject
setHeight
public void setHeight(String height)
- Overrides:
setHeight
in classcom.google.gwt.user.client.ui.UIObject
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisible
in classcom.google.gwt.user.client.ui.UIObject
buildCaptionHtmlSnippet
protected String buildCaptionHtmlSnippet(UIDL uidl)
- Parameters:
uidl
- possibly with values caption and icon- Returns:
- html snippet containing possibly an icon + caption text
Helper function to build html snippet for column or row headers
onScroll
public void onScroll(com.google.gwt.event.dom.client.ScrollEvent event)
- Specified by:
onScroll
in interfacecom.google.gwt.event.dom.client.ScrollHandler
This method has logic which rows needs to be requested from server when user scrolls
calcFirstRowInViewPort
protected int calcFirstRowInViewPort()
getDropHandler
public VScrollTable.VScrollTableDropHandler getDropHandler()
- Specified by:
getDropHandler
in interfaceVHasDropHandler
getFocusedRow
protected VScrollTable.VScrollTableBody.VScrollTableRow getFocusedRow()
setRowFocus
protected boolean setRowFocus(VScrollTable.VScrollTableBody.VScrollTableRow row)
- Parameters:
row
- The row to where the selection head should move- Returns:
- Returns true if focus was moved successfully, else false
Moves the selection head to a specific row
handleNavigation
protected boolean handleNavigation(int keycode,
boolean ctrl,
boolean shift)
- Parameters:
event
- The keyboard event received- Returns:
- true iff the navigation event was handled
Handles the keyboard events handled by the table
onFocus
public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
- Specified by:
onFocus
in interfacecom.google.gwt.event.dom.client.FocusHandler
onBlur
public void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
- Specified by:
onBlur
in interfacecom.google.gwt.event.dom.client.BlurHandler
isFocusable
public boolean isFocusable()
- Returns:
- True if the table can be focused, else false
Can the Table be focused?
focus
public void focus()
Description copied from interface: Focusable
Sets focus to this widget.
startScrollingVelocityTimer
public void startScrollingVelocityTimer()
cancelScrollingVelocityTimer
public void cancelScrollingVelocityTimer()
lazyRevertFocusToRow
public void lazyRevertFocusToRow(VScrollTable.VScrollTableBody.VScrollTableRow currentlyFocusedRow)
getActions
public Action[] getActions()
- Specified by:
getActions
in interfaceActionOwner
- Returns:
- Array of IActions
getClient
public ApplicationConnection getClient()
- Specified by:
getClient
in interfaceActionOwner
getPaintableId
public String getPaintableId()
- Specified by:
getPaintableId
in interfaceActionOwner
triggerLazyColumnAdjustment
protected void triggerLazyColumnAdjustment(boolean now)