* Maps the category name to a menu item\r
*/\r
private Map<String, MenuItem> categoryToMenuItem = new HashMap<String, MenuItem>();\r
+ private Map<MenuItem, String> menuItemToCategory = new HashMap<MenuItem, String>();\r
\r
// Logging\r
private Log log;\r
}\r
\r
/**\r
- * Creates category "category" in parent category "parentCategory". Each\r
- * category name must be globally unique.\r
+ * Creates category named "category" with id "categoryId" in parent category\r
+ * "parentCategory". Each categoryId must be globally unique.\r
* \r
* @param category\r
+ * @param categoryId\r
* @param parentCategory\r
* @return\r
*/\r
protected MenuItem createCategory(String category, String parentCategory) {\r
- if (categoryToMenuItem.containsKey(category)) {\r
+ if (hasCategory(category)) {\r
return categoryToMenuItem.get(category);\r
}\r
MenuItem item;\r
item = getCategoryMenuItem(parentCategory).addItem(category, null);\r
}\r
categoryToMenuItem.put(category, item);\r
+ menuItemToCategory.put(item, category);\r
return item;\r
}\r
\r
+ protected boolean hasCategory(String categoryId) {\r
+ return categoryToMenuItem.containsKey(categoryId);\r
+ }\r
+\r
+ protected void removeCategory(String categoryId) {\r
+ if (!hasCategory(categoryId)) {\r
+ throw new IllegalArgumentException("Category '" + categoryId\r
+ + "' does not exist");\r
+ }\r
+\r
+ MenuItem item = getCategoryMenuItem(categoryId);\r
+ Object[] children = item.getChildren().toArray();\r
+ for (Object child : children) {\r
+ if (menuItemToCategory.containsKey(child)) {\r
+ removeCategory(menuItemToCategory.get(child));\r
+ }\r
+ }\r
+ // Detach from parent\r
+ item.getParent().removeChild(item);\r
+ // Clean mappings\r
+ categoryToMenuItem.remove(categoryId);\r
+ menuItemToCategory.remove(item);\r
+\r
+ }\r
+\r
private MenuBar.Command menuBooleanCommand(\r
final com.vaadin.tests.components.ComponentTestCase.Command<T, Boolean> booleanCommand,\r
final Object data) {\r
public abstract class AbstractComponentTestCase<T extends AbstractComponent>
extends TestBase {
+ protected static final ThemeResource ICON_16_HELP_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/help.png");
+ protected static final ThemeResource ICON_16_FOLDER_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/folder.png");
+ protected static final ThemeResource ICON_16_ERROR_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/error.png");
protected static final ThemeResource ICON_16_USER_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/user.png");
protected static final ThemeResource ICON_16_USER_PNG_UNCACHEABLE = uncacheableThemeResource("../runo/icons/16/user.png");
protected static final ThemeResource ICON_32_ATTENTION_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/32/attention.png");
--- /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>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.table.Tables?restartApplication</td>
+ <td></td>
+</tr>
+<!--Add some footers as it should be aligned aswell-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>22,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item7</td>
+ <td>37,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>85,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>73,6</td>
+</tr>
+<!--Align 1r,2c,3l,4r,5c-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>23,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>53,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>61,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>41,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>46,0</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>24,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>41,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>24,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>51,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>32,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>34,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>42,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>37,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>50,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>15,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>13,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>42,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>42,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>32,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>36,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>48,21</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>46,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>35,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>43,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>24,11</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>aligned-1r-2c-3l-4r-5c</td>
+</tr>
+<!--Align column back to left-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>35,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>37,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>50,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>60,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>38,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>39,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>56,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>44,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>53,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>30,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>49,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>44,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>44,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>36,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>54,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>32,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>33,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>53,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>48,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>28,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>29,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>34,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>36,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>34,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>31,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>aligned-all-left</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /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>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.table.Tables?restartApplication</td>
+ <td></td>
+</tr>
+<!--3 properties-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>63,19</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item5</td>
+ <td>54,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>43,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item3</td>
+ <td>17,3</td>
+</tr>
+<!--Property 1 -> "A nice column"-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>51,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>39,2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>51,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item5</td>
+ <td>52,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>46,2</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>A nice column</td>
+</tr>
+<!--Property 2 -> "A"-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>54,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>58,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>46,0</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item5</td>
+ <td>22,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>31,11</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td>
+ <td>A</td>
+</tr>
+<!--Header mode -> id-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>24,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>51,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>50,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>72,11</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>Property 1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td>
+ <td>Property 2</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[2]</td>
+ <td>Property 3</td>
+</tr>
+<!--Header mode -> Explicit-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>22,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>43,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>34,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>48,12</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>A nice column</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td>
+ <td>A</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[2]</td>
+ <td></td>
+</tr>
+<!--Header mode hidden-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>49,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>44,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>72,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item3</td>
+ <td>40,10</td>
+</tr>
+<tr>
+ <td>assertNotVisible</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]</td>
+ <td>A nice column<br /><br /><br />A<br /><br /><br />Property 3</td>
+</tr>
+<!--explicit defaults id-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>39,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item6</td>
+ <td>39,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>51,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>73,11</td>
+</tr>
+<tr>
+ <td>assertVisible</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]</td>
+ <td>A nice column<br /><br /><br />A<br /><br /><br />Property 3</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+ <td>A nice column</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td>
+ <td>A</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[2]</td>
+ <td>Property 3</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /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>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.table.Tables?restartApplication</td>
+ <td></td>
+</tr>
+<!--Add icons to property 1,5,10-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>19,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>31,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>48,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>45,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>38,14</td>
+</tr>
+<!--ensure icon is there-->
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>2,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>24,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>49,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>29,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item3</td>
+ <td>51,7</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[2]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>20,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>45,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item9</td>
+ <td>36,2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>46,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item4</td>
+ <td>72,10</td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]/domChild[2]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>icons-on-properties-1-5-10</td>
+</tr>
+<!--Remove icons from 1 and 10-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>21,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>42,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>17,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>52,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>27,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>45,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>53,2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item9</td>
+ <td>45,1</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item4</td>
+ <td>41,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>13,5</td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]/domChild[2]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>icon-on-5</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /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>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.table.Tables?restartApplication</td>
+ <td></td>
+</tr>
+<!--Hide log to allow screenshots to be consistent-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item1</td>
+ <td>23,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>58,13</td>
+</tr>
+<!--width 700px-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>44,2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item2</td>
+ <td>41,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>36,4</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item8</td>
+ <td>53,17</td>
+</tr>
+<!--2 properties-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>31,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item5</td>
+ <td>36,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>86,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>22,7</td>
+</tr>
+<!--add 100% wide button-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>27,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+ <td>37,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>77,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>45,10</td>
+</tr>
+<!--Ensure button is resized with column-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>1,11</td>
+</tr>
+<tr>
+ <td>dragAndDrop</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]</td>
+ <td>-100,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>button-100%-after-column-resize</td>
+</tr>
+<!--Add undefined wide label-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>45,21</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item8</td>
+ <td>30,2</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item4</td>
+ <td>109,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item3</td>
+ <td>71,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>button-and-label</td>
+</tr>
+<!--Reload to relayout (this shouldn't be necessary)-->
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.Tables</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>button-and-label-after-reload</td>
+</tr>
+<!--Align generated button right (should not make a difference)-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>17,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>48,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>39,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>53,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>16,6</td>
+</tr>
+<!--Align generated label right (should make a difference)-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item0</td>
+ <td>17,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item9</td>
+ <td>48,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>39,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+ <td>53,13</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>16,6</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>label-aligned-right</td>
+</tr>
+<!--Resize right aligned column with undef wide Label-->
+<tr>
+ <td>dragAndDrop</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+ <td>-20,0</td>
+</tr>
+<tr>
+ <td>dragAndDrop</td>
+ <td>vaadin=runcomvaadintestscomponentstableTables::PID_StestComponent/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+ <td>20,0</td>
+</tr>
+<!--Should match after resizing back and forth-->
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>label-aligned-right</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
import com.vaadin.event.Action;\r
import com.vaadin.event.Action.Handler;\r
import com.vaadin.event.ItemClickEvent.ItemClickListener;\r
+import com.vaadin.terminal.Resource;\r
import com.vaadin.tests.components.select.AbstractSelectTestCase;\r
import com.vaadin.ui.AbstractSelect.MultiSelectMode;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Component;\r
+import com.vaadin.ui.Label;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.Table.ColumnGenerator;\r
import com.vaadin.ui.Table.ColumnResizeEvent;\r
import com.vaadin.ui.Table.ColumnResizeListener;\r
import com.vaadin.ui.Table.FooterClickEvent;\r
protected static final String CATEGORY_ROWS = "Rows";\r
private static final String CATEGORY_HEADER = "Header";\r
private static final String CATEGORY_FOOTER = "Footer";\r
- private static final String CATEGORY_VISIBLE_COLUMNS = "Visible columns";\r
+ private static final String CATEGORY_COLUMNS = "Columns";\r
\r
@Override\r
protected Class<T> getTestClass() {\r
}\r
\r
/* COMMANDS */\r
- private Command<T, Boolean> visibleColumnCommand = new Command<T, Boolean>() {\r
+ private Command<T, String> columnAlignmentCommand = new Command<T, String>() {\r
+\r
+ public void execute(T c, String alignment, Object propertyId) {\r
+ c.setColumnAlignment(propertyId, alignment);\r
+ }\r
+\r
+ };\r
+\r
+ private Command<T, Boolean> columnVisibleCommand = new Command<T, Boolean>() {\r
public void execute(Table c, Boolean visible, Object propertyId) {\r
List<Object> visibleColumns = new ArrayList<Object>(Arrays.asList(c\r
.getVisibleColumns()));\r
}\r
};\r
\r
+ private Command<T, Boolean> columnCollapsed = new Command<T, Boolean>() {\r
+\r
+ public void execute(T c, Boolean collapsed, Object propertyId) {\r
+ c.setColumnCollapsed(propertyId, collapsed);\r
+\r
+ }\r
+ };\r
+\r
protected Command<T, Boolean> columnResizeListenerCommand = new Command<T, Boolean>() {\r
\r
public void execute(Table c, Boolean value, Object data) {\r
}\r
};\r
\r
- public class Alignments {\r
-\r
- }\r
+ protected Command<T, Object> alignColumnLeftCommand = new Command<T, Object>() {\r
\r
- protected Command<T, Alignments> columnAlignmentCommand = new Command<T, Alignments>() {\r
-\r
- public void execute(T c, Alignments value, Object data) {\r
- // TODO\r
- // for (Object propertyId : c.getContainerPropertyIds()) {\r
- // }\r
+ public void execute(T c, Object propertyId, Object data) {\r
+ c.setColumnAlignment(propertyId, (String) data);\r
}\r
};\r
\r
}\r
}\r
};\r
+ private Command<T, Integer> columnWidthCommand = new Command<T, Integer>() {\r
+\r
+ public void execute(T c, Integer width, Object propertyId) {\r
+ c.setColumnWidth(propertyId, width);\r
+\r
+ }\r
+ };\r
+\r
+ private Command<T, Resource> columnIconCommand = new Command<T, Resource>() {\r
+\r
+ public void execute(T c, Resource icon, Object propertyId) {\r
+ c.setColumnIcon(propertyId, icon);\r
+\r
+ }\r
+ };\r
+ private Command<T, Integer> columnHeaderModeCommand = new Command<T, Integer>() {\r
+\r
+ public void execute(T c, Integer columnHeaderMode, Object data) {\r
+ c.setColumnHeaderMode(columnHeaderMode);\r
+\r
+ }\r
+ };\r
+ private Command<T, String> columnHeaderCommand = new Command<T, String>() {\r
+\r
+ public void execute(T c, String header, Object propertyId) {\r
+ c.setColumnHeader(propertyId, header);\r
+\r
+ }\r
+ };\r
+ private Command<T, Float> columnExpandRatioCommand = new Command<T, Float>() {\r
+\r
+ public void execute(T c, Float expandRatio, Object propertyId) {\r
+ c.setColumnExpandRatio(propertyId, expandRatio);\r
+ }\r
+ };\r
+\r
+ private class GeneratedColumn {\r
+ private Class<? extends Component> type;\r
+ private String width;\r
+\r
+ public GeneratedColumn(Class<? extends Component> type, String width) {\r
+ super();\r
+ this.type = type;\r
+ this.width = width;\r
+ }\r
+ }\r
+\r
+ String generatedColumnId = "Generated ";\r
+ int generatedColumnNextNr = 1;\r
+\r
+ private Command<T, GeneratedColumn> addGeneratedColumnCommand = new Command<T, GeneratedColumn>() {\r
+\r
+ public void execute(T c, final GeneratedColumn col, Object data) {\r
+ while (c.getColumnGenerator(generatedColumnId\r
+ + generatedColumnNextNr) != null) {\r
+ generatedColumnNextNr++;\r
+ }\r
+\r
+ c.addGeneratedColumn(generatedColumnId + generatedColumnNextNr,\r
+ new ColumnGenerator() {\r
+\r
+ public Component generateCell(Table source,\r
+ Object itemId, Object columnId) {\r
+ if (col.type == Button.class) {\r
+ Button b = new Button();\r
+ b.setCaption(itemId + "/" + columnId);\r
+ b.setWidth(col.width);\r
+ return b;\r
+ } else if (col.type == Label.class) {\r
+ Label l = new Label();\r
+ l.setValue(itemId + "/" + columnId);\r
+ l.setWidth(col.width);\r
+ return l;\r
+ }\r
+\r
+ return null;\r
+ }\r
+ });\r
+ generatedColumnNextNr++;\r
+ createColumnOptions(false);\r
+\r
+ }\r
+ };\r
+ private Command<T, Object> removeGeneratedColumnsCommand = new Command<T, Object>() {\r
+\r
+ public void execute(T c, Object value, Object data) {\r
+ for (int i = 0; i < generatedColumnNextNr; i++) {\r
+ String columnId = generatedColumnId + i;\r
+ if (c.getColumnGenerator(columnId) != null) {\r
+ c.removeGeneratedColumn(columnId);\r
+ }\r
+\r
+ }\r
+ createColumnOptions(false);\r
+\r
+ }\r
+ };\r
+ private Command<T, Boolean> setSortEnabledCommand = new Command<T, Boolean>() {\r
+\r
+ public void execute(T c, Boolean value, Object data) {\r
+ c.setSortDisabled(!value);\r
+\r
+ }\r
+ };\r
\r
/* COMMANDS END */\r
\r
createColumnReorderingAllowedCheckbox(CATEGORY_FEATURES);\r
createColumnCollapsingAllowedCheckbox(CATEGORY_FEATURES);\r
\r
- createVisibleColumnsMultiToggle(CATEGORY_VISIBLE_COLUMNS);\r
createContextMenuAction(CATEGORY_FEATURES);\r
\r
+ createColumnHeaderMode(CATEGORY_FEATURES);\r
+ createAddGeneratedColumnAction(CATEGORY_FEATURES);\r
+\r
+ createBooleanAction("Sort enabled", CATEGORY_FEATURES, true,\r
+ setSortEnabledCommand);\r
+ createColumnOptions(true);\r
+ }\r
+\r
+ private void createAddGeneratedColumnAction(String categoryFeatures) {\r
+ String category = "Generated columns";\r
+ createCategory(category, categoryFeatures);\r
+ createClickAction("Add Button", category, addGeneratedColumnCommand,\r
+ new GeneratedColumn(Button.class, null));\r
+ createClickAction("Add 200px wide Button", category,\r
+ addGeneratedColumnCommand, new GeneratedColumn(Button.class,\r
+ "200px"));\r
+ createClickAction("Add 100% wide Button", category,\r
+ addGeneratedColumnCommand, new GeneratedColumn(Button.class,\r
+ "100%"));\r
+ createClickAction("Add Label", category, addGeneratedColumnCommand,\r
+ new GeneratedColumn(Label.class, null));\r
+ createClickAction("Add 100px Label", category,\r
+ addGeneratedColumnCommand, new GeneratedColumn(Label.class,\r
+ "100px"));\r
+ createClickAction("Add 100% wide Label", category,\r
+ addGeneratedColumnCommand, new GeneratedColumn(Label.class,\r
+ "100%"));\r
+\r
+ createClickAction("Remove generated columns", category,\r
+ removeGeneratedColumnsCommand, null);\r
+ }\r
+\r
+ private void createColumnHeaderMode(String category) {\r
+ LinkedHashMap<String, Integer> columnHeaderModeOptions = new LinkedHashMap<String, Integer>();\r
+ columnHeaderModeOptions.put("Hidden", Table.COLUMN_HEADER_MODE_HIDDEN);\r
+ columnHeaderModeOptions.put("Id", Table.COLUMN_HEADER_MODE_ID);\r
+ columnHeaderModeOptions.put("Explicit",\r
+ Table.COLUMN_HEADER_MODE_EXPLICIT);\r
+ columnHeaderModeOptions.put("Explicit defaults id",\r
+ Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID);\r
+\r
+ createSelectAction("Column header mode", category,\r
+ columnHeaderModeOptions, "Explicit defaults id",\r
+ columnHeaderModeCommand);\r
}\r
\r
private void createValueSelection(String categorySelection) {\r
});\r
}\r
\r
- private void createVisibleColumnsMultiToggle(String category) {\r
- LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();\r
+ private void createColumnOptions(boolean init) {\r
+ if (!init && !hasCategory(CATEGORY_COLUMNS)) {\r
+ return;\r
+ }\r
+\r
+ long start = System.currentTimeMillis();\r
+ if (!init) {\r
+ removeCategory(CATEGORY_COLUMNS);\r
+ }\r
+\r
for (Object id : getComponent().getContainerPropertyIds()) {\r
- options.put(id.toString(), id);\r
+ String name = id.toString();\r
+ createCategory(name, CATEGORY_COLUMNS);\r
+ createColumnOption(name, id);\r
+ }\r
+ for (int i = 0; i < generatedColumnNextNr; i++) {\r
+ String id = generatedColumnId + i;\r
+ String name = id;\r
+ if (getTestComponents().get(0).getColumnGenerator(id) != null) {\r
+ createCategory(name, CATEGORY_COLUMNS);\r
+ createColumnOption(name, id);\r
+ }\r
+ }\r
+\r
+ long end = System.currentTimeMillis();\r
+ System.err.println("Create options took " + (end - start) + "ms");\r
+ }\r
+\r
+ private class Timer {\r
+ private long start, last;\r
+\r
+ private Timer() {\r
+ start = System.currentTimeMillis();\r
+ last = System.currentTimeMillis();\r
}\r
\r
- createMultiToggleAction("Visible columns", category, options,\r
- visibleColumnCommand, true);\r
+ public void log(String msg) {\r
+ long now = System.currentTimeMillis();\r
+ System.err.println("[This: " + (now - last) + "ms, total: "\r
+ + (now - start) + "ms]: " + msg);\r
+ last = now;\r
+ }\r
+ }\r
+\r
+ private void createColumnOption(String category, Object propertyId) {\r
+ Timer t = new Timer();\r
+ createBooleanAction("Visible", category, true, columnVisibleCommand,\r
+ propertyId);\r
+ t.log("Visible");\r
+ createBooleanAction("Collapsed", category, false, columnCollapsed,\r
+ propertyId);\r
+ t.log("Collapsed");\r
+ LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();\r
+ options.put("Left", Table.ALIGN_LEFT);\r
+ options.put("Center", Table.ALIGN_CENTER);\r
+ options.put("Right", Table.ALIGN_RIGHT);\r
+\r
+ createSelectAction("Alignment", category, options, "Left",\r
+ columnAlignmentCommand, propertyId);\r
+ t.log("Alignment");\r
+ LinkedHashMap<String, Integer> widthOptions = new LinkedHashMap<String, Integer>();\r
+ widthOptions.put("- remove -", -1);\r
+ for (int i : new int[] { 0, 1, 10, 100, 200, 400 }) {\r
+ widthOptions.put(i + "px", i);\r
+ }\r
+ createSelectAction("Width", category, widthOptions, "- remove -",\r
+ columnWidthCommand, propertyId);\r
+ t.log("Width");\r
+\r
+ LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<String, Resource>();\r
+ iconOptions.put("- none -", null);\r
+ iconOptions.put("ok 16x16", ICON_16_USER_PNG_CACHEABLE);\r
+ iconOptions.put("help 16x16", ICON_16_HELP_PNG_CACHEABLE);\r
+ iconOptions.put("folder 16x16", ICON_16_FOLDER_PNG_CACHEABLE);\r
+ iconOptions.put("attention 32x32", ICON_32_ATTENTION_PNG_CACHEABLE);\r
+ createSelectAction("Icon", category, iconOptions, "- none -",\r
+ columnIconCommand, propertyId);\r
+\r
+ t.log("Icon");\r
+ LinkedHashMap<String, String> columnHeaderOptions = new LinkedHashMap<String, String>();\r
+ columnHeaderOptions.put("- none -", null);\r
+ columnHeaderOptions.put("A", "A");\r
+ columnHeaderOptions.put("A nice column", "A nice column");\r
+\r
+ createSelectAction("Column header", category, columnHeaderOptions,\r
+ "- none -", columnHeaderCommand, propertyId);\r
+ t.log("Header");\r
+ LinkedHashMap<String, Float> expandOptions = new LinkedHashMap<String, Float>();\r
+ expandOptions.put("- remove -", -1f);\r
+ for (float i : new float[] { 0, 1, 2, 3, 4, 5 }) {\r
+ expandOptions.put(i + "", i);\r
+ }\r
+ createSelectAction("Expand ratio", category, expandOptions,\r
+ "- remove -", columnExpandRatioCommand, propertyId);\r
+ t.log("Expand");\r
+ // Footer text (move)\r
+ // Header text (move)\r
+\r
}\r
\r
private void createRowHeaderModeSelect(String category) {\r
}\r
\r
// TODO:\r
- // Visible columns\r
- // Column icons\r
- // Column alignments\r
- // Column width\r
- // Column expand ratio\r
- // Column collapse\r
// setCurrentPageFirstItemIndex()\r
- // setColumnHeaderMode(int)\r
- // setRowHeaderMode(int)\r
- // Generated column\r
// Cell style generator\r
// Editable\r
- // Context menu\r
-\r
// Cache rate\r
// CurrentPageFirstItemId\r
\r
+ event.getButtonName());\r
}\r
\r
+ @Override\r
+ protected void updateContainer() {\r
+ super.updateContainer();\r
+\r
+ // Recreate for the new properties\r
+ createColumnOptions(false);\r
+\r
+ }\r
+\r
}\r