From 05d2e2cc76cbe64cf76a2ed4b541a5f500754e69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Thu, 10 Apr 2014 14:05:03 +0300 Subject: [PATCH] Add constructor for directly extending a connector (#13579) Change-Id: Id8ba60cf8767ba171a5bcbd5541d8c0c7a9fa62d --- .../com/vaadin/server/AbstractExtension.java | 20 ++++++++++++++++++ .../server/AbstractJavaScriptExtension.java | 21 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/server/src/com/vaadin/server/AbstractExtension.java b/server/src/com/vaadin/server/AbstractExtension.java index 7148e6e84c..6395daebd1 100644 --- a/server/src/com/vaadin/server/AbstractExtension.java +++ b/server/src/com/vaadin/server/AbstractExtension.java @@ -35,6 +35,26 @@ public abstract class AbstractExtension extends AbstractClientConnector private ClientConnector parent; + /** + * Creates a new extension instance without extending any connector. + */ + public AbstractExtension() { + // Empty default constructor + } + + /** + * Creates a new extension instance that extends the provided connector. + * + * @since + * + * @param target + * the connector to extend + */ + public AbstractExtension(AbstractClientConnector target) { + this(); + extend(target); + } + /** * 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 diff --git a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java index 410eea3c01..2f2752c317 100644 --- a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java +++ b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java @@ -127,6 +127,27 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension { private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( this); + /** + * Creates a new JavasScript extension instance without extending any + * connector. + */ + public AbstractJavaScriptExtension() { + // Empty default constructor + } + + /** + * Creates a new JavaScript extension extending the provided connector. + * + * @since + * + * @param target + * the connector to extend + */ + public AbstractJavaScriptExtension(AbstractClientConnector target) { + this(); + extend(target); + } + @Override protected void registerRpc(T implementation, Class rpcInterfaceType) { -- 2.39.5