diff options
author | Samuel DALICHAMPT <sdalichampt@users.noreply.github.com> | 2017-03-30 16:47:24 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-05-08 14:46:35 +0300 |
commit | 85f644fe4f903c9c258733bd02cdb33db98b1a57 (patch) | |
tree | 89e8111088e41dad1ecd28e71636a10eaaa8091f /documentation/components | |
parent | 01e78d58b0141c69e531eef3e4a1881eec98216b (diff) | |
download | vaadin-framework-85f644fe4f903c9c258733bd02cdb33db98b1a57.tar.gz vaadin-framework-85f644fe4f903c9c258733bd02cdb33db98b1a57.zip |
Fix method reference syntax in Grid documentation (#8978)
Diffstat (limited to 'documentation/components')
-rw-r--r-- | documentation/components/components-grid.asciidoc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/documentation/components/components-grid.asciidoc b/documentation/components/components-grid.asciidoc index 6a18a54897..0e1078cd0e 100644 --- a/documentation/components/components-grid.asciidoc +++ b/documentation/components/components-grid.asciidoc @@ -150,7 +150,7 @@ SingleSelectionModel<Person> defaultModel = (SingleSelectionModel<Person>) grid.getSelectionModel(); // Use multi-selection mode -MultiSelectionModel<Person> selectionModel = +MultiSelectionModel<Person> selectionModel = (MultiSelectionModel<Person>) grid.setSelectionMode(SelectionMode.MULTI); ---- @@ -200,7 +200,7 @@ access to [classname]#MultiSelectionEvent#, which allows to easily access differ // Grid in multi-selection mode Grid<Person> grid = Grid<>() grid.setItems(people); -MultiSelectionModel<Person> selectionModel +MultiSelectionModel<Person> selectionModel = (MultiSelectionModel<Person>) grid.setSelectionMode(SelectionMode.MULTI); selectionModel.selectAll(); @@ -263,7 +263,7 @@ The setter methods in [classname]#Column# have _fluent API_, so you can easily c [source, java] ---- -grid.addColumn(Person:getBirthDate, new DateRenderer()) +grid.addColumn(Person::getBirthDate, new DateRenderer()) .setCaption("Birth Date") .setWidth("100px") .setResizable(false); @@ -325,7 +325,7 @@ explicitly through the column object with [methodname]#setCaption()#. [source, java] ---- -Column<Date> bornColumn = grid.addColumn(Person:getBirthDate); +Column<Date> bornColumn = grid.addColumn(Person::getBirthDate); bornColumn.setCaption("Born date"); ---- @@ -403,7 +403,7 @@ You set the column renderer in the [classname]#Grid.Column# object as follows: [source, java] ---- // the type of birthYear is a number -Column<Person, Integer> bornColumn = grid.addColumn(Person:getBirthYear, +Column<Person, Integer> bornColumn = grid.addColumn(Person::getBirthYear, new NumberRenderer("born in %d AD")); ---- @@ -415,7 +415,7 @@ When you change the renderer, the content of Grid is refreshed. ---- Column<Person, Integer> ageColumn = grid.addColumn(Person::getBirthYear); // The default renderer is TextRenderer -addComponent(new Button("Change renderer", +addComponent(new Button("Change renderer", clickEvent -> ageColumn.setRenderer(new NumberRenderer()) )); ---- @@ -446,7 +446,7 @@ people.add(new Person("Johannes Kepler", 1571)); Grid<Person> grid = new Grid<>(people); // Render a button that deletes the data row (item) -grid.addColumn(person -> "Delete", +grid.addColumn(person -> "Delete", new ButtonRenderer(clickEvent -> { people.remove(clickEvent.getValue()); grid.setItems(people); @@ -462,7 +462,7 @@ The column type must be a [interfacename]#Resource#, as described in + [source, java] ---- -Column<ThemeResource> imageColumn = grid.addColumn( +Column<Person, ThemeResource> imageColumn = grid.addColumn( p -> new ThemeResource("img/"+p.getLastname()+".jpg"), new ImageRenderer()); ---- @@ -475,7 +475,7 @@ format specifier, such as "[literal]#++%tF++#". + [source, java] ---- -Grid.Column<Date> bornColumn = grid.addColumn(person:getBirthDate, +Column<Person, Date> bornColumn = grid.addColumn(Person::getBirthDate, new DateRenderer("%1$tB %1$te, %1$tY", Locale.ENGLISH)); ---- @@ -492,7 +492,7 @@ Set the renderer in the [classname]#Grid.Column# object: + [source, java] ---- -Column<String> htmlColumn grid.addColumn(person -> +Column<Person, String> htmlColumn grid.addColumn(person -> "<a href='" + person.getDetailsUrl() + "' target='_top'>info</a>", new HtmlRenderer()); ---- |