aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-04-10 14:05:03 +0300
committerVaadin Code Review <review@vaadin.com>2014-11-17 11:09:03 +0000
commit05d2e2cc76cbe64cf76a2ed4b541a5f500754e69 (patch)
treeab68369303f45ae8aff810c1b66e2417f7c421b7
parent1d12fc07677debcac711586b5a57c2f397f3ec1f (diff)
downloadvaadin-framework-05d2e2cc76cbe64cf76a2ed4b541a5f500754e69.tar.gz
vaadin-framework-05d2e2cc76cbe64cf76a2ed4b541a5f500754e69.zip
Add constructor for directly extending a connector (#13579)
Change-Id: Id8ba60cf8767ba171a5bcbd5541d8c0c7a9fa62d
-rw-r--r--server/src/com/vaadin/server/AbstractExtension.java20
-rw-r--r--server/src/com/vaadin/server/AbstractJavaScriptExtension.java21
2 files changed, 41 insertions, 0 deletions
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
@@ -36,6 +36,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
* extended.
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 <T extends ServerRpc> void registerRpc(T implementation,
Class<T> rpcInterfaceType) {