mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
Table CellClickListener should have <E> parameter #906
This commit is contained in:
parent
74c72753bb
commit
dab80cd987
@ -2210,7 +2210,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickListener(String columnId, CellClickListener clickListener) {
|
||||
public void setClickListener(String columnId, CellClickListener<? super E> clickListener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -456,7 +456,7 @@ public interface Table<E extends Entity>
|
||||
* @param columnId id of column
|
||||
* @param clickListener click listener
|
||||
*/
|
||||
void setClickListener(String columnId, CellClickListener clickListener);
|
||||
void setClickListener(String columnId, CellClickListener<? super E> clickListener);
|
||||
|
||||
/**
|
||||
* Remove click listener.
|
||||
@ -468,12 +468,12 @@ public interface Table<E extends Entity>
|
||||
/**
|
||||
* Lightweight click listener for table cells.
|
||||
*/
|
||||
interface CellClickListener {
|
||||
interface CellClickListener<T extends Entity> {
|
||||
/**
|
||||
* @param item row item
|
||||
* @param columnId id of column
|
||||
*/
|
||||
void onClick(Entity item, String columnId);
|
||||
void onClick(T item, String columnId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2393,11 +2393,17 @@ public abstract class WebAbstractTable<T extends com.vaadin.v7.ui.Table & CubaEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickListener(String columnId, CellClickListener clickListener) {
|
||||
public void setClickListener(String columnId, CellClickListener<? super E> clickListener) {
|
||||
component.setClickListener(getColumn(columnId).getId(), (itemId, columnId1) -> {
|
||||
ItemWrapper wrapper = (ItemWrapper) component.getItem(itemId);
|
||||
Entity entity = wrapper.getItem();
|
||||
clickListener.onClick(entity, columnId1.toString());
|
||||
// TableItemWrapper wrapper = (TableItemWrapper) component.getItem(itemId);
|
||||
// Object itemId2 = wrapper.getItemId();
|
||||
TableSource<E> tableSource = getTableSource();
|
||||
if (tableSource == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
E item = tableSource.getItem(itemId);
|
||||
clickListener.onClick(item, columnId1.toString());
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user