瀏覽代碼

Add notification of pre-release renderers to grid documentation

tags/8.1.0.alpha4
Aleksi Hietanen 7 年之前
父節點
當前提交
973564d475
共有 1 個文件被更改,包括 34 次插入31 次删除
  1. 34
    31
      documentation/components/components-grid.asciidoc

+ 34
- 31
documentation/components/components-grid.asciidoc 查看文件

@@ -484,6 +484,40 @@ Column<Person, Date> bornColumn = grid.addColumn(Person::getBirthDate,
Optionally, a locale can be given. Otherwise, the default locale (in the
component tree) is used.

[classname]#HTMLRenderer#:: Renders the cell as HTML.
This allows formatting the cell content, as well as using HTML features such as hyperlinks.

+
Set the renderer in the [classname]#Grid.Column# object:
+
[source, java]
----
Column<Person, String> htmlColumn grid.addColumn(person ->
"<a href='" + person.getDetailsUrl() + "' target='_top'>info</a>",
new HtmlRenderer());
----

[classname]#NumberRenderer#:: Formats column values with a numeric type extending [classname]#Number#:
[classname]#Integer#, [classname]#Double#, etc. The format can be specified
either by the subclasses of [classname]#java.text.NumberFormat#, namely
[classname]#DecimalFormat# and [classname]#ChoiceFormat#, or by
[methodname]#String.format()#.

+
For example:
+
[source, java]
----
// Use decimal format
Column<Integer> birthYear = grid.addColumn(Person::getBirthYear,
new NumberRenderer(new DecimalFormat("in #### AD")));
----

[classname]#ProgressBarRenderer#:: Renders a progress bar in a column with a [classname]#Double# type. The value
must be between 0.0 and 1.0.

IMPORTANT: The following renderers are to be released in version 8.1 and are currently only available in link:https://vaadin.com/releases[pre-release versions] of the framework, starting from 8.1.0.alpha3.

[classname]#LocalDateRenderer#::
Formats a column with the [classname]#LocalDate# type.
The renderer can be constructed with a [classname]#DateTimeFormatter#, or with a custom pattern string.
@@ -531,37 +565,6 @@ Column<Person, LocalDateTime> bornColumn =
new LocalDateTimeRenderer("yyyy.MM.dd 'at' hh:mm"));
----

[classname]#HTMLRenderer#:: Renders the cell as HTML.
This allows formatting the cell content, as well as using HTML features such as hyperlinks.

+
Set the renderer in the [classname]#Grid.Column# object:
+
[source, java]
----
Column<Person, String> htmlColumn grid.addColumn(person ->
"<a href='" + person.getDetailsUrl() + "' target='_top'>info</a>",
new HtmlRenderer());
----

[classname]#NumberRenderer#:: Formats column values with a numeric type extending [classname]#Number#:
[classname]#Integer#, [classname]#Double#, etc. The format can be specified
either by the subclasses of [classname]#java.text.NumberFormat#, namely
[classname]#DecimalFormat# and [classname]#ChoiceFormat#, or by
[methodname]#String.format()#.

+
For example:
+
[source, java]
----
// Use decimal format
Column<Integer> birthYear = grid.addColumn(Person::getBirthYear,
new NumberRenderer(new DecimalFormat("in #### AD")));
----

[classname]#ProgressBarRenderer#:: Renders a progress bar in a column with a [classname]#Double# type. The value
must be between 0.0 and 1.0.

[classname]#ComponentRenderer#:: Renders a Vaadin [classname]#Component# in a column. Since components
are quite complex, the [classname]#ComponentRenderer# comes with possible performance issues.

Loading…
取消
儲存