Package com.vaadin.client
Interface ServerConnector
-
- All Superinterfaces:
Connector
,Serializable
- All Known Subinterfaces:
ComponentConnector
,DirectionalManagedLayout
,HasChildMeasurementHintConnector
,HasComponentsConnector
,ManagedLayout
,MayScrollChildren
,ShortcutActionHandler.BeforeShortcutActionListener
,SimpleManagedLayout
- All Known Implementing Classes:
AbsoluteLayoutConnector
,AbstractColorPickerConnector
,AbstractComponentConnector
,AbstractComponentContainerConnector
,AbstractConnector
,AbstractDateFieldConnector
,AbstractExtensionConnector
,AbstractFieldConnector
,AbstractHasComponentsConnector
,AbstractLayoutConnector
,AbstractOrderedLayoutConnector
,AbstractRendererConnector
,AbstractSelectionModelConnector
,AbstractSingleComponentContainerConnector
,AbstractSplitPanelConnector
,AccordionConnector
,AudioConnector
,BrowserFrameConnector
,BrowserWindowOpenerConnector
,ButtonConnector
,ButtonRendererConnector
,CalendarConnector
,CheckBoxConnector
,ClickableRendererConnector
,ColorPickerAreaConnector
,ColorPickerConnector
,ColorPickerGradientConnector
,ColorPickerGridConnector
,ComboBoxConnector
,CssLayoutConnector
,CustomComponentConnector
,CustomFieldConnector
,CustomLayoutConnector
,DateFieldConnector
,DateRendererConnector
,DetailComponentManagerConnector
,DragAndDropWrapperConnector
,EmbeddedConnector
,FileDownloaderConnector
,FlashConnector
,FormConnector
,FormLayoutConnector
,GridConnector
,GridLayoutConnector
,HorizontalLayoutConnector
,HorizontalSplitPanelConnector
,ImageConnector
,ImageRendererConnector
,InlineDateFieldConnector
,JavaScriptComponentConnector
,JavaScriptExtension
,JavaScriptManagerConnector
,JavaScriptRendererConnector
,LabelConnector
,LegacyConnector
,LinkConnector
,ListSelectConnector
,LoginFormConnector
,MediaBaseConnector
,MenuBarConnector
,MultiSelectionModelConnector
,NativeButtonConnector
,NativeSelectConnector
,NoSelectionModelConnector
,NumberRendererConnector
,OptionGroupBaseConnector
,OptionGroupConnector
,PanelConnector
,PasswordFieldConnector
,PopupDateFieldConnector
,PopupViewConnector
,ProgressBarConnector
,ProgressBarRendererConnector
,ProgressIndicatorConnector
,ResponsiveConnector
,RichTextAreaConnector
,RpcDataSourceConnector
,SingleSelectionModelConnector
,SliderConnector
,TableConnector
,TabsheetBaseConnector
,TabsheetConnector
,TextAreaConnector
,TextFieldConnector
,TextRendererConnector
,TextualDateConnector
,TreeConnector
,TreeTableConnector
,TwinColSelectConnector
,UIConnector
,UnknownComponentConnector
,UnknownExtensionConnector
,UnsafeHtmlRendererConnector
,UploadConnector
,VerticalLayoutConnector
,VerticalSplitPanelConnector
,VideoConnector
,WindowConnector
public interface ServerConnector extends Connector
Interface implemented by all client side classes that can be communicate with the server. Classes implementing this interface are initialized by the framework when needed and have the ability to communicate with the server.- Since:
- 7.0.0
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.google.web.bindery.event.shared.HandlerRegistration
addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever any part of the state has been updated by the server.com.google.web.bindery.event.shared.HandlerRegistration
addStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever the given part of the state has been updated by the server.void
doInit(String connectorId, ApplicationConnection connection)
Called once by the framework to initialize the connector.void
fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
Sends the given event to all registered handlers.List<ServerConnector>
getChildren()
Returns the child connectors for this connector (child components and extensions).ApplicationConnection
getConnection()
Gets ApplicationConnection instance that created this connector.ServerConnector
getParent()
Returns the parent of this connector.<T extends ClientRpc>
Collection<T>getRpcImplementations(String rpcInterfaceId)
For internal use by the framework: returns the registered RPC implementations for an RPC interface identifier.SharedState
getState()
Gets the current shared state of the connector.boolean
hasEventListener(String eventIdentifier)
Checks if an event listener has been registered on the server side for the given event identifier.boolean
isEnabled()
Tests whether the connector is enabled or not.void
onUnregister()
Event called when connector has been unregistered.void
removeStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been updated by the server.void
removeStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been updated by the server.void
setChildren(List<ServerConnector> children)
Sets the children for this connector.void
setParent(ServerConnector parent)
Sets the parent for this connector.void
updateEnabledState(boolean enabledState)
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
-
-
-
Method Detail
-
getConnection
ApplicationConnection getConnection()
Gets ApplicationConnection instance that created this connector.- Returns:
- The ApplicationConnection as set by
doInit(String, ApplicationConnection)
-
isEnabled
boolean isEnabled()
Tests whether the connector is enabled or not. This method checks that the connector is enabled in context, i.e. if the parent connector is disabled, this method must return false.- Returns:
- true if the connector is enabled, false otherwise
-
doInit
void doInit(String connectorId, ApplicationConnection connection)
Called once by the framework to initialize the connector.Note that the shared state is not yet available at this point nor any hierarchy information.
-
getRpcImplementations
<T extends ClientRpc> Collection<T> getRpcImplementations(String rpcInterfaceId)
For internal use by the framework: returns the registered RPC implementations for an RPC interface identifier. TODO interface identifier type or format may change- Parameters:
rpcInterfaceId
- RPC interface identifier: fully qualified interface type name- Returns:
- RPC interface implementations registered for an RPC interface, not null
-
addStateChangeHandler
com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever any part of the state has been updated by the server.- Parameters:
handler
- The handler that should be added.- Returns:
- A handler registration reference that can be used to unregister the handler
-
removeStateChangeHandler
void removeStateChangeHandler(StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been updated by the server.- Parameters:
handler
- The handler that should be removed.
-
addStateChangeHandler
com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
Adds a handler that is called whenever the given part of the state has been updated by the server.- Parameters:
propertyName
- the name of the property for which the handler should be calledhandler
- The handler that should be added.- Returns:
- A handler registration reference that can be used to unregister the handler
-
removeStateChangeHandler
void removeStateChangeHandler(String propertyName, StateChangeEvent.StateChangeHandler handler)
Removes a handler that is called whenever any part of the state has been updated by the server.- Parameters:
propertyName
- the name of the property for which the handler should be calledhandler
- The handler that should be removed.
-
fireEvent
void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
Sends the given event to all registered handlers.- Parameters:
event
- The event to send.
-
onUnregister
void onUnregister()
Event called when connector has been unregistered.
-
getParent
ServerConnector getParent()
Returns the parent of this connector. Can be null for only the root connector.- Specified by:
getParent
in interfaceConnector
- Returns:
- The parent of this connector, as set by
setParent(ServerConnector)
.
-
setParent
void setParent(ServerConnector parent)
Sets the parent 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 fire a
ConnectorHierarchyChangeEvent
. The event is fired only when the whole hierarchy has been updated.- Parameters:
parent
- The new parent of the connector
-
updateEnabledState
void updateEnabledState(boolean enabledState)
-
setChildren
void setChildren(List<ServerConnector> children)
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 this method is separate from
HasComponentsConnector.setChildComponents(List)
and takes both extensions and child components. Both methods are called separately by the framework if the connector can have child components.- Parameters:
children
- The new child connectors (extensions and/or components)
-
getChildren
List<ServerConnector> getChildren()
Returns the child connectors for this connector (child components and extensions).Note that the method
HasComponentsConnector.getChildComponents()
can be used to obtain the subset of child connectors that correspond to components and not extensions.- Returns:
- A collection of child connectors (components or extensions) for this connector. An empty collection if there are no children. Never returns null.
-
getState
SharedState getState()
Gets the current shared state of the connector. Note that state is considered an internal part of the connector. You should not rely on the state object outside of the connector who owns it. If you depend on the state of other connectors you should use their public API instead of their state object directly.- Returns:
- state The shared state object. Can be any sub type of
SharedState
. Never null. - Since:
- 7.0.
-
hasEventListener
boolean hasEventListener(String eventIdentifier)
Checks if an event listener has been registered on the server side for the given event identifier.- Parameters:
eventIdentifier
- The identifier for the event- Returns:
- true if a listener has been registered on the server side, false otherwise
-
-