private void toggle(final DocumentType type) {
        if (type.equals(SELECT_ALL_OR_NONE_DOCUMENT_TYPE)) {
            toggleSelectAll();
        } else {
            if (selected.contains(type.getType())) {
                selected.remove(type.getType());
            } else {
                selected.add(type.getType());
            }
        }

        if (filterStateConsumer != null) {
            filterStateConsumer.accept(hasActiveFilter());
        }

        refreshView();
        DataSelectionEvent.fire(
                TypeFilterPresenter.this,
                TypeFilterPresenter.this,
                false);
    }
@return A set of types to include, or empty if the type filter is not active
stroom-core-client/src/main/java/stroom/explorer/client/presenter/TypeFilterPresenter.java