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

com.github.fluorumlabs.disconnect.vaadin.ConfirmDialog Maven / Gradle / Ivy

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

import com.github.fluorumlabs.disconnect.core.annotations.WebComponent;
import com.github.fluorumlabs.disconnect.polymer.types.BooleanPropertyChangeEvent;
import com.github.fluorumlabs.disconnect.vaadin.elements.ConfirmDialogElement;
import com.github.fluorumlabs.disconnect.vaadin.mixins.HasElementMixin;
import com.github.fluorumlabs.disconnect.zero.component.*;
import com.github.fluorumlabs.disconnect.zero.observable.ObservableEvent;
import js.web.dom.Event;

import javax.annotation.Nullable;

/**
 * <vaadin-confirm-dialog> is a Web Component for showing alerts and asking for user confirmation.
 *
 * 
<vaadin-confirm-dialog on-confirm="_doConfirm">
 *  Sample confirmation question
 * </vaadin-confirm-dialog>
 * 
*

Styling

* The following Shadow DOM parts are available for styling the dialog parts: * * * * * * * * * * *
Part nameDescription
headerHeader of the confirmation dialog
messageContainer for the message of the dialog
footerContainer for the buttons
* See * ThemableMixin – how to apply styles for shadow parts * *

Custom content

* The following parts are available for replacement: * * * * * * * * * * * * *
Slot nameDescription
headerHeader of the confirmation dialog
messageContainer for the message of the dialog
cancel-buttonContainer for the Cancel button
reject-buttonContainer for the Reject button
confirm-buttonContainer for the Confirm button
* See examples of setting custom buttons into slots in the live demos. */ @WebComponent public class ConfirmDialog extends AbstractComponent implements HasElementMixin, HasSlots, HasStyle, HasComponents> { public ConfirmDialog() { super(ConfirmDialogElement.TAGNAME()); } /** * True if the overlay is currently displayed. */ public boolean opened() { return getNode().isOpened(); } /** * True if the overlay is currently displayed. */ public ConfirmDialog opened(boolean opened) { getNode().setOpened(opened); return this; } /** * Set the confirmation dialog title. */ @Nullable public String header() { return getNode().getHeader(); } /** * Set the confirmation dialog title. */ public ConfirmDialog header(String header) { getNode().setHeader(header); return this; } /** * Set the message or confirmation question. */ @Nullable public String message() { return getNode().getMessage(); } /** * Set the message or confirmation question. */ public ConfirmDialog message(String message) { getNode().setMessage(message); return this; } /** * Text displayed on confirm-button. */ @Nullable public String confirmText() { return getNode().getConfirmText(); } /** * Text displayed on confirm-button. */ public ConfirmDialog confirmText(String confirmText) { getNode().setConfirmText(confirmText); return this; } /** * Theme for a confirm-button. */ @Nullable public String confirmTheme() { return getNode().getConfirmTheme(); } /** * Theme for a confirm-button. */ public ConfirmDialog confirmTheme(String confirmTheme) { getNode().setConfirmTheme(confirmTheme); return this; } /** * Whether to show cancel button or not. */ public boolean reject() { return getNode().isReject(); } /** * Whether to show cancel button or not. */ public ConfirmDialog reject(boolean reject) { getNode().setReject(reject); return this; } /** * Text displayed on reject-button. */ @Nullable public String rejectText() { return getNode().getRejectText(); } /** * Text displayed on reject-button. */ public ConfirmDialog rejectText(String rejectText) { getNode().setRejectText(rejectText); return this; } /** * Theme for a reject-button. */ @Nullable public String rejectTheme() { return getNode().getRejectTheme(); } /** * Theme for a reject-button. */ public ConfirmDialog rejectTheme(String rejectTheme) { getNode().setRejectTheme(rejectTheme); return this; } /** * Whether to show cancel button or not. */ public boolean cancel() { return getNode().isCancel(); } /** * Whether to show cancel button or not. */ public ConfirmDialog cancel(boolean cancel) { getNode().setCancel(cancel); return this; } /** * Text displayed on cancel-button. */ @Nullable public String cancelText() { return getNode().getCancelText(); } /** * Text displayed on cancel-button. */ public ConfirmDialog cancelText(String cancelText) { getNode().setCancelText(cancelText); return this; } /** * Theme for a cancel-button. */ @Nullable public String cancelTheme() { return getNode().getCancelTheme(); } /** * Theme for a cancel-button. */ public ConfirmDialog cancelTheme(String cancelTheme) { getNode().setCancelTheme(cancelTheme); return this; } /** * cancel * fired when Cancel button or Escape key was pressed. */ public ObservableEvent cancelEvent() { return createEvent("cancel"); } /** * confirm * fired when Confirm button was pressed. */ public ObservableEvent confirmEvent() { return createEvent("confirm"); } /** * reject * fired when Reject button was pressed. */ public ObservableEvent rejectEvent() { return createEvent("reject"); } /** * Fired when the opened property changes. */ public ObservableEvent openedChangedEvent() { return createEvent("opened-changed"); } /** * Fired when the reject property changes. */ public ObservableEvent rejectChangedEvent() { return createEvent("reject-changed"); } /** * Fired when the cancel property changes. */ public ObservableEvent cancelChangedEvent() { return createEvent("cancel-changed"); } public HasSlots.Container headerSlot() { return slotted("header"); } public HasSlots.Container cancelButtonSlot() { return slotted("cancel-button"); } public HasSlots.Container rejectButtonSlot() { return slotted("reject-button"); } public HasSlots.Container confirmButtonSlot() { return slotted("confirm-button"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy