Package com.vaadin.server
Class AbstractExtension
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- All Implemented Interfaces:
MethodEventSource
,ClientConnector
,Extension
,Connector
,Serializable
- Direct Known Subclasses:
AbstractJavaScriptExtension
,BrowserWindowOpener
,FileDownloader
,Grid.AbstractGridExtension
,JavaScript
,Responsive
,RpcDataProviderExtension
public abstract class AbstractExtension extends AbstractClientConnector implements Extension
An extension is an entity that is attached to a Component or another Extension and independently communicates between client and server.Extensions can use shared state and RPC in the same way as components.
AbstractExtension adds a mechanism for adding the extension to any Connector (extend). To let the Extension determine what kind target it can be added to, the extend method is declared as protected.
- Since:
- 7.0.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
-
Constructor Summary
Constructors Constructor Description AbstractExtension()
Creates a new extension instance without extending any connector.AbstractExtension(AbstractClientConnector target)
Creates a new extension instance that extends the provided connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
extend(AbstractClientConnector target)
Add this extension to the target connector.ClientConnector
getParent()
Gets the parent connector of this connector, ornull
if the connector is not attached to any parent.protected Class<? extends ClientConnector>
getSupportedParentType()
Gets a type that the parent must be an instance of.void
remove()
Remove this extension from its target.void
setParent(ClientConnector parent)
Sets the parent connector of the connector.-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getState, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
-
-
-
Constructor Detail
-
AbstractExtension
public AbstractExtension()
Creates a new extension instance without extending any connector.
-
AbstractExtension
public AbstractExtension(AbstractClientConnector target)
Creates a new extension instance that extends the provided connector.- Parameters:
target
- the connector to extend- Since:
- 7.4
-
-
Method Detail
-
getSupportedParentType
protected Class<? extends ClientConnector> getSupportedParentType()
Gets a type that the parent must be an instance of. Override this if the extension only support certain targets, e.g. if only TextFields can be extended.- Returns:
- a type that the parent must be an instance of
-
extend
protected void extend(AbstractClientConnector target)
Add this extension to the target connector. This method is protected to allow subclasses to require a more specific type of target.- Parameters:
target
- the connector to attach this extension to
-
remove
public void remove()
Description copied from interface:Extension
Remove this extension from its target. After an extension has been removed, it cannot be attached again.
-
setParent
public void setParent(ClientConnector parent)
Description copied from interface:Extension
Sets the parent connector of the connector. This method automatically callsClientConnector.attach()
if the connector becomes attached to the session.This method is rarely called directly.
AbstractClientConnector.addExtension(Extension)
is normally used for adding extensions to a parent and it will call this method implicitly.
-
getParent
public ClientConnector getParent()
Description copied from interface:Connector
Gets the parent connector of this connector, ornull
if the connector is not attached to any parent.- Specified by:
getParent
in interfaceClientConnector
- Specified by:
getParent
in interfaceConnector
- Returns:
- the parent connector, or
null
if there is no parent.
-
-