org.dominokit.domino.ui.datatable.plugins.DoubleClickPlugin Maven / Gradle / Ivy
package org.dominokit.domino.ui.datatable.plugins;
import org.dominokit.domino.ui.datatable.DataTable;
import org.dominokit.domino.ui.datatable.TableRow;
import org.jboss.elemento.EventType;
public class DoubleClickPlugin implements DataTablePlugin {
private DoublClickHandler handler;
public DoubleClickPlugin(DoublClickHandler handler) {
this.handler = handler;
}
@Override
public void onRowAdded(DataTable dataTable, TableRow tableRow) {
tableRow.element().addEventListener(EventType.dblclick.getName(), evt -> {
handler.onDoubleClick(tableRow);
});
}
@FunctionalInterface
public interface DoublClickHandler {
void onDoubleClick(TableRow tableRow);
}
}