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

com.vaadin.flow.component.notification.GeneratedVaadinNotification Maven / Gradle / Ivy

There is a newer version: 24.6.0
Show newest version
/*
 * Copyright 2000-2017 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.notification;

import javax.annotation.Generated;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.HtmlImport;
import com.vaadin.flow.component.Synchronize;
import com.vaadin.flow.component.ComponentEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.shared.Registration;
import com.vaadin.flow.component.Component;

/**
 * 

* Description copied from corresponding location in WebComponent: *

*

* {@code } is a Polymer 2 element providing accessible and * customizable notifications (toasts). *

*

* {@code } *

*/ @Generated({ "Generator: com.vaadin.generator.ComponentGenerator#1.0-SNAPSHOT", "WebComponent: Vaadin.NotificationElement#1.0.0", "Flow#1.0-SNAPSHOT" }) @Tag("vaadin-notification") @HtmlImport("frontend://bower_components/vaadin-notification/src/vaadin-notification.html") public abstract class GeneratedVaadinNotification> extends Component { /** *

* Description copied from corresponding location in WebComponent: *

*

* The duration in milliseconds to show the notification. Set to {@code 0} * or a negative number to disable the notification auto-closing. *

* 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 duration} property from the webcomponent */ protected double getDurationDouble() { return getElement().getProperty("duration", 0.0); } /** *

* Description copied from corresponding location in WebComponent: *

*

* The duration in milliseconds to show the notification. Set to {@code 0} * or a negative number to disable the notification auto-closing. *

* * @param duration * the double value to set */ protected void setDuration(double duration) { getElement().setProperty("duration", duration); } /** *

* Description copied from corresponding location in WebComponent: *

*

* True if the notification is currently displayed. *

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

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

* Description copied from corresponding location in WebComponent: *

*

* True if the notification is currently displayed. *

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

* Description copied from corresponding location in WebComponent: *

*

* Alignment of the notification in the viewport Valid values are * {@code top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch} *

* 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 position} property from the webcomponent */ protected String getPositionString() { return getElement().getProperty("position"); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Alignment of the notification in the viewport Valid values are * {@code top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch} *

* * @param position * the String value to set */ protected void setPosition(String position) { getElement().setProperty("position", position == null ? "" : position); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Opens the notification. *

*/ protected void open() { getElement().callFunction("open"); } /** *

* Description copied from corresponding location in WebComponent: *

*

* Closes the notification. *

*/ protected void close() { getElement().callFunction("close"); } public static class OpenedChangeEvent> extends ComponentEvent { private final boolean opened; public OpenedChangeEvent(R source, boolean fromClient) { super(source, fromClient); this.opened = source.isOpenedBoolean(); } public boolean isOpened() { return opened; } } /** * Adds a listener for {@code opened-changed} events fired by the * webcomponent. * * @param listener * the listener * @return a {@link Registration} for removing the event listener */ protected Registration addOpenedChangeListener( ComponentEventListener> listener) { return getElement() .addPropertyChangeListener("opened", event -> listener.onComponentEvent( new OpenedChangeEvent((R) this, event.isUserOriginated()))); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy