]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add support for actions for Table when no row is selected
authorArtur Signell <artur.signell@itmill.com>
Tue, 26 Apr 2011 14:52:10 +0000 (14:52 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 26 Apr 2011 14:52:10 +0000 (14:52 +0000)
svn changeset:18475/svn branch:6.6

tests/src/com/vaadin/tests/components/select/AbstractSelectTestCase.java
tests/src/com/vaadin/tests/components/table/Tables.java
tests/src/com/vaadin/tests/components/tree/Trees.java

index dbc66ff8c352fd03169046dc21d6a39cf5f7df09..528fbd7edd91e0e206ddad9ac0d8f9213fffe32d 100644 (file)
@@ -38,7 +38,7 @@ public abstract class AbstractSelectTestCase<T extends AbstractSelect> extends
             items.add(new Action(caption, icon));\r
         }\r
 \r
-        public Action[] getActions() {\r
+        public Action[] getActions(Object target, Object sender) {\r
             Action[] actions = new Action[items.size()];\r
             for (int i = 0; i < items.size(); i++) {\r
                 actions[i] = items.get(i);\r
index 46165a5fd4a32a8ffd60cf734323ad9e3badb020..4a0b91453402123875565e481eba7df401f07b88 100644 (file)
@@ -134,7 +134,7 @@ public class Tables extends AbstractSelectTestCase<Table> implements
                     }\r
 \r
                     public Action[] getActions(Object target, Object sender) {\r
-                        return value.getActions();\r
+                        return value.getActions(target, sender);\r
                     }\r
                 });\r
             }\r
@@ -184,10 +184,22 @@ public class Tables extends AbstractSelectTestCase<Table> implements
                 ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE));\r
         options.put("Empty", new ContextMenu() {\r
             @Override\r
-            public Action[] getActions() {\r
+            public Action[] getActions(Object target, Object sender) {\r
                 return null;\r
             }\r
         });\r
+        options.put("Edit/New", new ContextMenu() {\r
+            @Override\r
+            public Action[] getActions(Object itemId, Object component) {\r
+                if (itemId == null) {\r
+                    return new Action[] { new Action("New..."),\r
+                            new Action("Common action") };\r
+                } else {\r
+                    return new Action[] { new Action("Edit " + itemId),\r
+                            new Action("Common action") };\r
+                }\r
+            }\r
+        });\r
 \r
         createSelectAction("Context menu", category, options, "None",\r
                 contextMenuCommand, true);\r
index dbb340d0efb04d8b16473278090d2614b41f441f..076e0c9dda918a3a5ddc8719c66f4b4a76a8c3fe 100644 (file)
@@ -92,7 +92,7 @@ public class Trees extends AbstractSelectTestCase<Tree> implements
                     }\r
 \r
                     public Action[] getActions(Object target, Object sender) {\r
-                        return value.getActions();\r
+                        return value.getActions(target, sender);\r
                     }\r
                 });\r
             }\r