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

io.imunity.furms.ui.components.CustomValueCheckBox Maven / Gradle / Ivy

There is a newer version: 4.3.1
Show newest version
/*
 * Copyright (c) 2020 Bixbit s.c. All rights reserved.
 * See LICENSE file for licensing information.
 */

package io.imunity.furms.ui.components;

import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.DebounceSettings;
import com.vaadin.flow.component.DomEvent;
import com.vaadin.flow.component.combobox.ComboBox;

import static com.vaadin.flow.dom.DebouncePhase.INTERMEDIATE;
import static com.vaadin.flow.dom.DebouncePhase.LEADING;

class CustomValueCheckBox extends ComboBox {
	private String customValue;

	@SuppressWarnings({"unchecked", "rawtypes"})
	CustomValueCheckBox() {
		this.setAllowCustomValue(true);
		this.addListener(CustomValueCheckBoxEvent.class, (ComponentEventListener) eventListener -> {
			customValue = getElement().getProperty("filter");
			fireEvent(new CustomValueSetEvent<>(this, false, customValue));
		});
	}

	public String getCustomValue() {
		return customValue;
	}

	public void clearEmail() {
		customValue = "";
	}

	@DomEvent(value = "input", debounce = @DebounceSettings(timeout = 500, phases = {LEADING, INTERMEDIATE}))
	public static class CustomValueCheckBoxEvent> extends ComponentEvent {
		public CustomValueCheckBoxEvent(T source, boolean fromClient) {
			super(source, fromClient);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy