From ff310e8bdbfc773153e4faa9eb5749bb3e44700e Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 18 Jul 2014 15:33:55 +0300 Subject: Grid header/footer rewrite: add partial shared state support (#13334) Currently supported: * Adding and removal of header and footer rows * Header is single-row by default * Footer is zero-row by default * Text captions * Showing and hiding the whole header or footer * Passing captions and visibility in shared state TODO: * Column spanning * HTML content * Widget content * Component content * Sorting/Indicators * Server side API * Rest of shared state handling Change-Id: Iddd1a596597c3b11ead50bd7d5d7011cd81e2c83 --- .../com/vaadin/shared/ui/grid/GridColumnState.java | 2 ++ .../src/com/vaadin/shared/ui/grid/GridState.java | 10 ++---- .../shared/ui/grid/GridStaticSectionState.java | 41 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 shared/src/com/vaadin/shared/ui/grid/GridStaticSectionState.java (limited to 'shared') diff --git a/shared/src/com/vaadin/shared/ui/grid/GridColumnState.java b/shared/src/com/vaadin/shared/ui/grid/GridColumnState.java index b9bae35db6..5c0d04d968 100644 --- a/shared/src/com/vaadin/shared/ui/grid/GridColumnState.java +++ b/shared/src/com/vaadin/shared/ui/grid/GridColumnState.java @@ -37,11 +37,13 @@ public class GridColumnState implements Serializable { /** * Header caption for the column */ + @Deprecated public String header; /** * Footer caption for the column */ + @Deprecated public String footer; /** diff --git a/shared/src/com/vaadin/shared/ui/grid/GridState.java b/shared/src/com/vaadin/shared/ui/grid/GridState.java index ef1b9a806a..68ee64dfe4 100644 --- a/shared/src/com/vaadin/shared/ui/grid/GridState.java +++ b/shared/src/com/vaadin/shared/ui/grid/GridState.java @@ -98,15 +98,9 @@ public class GridState extends AbstractComponentState { */ public List columns = new ArrayList(); - /** - * Is the column header row visible - */ - public boolean columnHeadersVisible = true; + public GridStaticSectionState header = new GridStaticSectionState(); - /** - * Is the column footer row visible - */ - public boolean columnFootersVisible = false; + public GridStaticSectionState footer = new GridStaticSectionState(); /** * The column groups added to the grid diff --git a/shared/src/com/vaadin/shared/ui/grid/GridStaticSectionState.java b/shared/src/com/vaadin/shared/ui/grid/GridStaticSectionState.java new file mode 100644 index 0000000000..358c06d089 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/grid/GridStaticSectionState.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2014 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.List; + +/** + * Shared state for Grid headers and footers. + * + * @since + * @author Vaadin Ltd + */ +public class GridStaticSectionState implements Serializable { + + public static class CellState implements Serializable { + public String text = ""; + } + + public static class RowState implements Serializable { + public List cells = new ArrayList(); + } + + public List rows = new ArrayList(); + + public boolean visible = true; +} -- cgit v1.2.3