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

com.vaadin.flow.component.checkbox.GeneratedVaadinCheckbox Maven / Gradle / Ivy

There is a newer version: 24.4.12
Show newest version
/*
 * Copyright 2000-2018 Vaadin Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.vaadin.flow.component.checkbox;

import javax.annotation.Generated;

import com.vaadin.flow.component.AbstractSinglePropertyField;
import com.vaadin.flow.component.ClickNotifier;
import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.DomEvent;
import com.vaadin.flow.component.Focusable;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Synchronize;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.function.SerializableBiFunction;
import com.vaadin.flow.function.SerializableFunction;
import com.vaadin.flow.shared.Registration;

/**
 * 

* Description copied from corresponding location in WebComponent: *

*

* {@code } is a Web Component for customized checkboxes. *

*

* <vaadin-checkbox> Make my profile visible </vaadin-checkbox> *

*

Styling

*

* The following shadow DOM parts are available for styling: *

* * * * * * * * * * * * * * * * *
Part nameDescription
{@code checkbox}The checkbox element
{@code label}The label content element
*

* The following state attributes are available for styling: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AttributeDescriptionPart name
{@code active}Set when the checkbox is pressed down, either with mouse, touch or the * keyboard.{@code :host}
{@code disabled}Set when the checkbox is disabled.{@code :host}
{@code focus-ring}Set when the checkbox is focused using the keyboard.{@code :host}
{@code focused}Set when the checkbox is focused.{@code :host}
{@code indeterminate}Set when the checkbox is in indeterminate mode.{@code :host}
{@code checked}Set when the checkbox is checked.{@code :host}
{@code empty}Set when there is no label provided.{@code label}
*

* See * ThemableMixin * – how to apply styles for shadow parts *

*/ @Generated({ "Generator: com.vaadin.generator.ComponentGenerator#1.1-SNAPSHOT", "WebComponent: Vaadin.CheckboxElement#2.2.2", "Flow#1.1-SNAPSHOT" }) @Tag("vaadin-checkbox") @NpmPackage(value = "@vaadin/vaadin-checkbox", version = "2.3.0") @JsModule("@vaadin/vaadin-checkbox/src/vaadin-checkbox.js") public abstract class GeneratedVaadinCheckbox, T> extends AbstractSinglePropertyField implements HasStyle, Focusable, ClickNotifier { /** *

* Description copied from corresponding location in WebComponent: *

*

* Specify that this control should have input focus when the page loads. *

* This property is not synchronized automatically from the client side, so * the returned value may not be the same as in client side. *

* * @return the {@code autofocus} property from the webcomponent */ protected boolean isAutofocusBoolean() { return getElement().getProperty("autofocus", false); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Specify that this control should have input focus when the page loads. *

* * @param autofocus * the boolean value to set */ protected void setAutofocus(boolean autofocus) { getElement().setProperty("autofocus", autofocus); } /** *

* Description copied from corresponding location in WebComponent: *

*

* If true, the user cannot interact with this element. *

* This property is not synchronized automatically from the client side, so * the returned value may not be the same as in client side. *

* * @return the {@code disabled} property from the webcomponent */ protected boolean isDisabledBoolean() { return getElement().getProperty("disabled", false); } /** *

* Description copied from corresponding location in WebComponent: *

*

* If true, the user cannot interact with this element. *

* * @param disabled * the boolean value to set */ protected void setDisabled(boolean disabled) { getElement().setProperty("disabled", disabled); } /** * This property is not synchronized automatically from the client side, so * the returned value may not be the same as in client side. * * @return the {@code name} property from the webcomponent */ protected String getNameString() { return getElement().getProperty("name"); } /** * @param name * the String value to set */ protected void setName(String name) { getElement().setProperty("name", name == null ? "" : name); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Indeterminate state of the checkbox when it's neither checked nor * unchecked, but undetermined. * https://developer.mozilla.org/en-US/docs/Web/ * HTML/Element/input/checkbox#Indeterminate_state_checkboxes *

* This property is synchronized automatically from client side when a * 'indeterminate-changed' event happens. *

* * @return the {@code indeterminate} property from the webcomponent */ @Synchronize(property = "indeterminate", value = "indeterminate-changed") protected boolean isIndeterminateBoolean() { return getElement().getProperty("indeterminate", false); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Indeterminate state of the checkbox when it's neither checked nor * unchecked, but undetermined. * https://developer.mozilla.org/en-US/docs/Web/ * HTML/Element/input/checkbox#Indeterminate_state_checkboxes *

* * @param indeterminate * the boolean value to set */ protected void setIndeterminate(boolean indeterminate) { getElement().setProperty("indeterminate", indeterminate); } @DomEvent("change") public static class ChangeEvent> extends ComponentEvent { public ChangeEvent(R source, boolean fromClient) { super(source, fromClient); } } /** * Adds a listener for {@code change} events fired by the webcomponent. * * @param listener * the listener * @return a {@link Registration} for removing the event listener */ @SuppressWarnings({ "rawtypes", "unchecked" }) protected Registration addChangeListener( ComponentEventListener> listener) { return addListener(ChangeEvent.class, (ComponentEventListener) listener); } public static class CheckedChangeEvent> extends ComponentEvent { public CheckedChangeEvent(R source, boolean fromClient) { super(source, fromClient); } } /** * Adds a listener for {@code checked-changed} events fired by the * webcomponent. * * @param listener * the listener * @return a {@link Registration} for removing the event listener */ protected Registration addCheckedChangeListener( ComponentEventListener> listener) { return getElement() .addPropertyChangeListener("checked", event -> listener.onComponentEvent( new CheckedChangeEvent((R) this, event.isUserOriginated()))); } public static class IndeterminateChangeEvent> extends ComponentEvent { private final boolean indeterminate; public IndeterminateChangeEvent(R source, boolean fromClient) { super(source, fromClient); this.indeterminate = source.isIndeterminateBoolean(); } public boolean isIndeterminate() { return indeterminate; } } /** * Adds a listener for {@code indeterminate-changed} events fired by the * webcomponent. * * @param listener * the listener * @return a {@link Registration} for removing the event listener */ protected Registration addIndeterminateChangeListener( ComponentEventListener> listener) { return getElement().addPropertyChangeListener("indeterminate", event -> listener.onComponentEvent( new IndeterminateChangeEvent((R) this, event.isUserOriginated()))); } /** * Constructs a new GeneratedVaadinCheckbox component with the given * arguments. * * @param initialValue * the initial value to set to the value * @param defaultValue * the default value to use if the value isn't defined * @param elementPropertyType * the type of the element property * @param presentationToModel * a function that converts a string value to a model value * @param modelToPresentation * a function that converts a model value to a string value * @param

* the property type */ public

GeneratedVaadinCheckbox(T initialValue, T defaultValue, Class

elementPropertyType, SerializableFunction presentationToModel, SerializableFunction modelToPresentation) { super("checked", defaultValue, elementPropertyType, presentationToModel, modelToPresentation); if (initialValue != null) { setModelValue(initialValue, false); setPresentationValue(initialValue); } } /** * Constructs a new GeneratedVaadinCheckbox component with the given * arguments. * * @param initialValue * the initial value to set to the value * @param defaultValue * the default value to use if the value isn't defined * @param acceptNullValues * whether null is accepted as a model value */ public GeneratedVaadinCheckbox(T initialValue, T defaultValue, boolean acceptNullValues) { super("checked", defaultValue, acceptNullValues); if (initialValue != null) { setModelValue(initialValue, false); setPresentationValue(initialValue); } } /** * Constructs a new GeneratedVaadinCheckbox component with the given * arguments. * * @param initialValue * the initial value to set to the value * @param defaultValue * the default value to use if the value isn't defined * @param elementPropertyType * the type of the element property * @param presentationToModel * a function that accepts this component and a property value * and returns a model value * @param modelToPresentation * a function that accepts this component and a model value and * returns a property value * @param

* the property type */ public

GeneratedVaadinCheckbox(T initialValue, T defaultValue, Class

elementPropertyType, SerializableBiFunction presentationToModel, SerializableBiFunction modelToPresentation) { super("checked", defaultValue, elementPropertyType, presentationToModel, modelToPresentation); if (initialValue != null) { setModelValue(initialValue, false); setPresentationValue(initialValue); } } /** * Default constructor. */ public GeneratedVaadinCheckbox() { this(null, null, null, (SerializableFunction) null, (SerializableFunction) null); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy