--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.FileDownloaderTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::PID_Scom.vaadin.ui.ButtonDynamicimage/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::PID_Scom.vaadin.ui.ButtonDynamicimage/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
import com.vaadin.tests.components.embedded.EmbeddedPdf;
+import com.vaadin.tests.util.Log;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
import com.vaadin.ui.NativeButton;
public class FileDownloaderTest extends AbstractTestUI {
+ private AbstractComponent firstDownloadComponent;
+ private Log log = new Log(5);
+
@Override
protected void setup(VaadinRequest request) {
+ addComponent(log);
+
List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>();
components.add(Button.class);
components.add(NativeButton.class);
// addComponents(resource, components);
resource = new ClassResource(new EmbeddedPdf().getClass(), "test.pdf");
addComponents("Class resource pdf", resource, components);
+
+ addComponent(new Button("Remove first download button",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Layout parent = (Layout) firstDownloadComponent
+ .getParent();
+ parent.removeComponent(firstDownloadComponent);
+ }
+ }));
+ addComponent(new Button(
+ "Detach FileDownloader from first download button",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ FileDownloader e = (FileDownloader) firstDownloadComponent
+ .getExtensions().iterator().next();
+ e.removeFromTarget();
+ log.log("FileDownload detached");
+ }
+ }));
}
public void addComponents(String caption, ConnectorResource resource,
for (Class<? extends Component> cls : components) {
try {
AbstractComponent c = (AbstractComponent) cls.newInstance();
- c.setId(cls.getName());
+ if (firstDownloadComponent == null) {
+ firstDownloadComponent = c;
+ }
+
+ c.setId(cls.getName() + caption.replace(" ", ""));
c.setCaption(cls.getName());
c.setDescription(resource.getMIMEType() + " / "
+ resource.getClass());