diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-11-23 11:38:20 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-11-23 11:38:20 +0200 |
commit | e78cfa7e6ca953e0ecd030cfffb760425a1293bc (patch) | |
tree | 55b2fe56e8cc6e9dbe5569be3c9597b69052ebcb | |
parent | 1647984d05c5c576c1fe343111c826f3b6c71bc3 (diff) | |
download | vaadin-framework-e78cfa7e6ca953e0ecd030cfffb760425a1293bc.tar.gz vaadin-framework-e78cfa7e6ca953e0ecd030cfffb760425a1293bc.zip |
Refactor Extension API (#10337)
Change-Id: Ib16ffceb8dce235b59848c55e59407074e7d5bda
5 files changed, 10 insertions, 11 deletions
diff --git a/server/src/com/vaadin/server/AbstractExtension.java b/server/src/com/vaadin/server/AbstractExtension.java index 747caee967..19c904163e 100644 --- a/server/src/com/vaadin/server/AbstractExtension.java +++ b/server/src/com/vaadin/server/AbstractExtension.java @@ -55,11 +55,8 @@ public abstract class AbstractExtension extends AbstractClientConnector target.addExtension(this); } - /** - * Remove this extension from its target. After an extension has been - * removed, it can not be attached again. - */ - public void removeFromTarget() { + @Override + public void remove() { getParent().removeExtension(this); } diff --git a/server/src/com/vaadin/server/Extension.java b/server/src/com/vaadin/server/Extension.java index bb7d133e8e..1bb61ab96e 100644 --- a/server/src/com/vaadin/server/Extension.java +++ b/server/src/com/vaadin/server/Extension.java @@ -29,8 +29,10 @@ package com.vaadin.server; * @since 7.0.0 */ public interface Extension extends ClientConnector { - /* - * Currently just an empty marker interface to distinguish between - * extensions and other connectors, e.g. components + + /** + * Remove this extension from its target. After an extension has been + * removed, it cannot be attached again. */ + void remove(); } diff --git a/server/src/com/vaadin/ui/JavaScript.java b/server/src/com/vaadin/ui/JavaScript.java index 3782ead85a..02707a3ccd 100644 --- a/server/src/com/vaadin/ui/JavaScript.java +++ b/server/src/com/vaadin/ui/JavaScript.java @@ -157,7 +157,7 @@ public class JavaScript extends AbstractExtension { * when invoked */ @Override - public void removeFromTarget() { + public void remove() { throw new UnsupportedOperationException( "JavaScript is not designed to be removed."); } diff --git a/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java index 55d2afd32d..6e0616b115 100644 --- a/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java +++ b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java @@ -130,7 +130,7 @@ public class FileDownloaderTest extends AbstractTestUI { public void buttonClick(ClickEvent event) { FileDownloader e = (FileDownloader) firstDownloadComponent .getExtensions().iterator().next(); - e.removeFromTarget(); + e.remove(); log.log("FileDownload detached"); } })); diff --git a/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.java b/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.java index ca53427e91..427c71b381 100644 --- a/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.java +++ b/uitest/src/com/vaadin/tests/extensions/BasicExtensionTest.java @@ -38,7 +38,7 @@ public class BasicExtensionTest extends AbstractTestUI { addComponent(new Button("Remove root extension", new ClickListener() { @Override public void buttonClick(ClickEvent event) { - rootExtension.removeFromTarget(); + rootExtension.remove(); } })); } |