Skip to content

Commit c0f6066

Browse files
committed
feat!: replace setClassNameGenerator with setPartNameGenerator
Close #203
1 parent a0bad5f commit c0f6066

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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)