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

com.github.fluorumlabs.disconnect.vaadin.mixins.HasSelectionMixin Maven / Gradle / Ivy

The newest version!
package com.github.fluorumlabs.disconnect.vaadin.mixins;

import com.github.fluorumlabs.disconnect.vaadin.elements.mixins.SelectionMixin;
import com.github.fluorumlabs.disconnect.zero.component.Component;
import js.lang.Any;
import js.util.collections.Array;

import javax.annotation.Nullable;

public interface HasSelectionMixin, T extends Component>
		extends Component {
	/**
	 * An array that contains the selected items.
	 */
	@Nullable
	default Array selectedItems() {
		return getNode().getSelectedItems();
	}

	/**
	 * An array that contains the selected items.
	 */
	default T selectedItems(ITEM... selectedItems) {
		getNode().setSelectedItems(selectedItems);
		return (T) this;
	}

	default T selectedItems(Array selectedItems) {
		getNode().setSelectedItems(selectedItems);
		return (T) this;
	}

	/**
	 * Selects the given item.
	 *
	 * @param item The item object
	 */
	default void selectItem(ITEM item) {
		getNode().selectItem(item);
	}

	/**
	 * Deselects the given item if it is already selected.
	 *
	 * @param item The item object
	 */
	default void deselectItem(ITEM item) {
		getNode().deselectItem(item);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy