All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.ui.components.grid.NoSelectionModel Maven / Gradle / Ivy

There is a newer version: 8.27.3
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */
package com.vaadin.ui.components.grid;

import java.util.Collections;
import java.util.Optional;
import java.util.Set;

import com.vaadin.event.selection.SelectionListener;
import com.vaadin.server.AbstractExtension;
import com.vaadin.shared.Registration;

/**
 * Selection model that doesn't allow selecting anything from the grid.
 *
 * @author Vaadin Ltd
 *
 * @since 8.0
 *
 * @param 
 *            the type of items in the grid
 */
public class NoSelectionModel extends AbstractExtension
        implements GridSelectionModel {

    @Override
    public Set getSelectedItems() {
        return Collections.emptySet();
    }

    @Override
    public Optional getFirstSelectedItem() {
        return Optional.empty();
    }

    @Override
    public void select(T item) {
    }

    @Override
    public void deselect(T item) {
    }

    @Override
    public void deselectAll() {
    }

    @Override
    public Registration addSelectionListener(SelectionListener listener) {
        throw new UnsupportedOperationException(
                "This selection model doesn't allow selection, cannot add selection listeners to it");
    }

    @Override
    public void setUserSelectionAllowed(boolean allowed) {
    }

    @Override
    public boolean isUserSelectionAllowed() {
        return false;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy