From 368c4508fd06d8d53b367706e8a1cd9a27a5b0c0 Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:34:06 -0300 Subject: [PATCH] feat(demo): add demo for HeightByRowsHelper Close #98 --- .../gridhelpers/GridHelpersDemoView.java | 1 + .../addons/gridhelpers/HeightByRowsDemo.java | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/test/java/com/flowingcode/vaadin/addons/gridhelpers/HeightByRowsDemo.java diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelpersDemoView.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelpersDemoView.java index 7a4d441..676f02c 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelpersDemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/GridHelpersDemoView.java @@ -51,5 +51,6 @@ public GridHelpersDemoView() { addDemo(LazyMultiSelectionDemo.class); addDemo(CheckboxColumnDemo.class); addDemo(EmptyGridLabelDemo.class); + addDemo(HeightByRowsDemo.class); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/HeightByRowsDemo.java b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/HeightByRowsDemo.java new file mode 100644 index 0000000..5d930cc --- /dev/null +++ b/src/test/java/com/flowingcode/vaadin/addons/gridhelpers/HeightByRowsDemo.java @@ -0,0 +1,49 @@ +/*- + * #%L + * Grid Helpers Add-on + * %% + * Copyright (C) 2022 Flowing Code + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +package com.flowingcode.vaadin.addons.gridhelpers; + +import com.flowingcode.vaadin.addons.demo.DemoSource; +import com.vaadin.flow.component.grid.Grid; +import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; + +@PageTitle("Height By Rows") +@DemoSource +@Route(value = "grid-helpers/height-by-rows", layout = GridHelpersDemoView.class) +public class HeightByRowsDemo extends Div { + + public HeightByRowsDemo() { + setSizeFull(); + + Grid grid = new Grid<>(); + grid.setItems(TestData.initializeData()); + + grid.addColumn(Person::getFirstName).setHeader("First name"); + grid.addColumn(Person::getLastName).setHeader("Last name"); + grid.addColumn(Person::getCountry).setHeader("Country"); + + GridHelper.setHeightMode(grid, HeightMode.ROW); + GridHelper.setHeightByRows(grid, 7); + + add(grid); + } +}