--- /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="" />
+<title>FooterClick</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">FooterClick</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/vaadin_6.4/run/com.vaadin.tests.components.table.FooterClick?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>41,7</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyValue</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+ <td>col1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+ <td>69,12</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyValue</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+ <td>col2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>19,3</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyValue</td>
+ <td>vaadin=vaadin64runcomvaadintestscomponentstableFooterClick::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+ <td>col3</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Table.FooterClickEvent;
+
+@SuppressWarnings("serial")
+public class FooterClick extends TestBase {
+
+ private final String COLUMN1_PROPERTY_ID = "col1";
+ private final String COLUMN2_PROPERTY_ID = "col2";
+ private final String COLUMN3_PROPERTY_ID = "col3";
+
+ @Override
+ protected void setup() {
+ final Table table = new Table();
+ table.setContainerDataSource(createContainer());
+ table.setWidth("400px");
+ table.setHeight("400px");
+ table.setImmediate(true);
+ table.setFooterVisible(true);
+
+ table.setColumnFooter(COLUMN1_PROPERTY_ID, "fuu");
+ table.setColumnFooter(COLUMN2_PROPERTY_ID, "bar");
+ table.setColumnFooter(COLUMN3_PROPERTY_ID, "fuubar");
+
+ final TextField columnField = new TextField(
+ "ProperyId of clicked column");
+
+ // Set the footer click handler
+ table.setFooterClickHandler(new Table.FooterClickHandler() {
+ public void handleFooterClick(FooterClickEvent event) {
+ columnField.setValue(event.getPropertyId());
+ }
+ });
+
+ addComponent(table);
+ addComponent(columnField);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests the footer click handler";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4516;
+ }
+
+ private Container createContainer() {
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty(COLUMN1_PROPERTY_ID, String.class, "");
+ container.addContainerProperty(COLUMN2_PROPERTY_ID, String.class, "");
+ container.addContainerProperty(COLUMN3_PROPERTY_ID, String.class, "");
+
+ for (int i = 0; i < 100; i++) {
+ Item item = container.addItem("item " + i);
+ item.getItemProperty(COLUMN1_PROPERTY_ID).setValue("first" + i);
+ item.getItemProperty(COLUMN2_PROPERTY_ID).setValue("middle" + i);
+ item.getItemProperty(COLUMN3_PROPERTY_ID).setValue("last" + i);
+ }
+
+ return container;
+ }
+
+}
--- /dev/null
+package com.vaadin.tests.server.component.table;
+
+import junit.framework.TestCase;
+
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.FooterClickEvent;
+import com.vaadin.ui.Table.FooterClickHandler;
+
+/**
+ * Tests the footer click handler
+ */
+public class TestFooterClickHandlers extends TestCase {
+
+ /**
+ * Tests setting the click handler
+ */
+ public void testAddingClickHandler() {
+ final Table table = new Table();
+
+ // Create click handler
+ FooterClickHandler handler = new FooterClickHandler() {
+ public void handleFooterClick(FooterClickEvent event) {
+ }
+ };
+
+ // No predefined footer click listeners should be present
+ assertNull(table.getFooterClickHandler());
+
+ // Set the click handler
+ table.setFooterClickHandler(handler);
+ assertEquals(handler, table.getFooterClickHandler());
+ }
+
+ /**
+ * Tests changing the click handler to another one
+ */
+ public void testChangingClickHandler() {
+ final Table table = new Table();
+
+ // Create 2 click handlers
+ FooterClickHandler handler1 = new FooterClickHandler() {
+ public void handleFooterClick(FooterClickEvent event) {
+ }
+ };
+
+ FooterClickHandler handler2 = new FooterClickHandler() {
+ public void handleFooterClick(FooterClickEvent event) {
+ }
+ };
+
+ // Set the click handler
+ table.setFooterClickHandler(handler1);
+ assertEquals(handler1, table.getFooterClickHandler());
+
+ // Change the click handler to another one
+ table.setFooterClickHandler(handler2);
+ assertEquals(handler2, table.getFooterClickHandler());
+ }
+
+ /**
+ * Tests if click handler is removed
+ */
+ public void testRemovingClickHandler() {
+ final Table table = new Table();
+
+ // Create click handler
+ FooterClickHandler handler = new FooterClickHandler() {
+ public void handleFooterClick(FooterClickEvent event) {
+ }
+ };
+
+ // No predefined footer click listeners should be present
+ assertNull(table.getFooterClickHandler());
+
+ // Set the click handler
+ table.setFooterClickHandler(handler);
+ assertEquals(handler, table.getFooterClickHandler());
+
+ // Remove the click handler
+ table.setFooterClickHandler(null);
+ assertNull(table.getFooterClickHandler());
+ }
+}