/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * Opens the notification. * </p> */ protected void open() { getElement().callFunction("open"); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * Closes the notification. * </p> */ protected void close() { getElement().callFunction("close"); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * True if the notification is currently displayed. * </p> * * @param opened * the boolean value to set */ protected void setOpened(boolean opened) { getElement().setProperty("opened", opened); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * The duration in milliseconds to show the notification. Set to {@code 0} * or a negative number to disable the notification auto-closing. * </p> * * @param duration * the double value to set */ protected void setDuration(double duration) { getElement().setProperty("duration", duration); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * 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} * </p> * * @param position * the String value to set */ protected void setPosition(String position) { getElement().setProperty("position", position == null ? "" : position); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * 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} * <p> * This property is not synchronized automatically from the client side, so * the returned value may not be the same as in client side. * </p> * * @return the {@code position} property from the webcomponent */ protected String getPositionString() { return getElement().getProperty("position"); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * The duration in milliseconds to show the notification. Set to {@code 0} * or a negative number to disable the notification auto-closing. * <p> * This property is not synchronized automatically from the client side, so * the returned value may not be the same as in client side. * </p> * * @return the {@code duration} property from the webcomponent */ protected double getDurationDouble() { return getElement().getProperty("duration", 0.0); }
/** * <p> * Description copied from corresponding location in WebComponent: * </p> * <p> * True if the notification is currently displayed. * <p> * This property is synchronized automatically from client side when a * 'opened-changed' event happens. * </p> * * @return the {@code opened} property from the webcomponent */ @Synchronize(property = "opened", value = "opened-changed") protected boolean isOpenedBoolean() { return getElement().getProperty("opened", false); }
/** * 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<OpenedChangeEvent<R>> listener) { return getElement() .addPropertyChangeListener("opened", event -> listener.onComponentEvent( new OpenedChangeEvent<R>((R) this, event.isUserOriginated()))); } }