Class WhatsappButton
java.lang.Object
com.vaadin.flow.component.Component
com.flowingcode.vaadin.addons.whatsappbutton.WhatsappButton
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
@Tag("fc-whatsapp-button")
@NpmPackage(value="@flowingcode/fc-whatsapp-button",
version="2.0.0")
@JsModule("@flowingcode/fc-whatsapp-button/dist/src/fc-whatsapp-button.js")
public class WhatsappButton
extends com.vaadin.flow.component.Component
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the dial code.Returns an invite code.getLabel()Returns the button's label.getPhone()Returns the phone number.getText()Returns the message text.booleanReturns whether the button's icon is leading or not.booleanReturns whether redirect is enabled or not.booleanReturns whether responsive is enabled or not.booleanReturns whether dialog should be shown on button click.voidsetDialCode(String dialCode) Sets a dial code number.voidsetInviteCode(String inviteCode) Sets an invite code.voidSets the button's label.voidsetLeadingIcon(boolean leading) Sets if button's icon should be in leading position or not.voidSets a phone number.voidsetRedirect(boolean redirect) Sets redirect option.voidsetResponsive(boolean responsive) Sets responsive option.voidsetShowDialog(boolean dialog) Sets dialog option.voidSets the message text to display.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
WhatsappButton
public WhatsappButton()
-
-
Method Details
-
getPhone
Returns the phone number.- Returns:
- String return the phone number
-
setPhone
Sets a phone number.- Parameters:
phone- the phone number to set
-
getDialCode
Returns the dial code.- Returns:
- String return the dialCode
-
setDialCode
Sets a dial code number.- Parameters:
dialCode- the dialCode to set
-
getLabel
Returns the button's label.- Returns:
- String return the label
-
setLabel
Sets the button's label. Default value is "Let's chat".- Parameters:
label- the label to set
-
getText
Returns the message text.- Returns:
- String return the text
-
setInviteCode
Sets an invite code.- Parameters:
invite- code the invite code to set
-
getInviteCode
Returns an invite code.- Returns:
- String return the invite code
-
setText
Sets the message text to display. Default value is "Hi!".- Parameters:
text- the message text to set
-
isLeadingIcon
public boolean isLeadingIcon()Returns whether the button's icon is leading or not.- Returns:
- boolean true if icon is leading
-
setLeadingIcon
public void setLeadingIcon(boolean leading) Sets if button's icon should be in leading position or not. By default icon is trailing.- Parameters:
leading- true to enable leading
-
isRedirect
public boolean isRedirect()Returns whether redirect is enabled or not.- Returns:
- boolean the redirect value
-
setRedirect
public void setRedirect(boolean redirect) Sets redirect option. This value should be true when button is use in not mobile devices.- Parameters:
redirect- true to enable redirect
-
isResponsive
public boolean isResponsive()Returns whether responsive is enabled or not.- Returns:
- boolean the responsive value
-
setResponsive
public void setResponsive(boolean responsive) Sets responsive option.- Parameters:
redirect- true to enable redirect
-
isShowDialog
public boolean isShowDialog()Returns whether dialog should be shown on button click.- Returns:
- boolean the show dialog value
-
setShowDialog
public void setShowDialog(boolean dialog) Sets dialog option. If true, a dialog will show on button click indicating whatsapp is opening.- Parameters:
redirect- true to enable redirect
-