com.vaadin.client.connectors.grid.
Class GridConnector
- java.lang.Object
-
- com.vaadin.client.ui.AbstractConnector
-
- com.vaadin.client.ui.AbstractComponentConnector
-
- com.vaadin.client.ui.AbstractFieldConnector
-
- com.vaadin.client.connectors.AbstractListingConnector
-
- com.vaadin.client.connectors.grid.GridConnector
-
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler
,StateChangeEvent.StateChangeHandler
,ComponentConnector
,HasDataSource
,DeferredWorker
,HasComponentsConnector
,HasWidget
,ServerConnector
,HasErrorIndicator
,HasRequiredIndicator
,ManagedLayout
,SimpleManagedLayout
,Connector
,Serializable
Direct Known Subclasses:
public class GridConnector extends AbstractListingConnector implements HasComponentsConnector, SimpleManagedLayout, DeferredWorker
A connector class for the typed Grid component.
Since:
8.0
Author:
Vaadin Ltd
See Also:
-
-
Field Summary
-
Fields inherited from class com.vaadin.client.ui.AbstractComponentConnector
SIGNIFICANT_MOVE_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description GridConnector()
-
Method Summary
All Methods Modifier and Type Method Description void
addColumn(ColumnConnector.CustomColumn column, String id)
Adds a column to the Grid widget.
com.google.gwt.event.shared.HandlerRegistration
addConnectorHierarchyChangeHandler(ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler handler)
Adds a handler that is called whenever the child hierarchy of this connector has been updated by the server.
protected void
detailsRefreshed(boolean detailsShown)
Method called for a row details refresh.
List<ComponentConnector>
getChildComponents()
Returns the child components for this connector.
ColumnConnector.CustomColumn
getColumn(String columnId)
Gets the column corresponding to the given string identifier.
String
getColumnId(Grid.Column<?,?> column)
Gets the string identifier of the given column in this grid.
GridState
getState()
Returns the shared state object for this connector.
TooltipInfo
getTooltipInfo(com.google.gwt.dom.client.Element element)
Gets the tooltip info for the given element.
Grid<elemental.json.JsonObject>
getWidget()
Returns the widget associated with this paintable.
boolean
hasTooltip()
Check whether there might be a tooltip for this component.
protected void
init()
Called when the connector has been initialized.
boolean
isReadOnly()
Checks if the connector is read only.
boolean
isWorkPending()
Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.
void
layout()
void
onColumnRendererChanged(ColumnConnector.CustomColumn column)
Method called by
CustomColumn
when its renderer changes.void
onStateChanged(StateChangeEvent stateChangeEvent)
Notifies the event handler that the state has changed.
void
onUnregister()
Event called when connector has been unregistered.
void
removeColumnMapping(ColumnConnector.CustomColumn column)
Removes the given column from mappings in this Connector.
protected void
sendContextClickEvent(MouseEventDetails details, com.google.gwt.dom.client.EventTarget eventTarget)
This method sends the context menu event to the server-side.
void
setChildComponents(List<ComponentConnector> children)
Sets the children for this connector.
void
setDataSource(DataSource<elemental.json.JsonObject> dataSource)
Sets the data source for this Connector.
protected void
singleDetailsOpened(int rowIndex)
Method target for when one single details has been updated and we might need to scroll it into view.
void
updateCaption(ComponentConnector connector)
Update child components caption, description and error message.
protected void
updateColumns()
Updates the widgets columns to match the map in this connector.
-
Methods inherited from class com.vaadin.client.connectors.AbstractListingConnector
getDataSource, getRowData, getRowKey, isRowSelected
-
Methods inherited from class com.vaadin.client.ui.AbstractFieldConnector
isRequiredIndicatorVisible, updateWidgetStyleNames
-
Methods inherited from class com.vaadin.client.ui.AbstractComponentConnector
createWidget, delegateCaptionHandling, flush, getIcon, getIconUri, getLayoutManager, isErrorIndicatorVisible, isRealUpdate, isRelativeHeight, isRelativeWidth, isUndefinedHeight, isUndefinedWidth, onDragSourceAttached, onDragSourceDetached, onDropTargetAttached, onDropTargetDetached, registerTouchHandlers, setWidgetEnabled, setWidgetStyleName, setWidgetStyleNameWithPrefix, shouldHandleLongTap, unregisterTouchHandlers, updateComponentSize, updateComponentSize, updateEnabledState, updateWidgetSize
-
Methods inherited from class com.vaadin.client.ui.AbstractConnector
addStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getParent, getResourceUrl, getRpcImplementations, getRpcProxy, getStateType, getTag, hasEventListener, isEnabled, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent, setTag, unregisterRpc
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.client.ComponentConnector
delegateCaptionHandling, flush, getLayoutManager, isRelativeHeight, isRelativeWidth, isUndefinedHeight, isUndefinedWidth, setWidgetEnabled
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.client.ServerConnector
addStateChangeHandler, addStateChangeHandler, doInit, fireEvent, getChildren, getConnection, getParent, getRpcImplementations, getTag, hasEventListener, isEnabled, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent, setTag, updateEnabledState
-
-
-
-
Method Detail
-
getColumnId
public String getColumnId(Grid.Column<?,?> column)
Gets the string identifier of the given column in this grid.
Parameters:
column
- the column whose id to getReturns:
the string id of the column
-
getColumn
public ColumnConnector.CustomColumn getColumn(String columnId)
Gets the column corresponding to the given string identifier.
Parameters:
columnId
- the id of the column to getReturns:
the column with the given id
-
getWidget
public Grid<elemental.json.JsonObject> getWidget()
Description copied from class:
AbstractComponentConnector
Returns the widget associated with this paintable. The widget returned by this method must not changed during the life time of the paintable.
Specified by:
getWidget
in interfaceHasWidget
Overrides:
getWidget
in classAbstractComponentConnector
Returns:
The widget associated with this paintable
-
detailsRefreshed
protected void detailsRefreshed(boolean detailsShown)
Method called for a row details refresh. Runs all callbacks if any details were shown and clears the callbacks.
Parameters:
detailsShown
- True if any details were set visible
-
singleDetailsOpened
protected void singleDetailsOpened(int rowIndex)
Method target for when one single details has been updated and we might need to scroll it into view.
Parameters:
rowIndex
- index of updated row
-
init
protected void init()
Description copied from class:
AbstractConnector
Called when the connector has been initialized. Override this method to perform initialization of the connector.
Overrides:
init
in classAbstractConnector
-
onStateChanged
public void onStateChanged(StateChangeEvent stateChangeEvent)
Description copied from interface:
StateChangeEvent.StateChangeHandler
Notifies the event handler that the state has changed.
Specified by:
onStateChanged
in interfaceStateChangeEvent.StateChangeHandler
Overrides:
onStateChanged
in classAbstractComponentConnector
Parameters:
stateChangeEvent
- the state change event with details about the change
-
setDataSource
public void setDataSource(DataSource<elemental.json.JsonObject> dataSource)
Description copied from interface:
HasDataSource
Sets the data source for this Connector.
Specified by:
setDataSource
in interfaceHasDataSource
Overrides:
setDataSource
in classAbstractListingConnector
Parameters:
dataSource
- the new data source, not null
-
addColumn
public void addColumn(ColumnConnector.CustomColumn column, String id)
Adds a column to the Grid widget. For each column a communication id stored for client to server communication.
Parameters:
column
- column to addid
- communication id
-
updateColumns
protected void updateColumns()
Updates the widgets columns to match the map in this connector.
-
removeColumnMapping
public void removeColumnMapping(ColumnConnector.CustomColumn column)
Removes the given column from mappings in this Connector.
Parameters:
column
- column to remove from the mapping
-
onColumnRendererChanged
public void onColumnRendererChanged(ColumnConnector.CustomColumn column)
Method called by
CustomColumn
when its renderer changes. This method is used to maintain hierarchical renderer wrap inTreeGrid
.Parameters:
column
- the column which now has a new rendererSince:
8.1
-
onUnregister
public void onUnregister()
Description copied from interface:
ServerConnector
Event called when connector has been unregistered.
Specified by:
onUnregister
in interfaceServerConnector
Overrides:
onUnregister
in classAbstractComponentConnector
-
isWorkPending
public boolean isWorkPending()
Description copied from interface:
DeferredWorker
Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.
Specified by:
isWorkPending
in interfaceDeferredWorker
-
layout
public void layout()
Specified by:
layout
in interfaceSimpleManagedLayout
-
updateCaption
public void updateCaption(ComponentConnector connector)
Description copied from interface:
HasComponentsConnector
Update child components caption, description and error message.
Each component is responsible for maintaining its caption, description and error message. In most cases components doesn't want to do that and those elements reside outside of the component. Because of this layouts must provide service for it's childen to show those elements for them.
Specified by:
updateCaption
in interfaceHasComponentsConnector
Parameters:
connector
- Child component for which service is requested.
-
getChildComponents
public List<ComponentConnector> getChildComponents()
Description copied from interface:
HasComponentsConnector
Returns the child components for this connector.
The children for this connector are defined as all
HasComponents
s whose parent is thisHasComponentsConnector
.Note that the method
ServerConnector.getChildren()
can return a larger list of children including both the child components and any extensions registered for the connector.Specified by:
getChildComponents
in interfaceHasComponentsConnector
Returns:
A collection of child components for this connector. An empty collection if there are no children. Never returns null.
-
setChildComponents
public void setChildComponents(List<ComponentConnector> children)
Description copied from interface:
HasComponentsConnector
Sets the children for this connector. This method should only be called by the framework to ensure that the connector hierarchy on the client side and the server side are in sync.
Note that calling this method does not call
ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler.onConnectorHierarchyChange(ConnectorHierarchyChangeEvent)
. The event method is called only when the hierarchy has been updated for all connectors.Note that this method is separate from
ServerConnector.setChildren(List)
and contains only child components. Both methods are called separately by the framework if the connector implementsHasComponentsConnector
.Specified by:
setChildComponents
in interfaceHasComponentsConnector
Parameters:
children
- The new child connectors (components only)
-
addConnectorHierarchyChangeHandler
public com.google.gwt.event.shared.HandlerRegistration addConnectorHierarchyChangeHandler(ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler handler)
Description copied from interface:
HasComponentsConnector
Adds a handler that is called whenever the child hierarchy of this connector has been updated by the server.
Specified by:
addConnectorHierarchyChangeHandler
in interfaceHasComponentsConnector
Parameters:
handler
- The handler that should be added.Returns:
A handler registration reference that can be used to unregister the handler
-
getState
public GridState getState()
Description copied from class:
AbstractConnector
Returns the shared state object for this connector. Override this method to define the shared state type for your connector.
Specified by:
getState
in interfaceComponentConnector
Specified by:
getState
in interfaceServerConnector
Overrides:
getState
in classAbstractListingConnector
Returns:
the current shared state (never null)
-
hasTooltip
public boolean hasTooltip()
Description copied from interface:
ComponentConnector
Check whether there might be a tooltip for this component. The framework will only add event listeners for automatically handling tooltips (using
ComponentConnector.getTooltipInfo(Element)
) if this method returns true.This is only done to optimize performance, so in cases where the status is not known, it's safer to return
true
so that there will be a tooltip handler even though it might not be needed in all cases.Specified by:
hasTooltip
in interfaceComponentConnector
Overrides:
hasTooltip
in classAbstractComponentConnector
Returns:
true
if some part of the component might have a tooltip, otherwisefalse
-
getTooltipInfo
public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element)
Description copied from interface:
ComponentConnector
Gets the tooltip info for the given element.
When overriding this method,
ComponentConnector.hasTooltip()
should also be overridden to returntrue
in all situations where this method might return a non-empty result.Specified by:
getTooltipInfo
in interfaceComponentConnector
Overrides:
getTooltipInfo
in classAbstractComponentConnector
Parameters:
element
- The element to lookup a tooltip forReturns:
The tooltip for the element or null if no tooltip is defined for this element.
-
sendContextClickEvent
protected void sendContextClickEvent(MouseEventDetails details, com.google.gwt.dom.client.EventTarget eventTarget)
Description copied from class:
AbstractComponentConnector
This method sends the context menu event to the server-side. Can be overridden to provide extra information through an alternative RPC interface.
Overrides:
sendContextClickEvent
in classAbstractComponentConnector
Parameters:
details
- the mouse event detailseventTarget
- the target of the event
-
isReadOnly
public boolean isReadOnly()
Description copied from class:
AbstractFieldConnector
Checks if the connector is read only.
Overrides:
isReadOnly
in classAbstractFieldConnector
Returns:
true
-
-