Dealing with CheckBoxRenderer behavior

Hello,

I’m using CheckBoxRenderer in a grid column, on each row populating this grid ; the thing is that, when clicking the provided checkbox, it doesn’t only get checked or unchecked : the whole raw perimeter is over lined in blue and option
save
and
cancel
are displayed, (cf attachment) ; is it possible to get rid of this click event listener, (if it is about this) ? The idea being that one ore many checkboxes could be selected and then, a delete button would do the job.

reportsList = new Grid(beanReportContainer);
reportsList.setColumns("reports", "create", "delete");
......
reportsList.setEditorEnabled(true);
reportsList.setSelectionMode(SelectionMode.NONE);
......
CheckboxRenderer cbr = new CheckboxRenderer();
delete.setRenderer(cbr);
delete.setEditable(true);
....

Regards,

21056.png

Hi, I see you have set the row editor enabled (the blue outline plus the save/cancel buttons) - do you actually need it? It should only appear if you double-click the row though, not when (single) clicking a CheckBoxRenderer checkbox. Even so, double-clicking a checkbox should not open the editor either; if that happens it’s a bug.

I did try to set the row editor to false, but, if so, the checkboxes dynamicaly provided on each row aren’t clickable. Maybe it comes from the way I generate each row, using a basic pojo looking like this :

public class ReportFile implements Serializable {
....
        final Boolean delete) {
        this.reports = reports;
        this.create = create;
        this.delete = delete;

    } 

and then, fulfilling a container, with instances of this pojo :

[code]
BeanItemContainer beanReportContainer;

beanReportContainer = new BeanItemContainer(ReportFile.class);

int i = 0;
for (final String reportName : reportDAO.getReports(8)) {
final String namefile = String.valueOf(reportName.subSequence(0,
reportName.indexOf(“.html”)));
beanReportContainer.addBean(new ReportFile(i++, “” + namefile + “”,
new ThemeResource(“icons/13.png”), false));

}

reportsList = new Grid(beanReportContainer);
[/code]What do you think about it ?

Actually, when grid. setEditorEnabled() is set to false, the checkbox is checkable or de-checkable, (my mistake, from what I had declared in my previous post), but it throws a java.lang.IllegalStateException: Item editor is not enabled

PM com.vaadin.server.DefaultErrorHandler doDefault
GRAVE:
java.lang.IllegalStateException: Item editor is not enabled
        at com.vaadin.ui.Grid.editItem(Grid.java:5745)
        at org.vaadin.grid.cellrenderers.CheckboxRenderer$1.click(CheckboxRenderer.java:39)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
        at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:995)
        at com.vaadin.ui.renderers.ClickableRenderer.access$300(ClickableRenderer.java:40)
        at com.vaadin.ui.renderers.ClickableRenderer$1.click(ClickableRenderer.java:115)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
        at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:313)
        at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:202)
        at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:95)
        at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
        at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1408)
        at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:350)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

So is there a solution or work-around to this? I have a large grid of checkboxes and having each reveal an independant “Save/Cancel” panel is completely unworkable. There’s got to be some way to disable that behavior.

pseudo code… to explain my basic problem.

mGrid.setColumns(“function”, “complexity”, “resources”, …);
mGrid.setEditorEnabled(true);
mGrid.setSelectionMode(SelectionMode.NONE);

CheckboxRenderer req = new CheckboxRenderer();
CheckboxRenderer cmplx = new CheckboxRenderer();
CheckboxRenderer rsrcs = new CheckboxRenderer();

mGrid.getColumn(“requirement”).setRenderer(req);
mGrid.getColumn(“complexity”.setRenderer(cmplx);
mGrid.getColumn(“resources”.setRenderer(rsrcs) ;

I’m left with checkboxes as I like, however each checkbox, when changed launches the dreaded Save/Cancel dialog. Do we need to override all the actions? That seems like a great deal of work for a feature that should have been optional rather than default.