From 680b7009d4f453dc8eec42975192094b2e0e8e2f Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Wed, 21 Sep 2016 13:08:16 +0300 Subject: Initial support for multiple headers in new Grid Change-Id: I7a3fa34749322451ab5cef4465d4d7c76029c097 --- .../java/com/vaadin/shared/ui/grid/GridState.java | 3 ++ .../com/vaadin/shared/ui/grid/SectionState.java | 57 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 shared/src/main/java/com/vaadin/shared/ui/grid/SectionState.java (limited to 'shared/src') diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java index 4f480139d5..6c9631b598 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java @@ -99,6 +99,9 @@ public class GridState extends AbstractSingleSelectState { primaryStyleName = "v-grid"; } + /** The state of the header section. */ + public SectionState header = new SectionState(); + /** * Column order in grid. */ diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/SectionState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/SectionState.java new file mode 100644 index 0000000000..55a8df99b8 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/SectionState.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * 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. + */ +package com.vaadin.shared.ui.grid; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Shared state for Grid headers and footers. + * + * @author Vaadin Ltd + * @since 7.4 + */ +public class SectionState implements Serializable { + + /** The state of a header or footer row. */ + public static class RowState implements Serializable { + + /** The map from column ids to the cells in this row. */ + public Map cells = new HashMap<>(); + + /** + * Whether this row is the default header row. Always false for footer + * rows. + */ + public boolean defaultHeader = false; + } + + /** The state of a header or footer cell. */ + public static class CellState implements Serializable { + + /** The textual caption of this cell. */ + public String text; + + /** The id of the column that this cell belongs to. */ + public String columnId; + } + + /** The rows in this section. */ + public List rows = new ArrayList<>(); +} -- cgit v1.2.3