diff options
author | Henrik Paul <henrik@vaadin.com> | 2015-02-17 17:25:33 +0200 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2015-02-18 11:58:57 +0200 |
commit | e44ab1ae58b6d622737935b01a2ddacab1661e5a (patch) | |
tree | d0e904b21584f6452bf24e58bd9a358b4d485022 /uitest/src/com/vaadin/tests/widgetset | |
parent | add05e15fcd82d73f4c46245dbe6d0999437cdec (diff) | |
download | vaadin-framework-e44ab1ae58b6d622737935b01a2ddacab1661e5a.tar.gz vaadin-framework-e44ab1ae58b6d622737935b01a2ddacab1661e5a.zip |
Adds Widget support for DetailsGenerator (#16644)
Change-Id: Ib964b2aa102b8c56e65b0af87bed008248038599
Diffstat (limited to 'uitest/src/com/vaadin/tests/widgetset')
-rw-r--r-- | uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java index 7c2ca3eedb..110b14c721 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java @@ -33,9 +33,11 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.data.DataSource; import com.vaadin.client.data.DataSource.RowHandle; import com.vaadin.client.renderers.DateRenderer; @@ -1224,17 +1226,59 @@ public class GridBasicClientFeaturesWidget extends public void execute() { grid.setDetailsGenerator(new DetailsGenerator() { @Override - public String getDetails(int rowIndex) { - return "Row: " + rowIndex + ". Lorem ipsum " - + "dolor sit amet, consectetur adipiscing " - + "elit. Morbi congue massa non augue " - + "pulvinar, nec consectetur justo efficitur. " - + "In nec arcu sit amet lorem hendrerit " - + "mollis."; + public Widget getDetails(int rowIndex) { + FlowPanel panel = new FlowPanel(); + + final Label label = new Label("Row: " + rowIndex + "."); + Button button = new Button("Button", + new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + label.setText("clicked"); + } + }); + + panel.add(label); + panel.add(button); + return panel; } }); } }, menupath); + + addMenuCommand("Set faulty generator", new ScheduledCommand() { + @Override + public void execute() { + grid.setDetailsGenerator(new DetailsGenerator() { + @Override + public Widget getDetails(int rowIndex) { + throw new RuntimeException("This is by design."); + } + }); + } + }, menupath); + + addMenuCommand("Set empty generator", new ScheduledCommand() { + @Override + public void execute() { + grid.setDetailsGenerator(new DetailsGenerator() { + /* + * While this is functionally equivalent to the NULL + * generator, it's good to be explicit, since the behavior + * isn't strictly tied between them. NULL generator might be + * changed to render something different by default, and an + * empty generator might behave differently also in the + * future. + */ + + @Override + public Widget getDetails(int rowIndex) { + return null; + } + }); + } + }, menupath); + addMenuCommand("Toggle details for row 1", new ScheduledCommand() { boolean visible = false; @@ -1244,6 +1288,7 @@ public class GridBasicClientFeaturesWidget extends grid.setDetailsVisible(1, visible); } }, menupath); + addMenuCommand("Toggle details for row 100", new ScheduledCommand() { boolean visible = false; @@ -1253,5 +1298,6 @@ public class GridBasicClientFeaturesWidget extends grid.setDetailsVisible(100, visible); } }, menupath); + } } |