added overridable method to control visibility on datatable clickable icon column

This commit is contained in:
Emil Siverhall 2012-07-17 14:20:49 +02:00
parent ec7673d64c
commit 0bc3128272
2 changed files with 9 additions and 0 deletions
src/main/java/se/su/dsv/scipro

@ -39,6 +39,14 @@ public abstract class ClickableIconColumn<T> extends AbstractColumn<T> {
protected abstract void onClick(IModel<T> clicked, AjaxRequestTarget target);
/**
* Override this if you want to customize the visibility of the icon.
* e.g. the case where you wnat some specific rows editable based on certain conditions.
*/
public boolean shouldBeVisible(IModel<T> rowModel) {
return true;
}
private class LinkPanel extends Panel {
public LinkPanel(String id, IModel<T> rowModel, IModel<?>
labelModel, String iconString) {
@ -52,6 +60,7 @@ public abstract class ClickableIconColumn<T> extends AbstractColumn<T> {
};
add(link);
link.add(new ImageObject("deleteicon", ImageObject.SIXTEEN + iconString));
link.setVisible(shouldBeVisible(rowModel));
}
}
}