Skip to content

Commit 8f643ce

Browse files
javier-godoypaodb
authored andcommitted
feat!: replace setClassNameGenerator with setPartNameGenerator
Close #203
1 parent fd7c308 commit 8f643ce

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/main/java/com/flowingcode/vaadin/addons/twincolgrid/FilterableTwinColumn.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ public FilterableTwinColumn<T> setFooter(Supplier<Component> footerComponentSupp
137137
}
138138

139139
@Override
140-
public FilterableTwinColumn<T> setClassNameGenerator(
141-
SerializableFunction<T, String> classNameGenerator) {
142-
super.setClassNameGenerator(classNameGenerator);
140+
public FilterableTwinColumn<T> setPartNameGenerator(
141+
SerializableFunction<T, String> partNameGenerator) {
142+
super.setPartNameGenerator(partNameGenerator);
143143
return this;
144144
}
145145

src/main/java/com/flowingcode/vaadin/addons/twincolgrid/TwinColumn.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package com.flowingcode.vaadin.addons.twincolgrid;
2121

2222
import com.vaadin.flow.component.Component;
23+
import com.vaadin.flow.component.grid.Grid;
2324
import com.vaadin.flow.component.grid.Grid.Column;
2425
import com.vaadin.flow.component.grid.SortOrderProvider;
2526
import com.vaadin.flow.data.provider.QuerySortOrder;
@@ -240,17 +241,21 @@ public TwinColumn<T> setFooter(Supplier<Component> footerComponentSupplier) {
240241
}
241242

242243
/**
243-
* Sets the function that is used for generating CSS class names for cells in both columns.
244+
* Sets the function that is used for generating CSS part names for cells in both columns.
245+
* Returning {@code null} from the generator results in no custom part name being set. Multiple
246+
* part names can be returned from the generator as space-separated.
247+
* <p>
248+
* If {@link Grid#setPartNameGenerator(SerializableFunction)} is used together with this method,
249+
* resulting part names from both methods will be effective.
244250
*
245-
* @see Column#setClassNameGenerator(SerializableFunction)
246-
*
247-
* @param classNameGenerator the class name generator to set, not {@code null}
251+
* @param partNameGenerator the part name generator to set, not {@code null}
248252
* @return this instance, for method chaining
249-
* @throws NullPointerException if {@code classNameGenerator} is {@code null}
253+
* @throws NullPointerException if {@code partNameGenerator} is {@code null}
254+
* @see Column#setPartNameGenerator(SerializableFunction)
250255
*/
251-
public TwinColumn<T> setClassNameGenerator(SerializableFunction<T, String> classNameGenerator) {
252-
availableColumn.setClassNameGenerator(classNameGenerator);
253-
selectionColumn.setClassNameGenerator(classNameGenerator);
256+
public TwinColumn<T> setPartNameGenerator(SerializableFunction<T, String> partNameGenerator) {
257+
availableColumn.setPartNameGenerator(partNameGenerator);
258+
selectionColumn.setPartNameGenerator(partNameGenerator);
254259
return this;
255260
}
256261

0 commit comments

Comments
 (0)