@Override
    public void onBrowserEvent(final Context context, final Element parent, final TickBoxState value,
                               final NativeEvent event, final ValueUpdater<TickBoxState> valueUpdater) {
        if (value != null) {
            super.onBrowserEvent(context, parent, value, event, valueUpdater);
            final String type = event.getType();

            final Action action = KeyBinding.test(event);
            if (clickable && isTickBox(event) &&
                    ((BrowserEvents.MOUSEDOWN.equals(type) && MouseUtil.isPrimary(event)) ||
                            (BrowserEvents.KEYDOWN.equals(type) && action == Action.SELECT))) {
                event.preventDefault();

                TickBoxState state = value;

                // Toggle the value if the enter key was pressed and the cell
                // handles selection or doesn't depend on selection. If the cell
                // depends on selection but doesn't handle selection, then
                // ignore the enter key and let the SelectionEventManager
                // determine which keys will trigger a change.
                if (handlesSelection() || !dependsOnSelection()) {
                    switch (value) {
                        case TICK:
                            state = TickBoxState.UNTICK;
                            break;
                        case HALF_TICK:
                        case UNTICK:
                            state = TickBoxState.TICK;
                            break;
                    }

                    // Update the tick image immediately.
                    final SafeHtml html = appearance.getHTML(state);
                    parent.setInnerHTML(html.asString());
                }

                // Save the new value. However, if the cell depends on the
                // selection, then do not save the value because we can get into
                // an inconsistent state.
                if (value != state && !dependsOnSelection()) {
                    setViewData(context.getKey(), state);
                } else {
                    clearViewData(context.getKey());
                }

                if (valueUpdater != null) {
                    valueUpdater.update(state);
                }
            }
        }
    }
Construct a new {@link CheckboxCell} that optionally controls selection.

@param dependsOnSelection true if the cell depends on the selection state
@param handlesSelection   true if the cell modifies the selection state
stroom-core-client-widget/src/main/java/stroom/cell/tickbox/client/TickBoxCell.java