aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java
blob: 4d30466305ba91cb691be2a93609c249363ccf16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 * Copyright 2000-2022 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.ui.components.grid;

import java.io.Serializable;
import java.util.Collection;
import java.util.Set;

import com.vaadin.ui.Component;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;

/**
 * A header row in a Grid.
 *
 * @author Vaadin Ltd
 * @since 8.0
 */
public interface HeaderRow extends Serializable {

    /**
     * Returns the cell on this row corresponding to the given column id.
     *
     * @see Column#setId(String)
     *
     * @param columnId
     *            the id of the column whose header cell to get, not null
     * @return the header cell
     * @throws IllegalArgumentException
     *             if there is no such column in the grid
     */
    public HeaderCell getCell(String columnId);

    /**
     * Returns the cell on this row corresponding to the given column.
     *
     * @param column
     *            the column whose header cell to get, not null
     * @return the header cell
     * @throws IllegalArgumentException
     *             if there is no such column in the grid
     */
    public HeaderCell getCell(Grid.Column<?, ?> column);

    /**
     * Merges column cells in the row. Original cells are hidden, and new merged
     * cell is shown instead. The cell has a width of all merged cells together,
     * inherits styles of the first merged cell but has empty caption.
     *
     * @param cellsToMerge
     *            the cells which should be merged. The cells should not be
     *            merged to any other cell set.
     * @return the remaining visible cell after the merge
     *
     * @see #join(HeaderCell...)
     * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
     */
    HeaderCell join(Set<HeaderCell> cellsToMerge);

    /**
     * Merges column cells in the row. Original cells are hidden, and new merged
     * cell is shown instead. The cell has a width of all merged cells together,
     * inherits styles of the first merged cell but has empty caption.
     *
     * @param cellsToMerge
     *            the cells which should be merged. The cells should not be
     *            merged to any other cell set.
     * @return the remaining visible cell after the merge
     *
     * @see #join(Set)
     * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
     */
    HeaderCell join(HeaderCell... cellsToMerge);

    /**
     * Merges cells corresponding to the given columns in the row. Original
     * cells are hidden, and new merged cell is shown instead. The cell has a
     * width of all merged cells together, inherits styles of the first merged
     * cell but has empty caption.
     *
     * @param columnsToMerge
     *            the columns of the cells that should be merged. The cells
     *            should not be merged to any other cell set.
     * @return the remaining visible cell after the merge
     *
     * @see #join(Set)
     * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
     */
    HeaderCell join(Grid.Column<?, ?>... columnsToMerge);

    /**
     * Merges cells corresponding to the given column ids in the row. Original
     * cells are hidden, and new merged cell is shown instead. The cell has a
     * width of all merged cells together, inherits styles of the first merged
     * cell but has empty caption.
     *
     * @param columnIdsToMerge
     *            the ids of the columns of the cells that should be merged. The
     *            cells should not be merged to any other cell set.
     * @return the remaining visible cell after the merge
     *
     * @see #join(Set)
     * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
     * @see Column#setId(String)
     */
    HeaderCell join(String... columnIdsToMerge);

    /**
     * Returns the custom style name for this row.
     *
     * @return the style name or null if no style name has been set
     */
    public String getStyleName();

    /**
     * Sets a custom style name for this row.
     *
     * @param styleName
     *            the style name to set or null to not use any style name
     */
    public void setStyleName(String styleName);

    /**
     * Gets a collection of all components inside this row.
     * <p>
     * The order of the components in the returned collection is not specified.
     *
     * @return a collection of components in the row
     *
     * @since 8.0.3
     */
    public Collection<? extends Component> getComponents();
}