Class ToastOptionsBuilder
- java.lang.Object
-
- org.pepstock.charba.client.commons.AbstractBaseBuilder
-
- org.pepstock.charba.client.utils.toast.ToastOptionsBuilder
-
- All Implemented Interfaces:
IsBuilder
public final class ToastOptionsBuilder extends AbstractBaseBuilder
Comfortable object to createToaster
options by a builder.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ToastOptions
build()
Returns a configured toast options.static ToastOptionsBuilder
create()
Returns new builder instance.static ToastOptionsBuilder
create(IsToastType type)
Returns new builder instance, setting the toast type.ToastOptionsBuilder
setActionBackgroundColor(String backgroundColor)
Sets the background color of action.ToastOptionsBuilder
setActionBackgroundColor(IsColor backgroundColor)
Sets the background color of action.ToastOptionsBuilder
setActionBorderColor(String borderColor)
Sets the border color of action.ToastOptionsBuilder
setActionBorderColor(IsColor borderColor)
Sets the border color of action.ToastOptionsBuilder
setActionBorderRadius(int borderRadius)
Sets the border radius (in pixels) of toast action.ToastOptionsBuilder
setActionBorderStyle(BorderStyle style)
Sets the border style set for the action element.ToastOptionsBuilder
setActionBorderWidth(int borderWidth)
Sets the border width of action.ToastOptionsBuilder
setActionColor(String color)
Sets the font color of action.ToastOptionsBuilder
setActionColor(IsColor color)
Sets the font color of action.ToastOptionsBuilder
setActionFontFamily(String family)
Sets the font family, follows CSS font-family options of action.ToastOptionsBuilder
setActionFontLineHeight(double lineHeight)
Sets the line height of action.ToastOptionsBuilder
setActionFontLineHeight(String lineHeight)
Sets the line height of action.ToastOptionsBuilder
setActionFontSize(int size)
Sets the font size of action.ToastOptionsBuilder
setActionFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e.ToastOptionsBuilder
setActionFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of action.ToastOptionsBuilder
setActions(List<ActionItem> actions)
Sets the actions to the toast.ToastOptionsBuilder
setActions(ActionItem... actions)
Sets the actions to the toast.ToastOptionsBuilder
setAlign(Align align)
Sets the alignment of the toast action.ToastOptionsBuilder
setAutoHide(boolean hide)
Sets whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked.ToastOptionsBuilder
setBorderRadius(int borderRadius)
Sets the border radius (in pixels) of toast container.ToastOptionsBuilder
setClickEventHandler(ClickEventHandler clickEventHandler)
Sets the CLICK event hander.ToastOptionsBuilder
setCloseHandler(CloseHandler closeHandler)
Sets the CLOSE hander.ToastOptionsBuilder
setHideProgressBar(boolean hide)
Setstrue
whether to hide the progress bar.ToastOptionsBuilder
setHideShadow(boolean hide)
Setstrue
whether to hide the shadow of toast.ToastOptionsBuilder
setIcon(Img icon)
Sets the icon image set for toast.ToastOptionsBuilder
setLabelColor(String color)
Sets the font color of label.ToastOptionsBuilder
setLabelColor(IsColor color)
Sets the font color of label.ToastOptionsBuilder
setLabelFontFamily(String family)
Sets the font family, follows CSS font-family options of label.ToastOptionsBuilder
setLabelFontLineHeight(double lineHeight)
Sets the line height of label.ToastOptionsBuilder
setLabelFontLineHeight(String lineHeight)
Sets the line height of label.ToastOptionsBuilder
setLabelFontSize(int size)
Sets the font size of label.ToastOptionsBuilder
setLabelFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e.ToastOptionsBuilder
setLabelFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of label.ToastOptionsBuilder
setModifierKey(ModifierKey modifierKey)
Sets the modifier key to close the toast by clicking on it.ToastOptionsBuilder
setOpenHandler(OpenHandler openHandler)
Sets the OPEN hander.ToastOptionsBuilder
setProgressBarHeight(int height)
Sets the height (in pixels) of the toast progress bar.ToastOptionsBuilder
setProgressBarType(IsProgressBarType type)
Sets the type of the toast progress bar.ToastOptionsBuilder
setTimeout(int timeout)
Sets how long the toast notification should last.ToastOptionsBuilder
setTitleColor(String color)
Sets the font color of title.ToastOptionsBuilder
setTitleColor(IsColor color)
Sets the font color of title.ToastOptionsBuilder
setTitleFontFamily(String family)
Sets the font family, follows CSS font-family options of title.ToastOptionsBuilder
setTitleFontLineHeight(double lineHeight)
Sets the line height of title.ToastOptionsBuilder
setTitleFontLineHeight(String lineHeight)
Sets the line height of title.ToastOptionsBuilder
setTitleFontSize(int size)
Sets the font size of title.ToastOptionsBuilder
setTitleFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e.ToastOptionsBuilder
setTitleFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of title.ToastOptionsBuilder
setType(IsToastType type)
Sets the type of the toast.-
Methods inherited from class org.pepstock.charba.client.commons.AbstractBaseBuilder
isBuilt, setBuilt
-
-
-
-
Method Detail
-
create
public static ToastOptionsBuilder create()
Returns new builder instance.- Returns:
- new builder instance
-
create
public static ToastOptionsBuilder create(IsToastType type)
Returns new builder instance, setting the toast type.- Parameters:
type
- the type of the toast- Returns:
- new builder instance
-
build
public ToastOptions build()
Returns a configured toast options.- Returns:
- a configured toast options.
-
setTitleColor
public ToastOptionsBuilder setTitleColor(IsColor color)
Sets the font color of title.- Parameters:
color
- font color of title- Returns:
- toast options builder instance
-
setTitleColor
public ToastOptionsBuilder setTitleColor(String color)
Sets the font color of title.- Parameters:
color
- font color of title- Returns:
- toast options builder instance
-
setTitleFontSize
public ToastOptionsBuilder setTitleFontSize(int size)
Sets the font size of title.- Parameters:
size
- the font size of title.- Returns:
- toast options builder instance
-
setTitleFontStyle
public ToastOptionsBuilder setTitleFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of title.- Parameters:
style
- Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of title.- Returns:
- toast options builder instance
-
setTitleFontFamily
public ToastOptionsBuilder setTitleFontFamily(String family)
Sets the font family, follows CSS font-family options of title.- Parameters:
family
- Font family, follows CSS font-family options of title.- Returns:
- toast options builder instance
-
setTitleFontWeight
public ToastOptionsBuilder setTitleFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of title.- Parameters:
weight
- font weight, follows CSS font-style-weight options of title.- Returns:
- toast options builder instance
-
setTitleFontLineHeight
public ToastOptionsBuilder setTitleFontLineHeight(double lineHeight)
Sets the line height of title.- Parameters:
lineHeight
- the line height of title.- Returns:
- toast options builder instance
-
setTitleFontLineHeight
public ToastOptionsBuilder setTitleFontLineHeight(String lineHeight)
Sets the line height of title.- Parameters:
lineHeight
- the line height of title.- Returns:
- toast options builder instance
-
setLabelColor
public ToastOptionsBuilder setLabelColor(IsColor color)
Sets the font color of label.- Parameters:
color
- font color of label- Returns:
- toast options builder instance
-
setLabelColor
public ToastOptionsBuilder setLabelColor(String color)
Sets the font color of label.- Parameters:
color
- font color of label- Returns:
- toast options builder instance
-
setLabelFontSize
public ToastOptionsBuilder setLabelFontSize(int size)
Sets the font size of label.- Parameters:
size
- the font size of label.- Returns:
- toast options builder instance
-
setLabelFontStyle
public ToastOptionsBuilder setLabelFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of label.- Parameters:
style
- Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of label.- Returns:
- toast options builder instance
-
setLabelFontFamily
public ToastOptionsBuilder setLabelFontFamily(String family)
Sets the font family, follows CSS font-family options of label.- Parameters:
family
- Font family, follows CSS font-family options of label.- Returns:
- toast options builder instance
-
setLabelFontWeight
public ToastOptionsBuilder setLabelFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of label.- Parameters:
weight
- font weight, follows CSS font-style-weight options of label.- Returns:
- toast options builder instance
-
setLabelFontLineHeight
public ToastOptionsBuilder setLabelFontLineHeight(double lineHeight)
Sets the line height of label.- Parameters:
lineHeight
- the line height of label.- Returns:
- toast options builder instance
-
setLabelFontLineHeight
public ToastOptionsBuilder setLabelFontLineHeight(String lineHeight)
Sets the line height of label.- Parameters:
lineHeight
- the line height of label.- Returns:
- toast options builder instance
-
setActionColor
public ToastOptionsBuilder setActionColor(IsColor color)
Sets the font color of action.- Parameters:
color
- font color of action- Returns:
- toast options builder instance
-
setActionColor
public ToastOptionsBuilder setActionColor(String color)
Sets the font color of action.- Parameters:
color
- font color of action- Returns:
- toast options builder instance
-
setActionFontSize
public ToastOptionsBuilder setActionFontSize(int size)
Sets the font size of action.- Parameters:
size
- the font size of action.- Returns:
- toast options builder instance
-
setActionFontStyle
public ToastOptionsBuilder setActionFontStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of action.- Parameters:
style
- Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit) of action.- Returns:
- toast options builder instance
-
setActionFontFamily
public ToastOptionsBuilder setActionFontFamily(String family)
Sets the font family, follows CSS font-family options of action.- Parameters:
family
- Font family, follows CSS font-family options of action.- Returns:
- toast options builder instance
-
setActionFontWeight
public ToastOptionsBuilder setActionFontWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options of action.- Parameters:
weight
- font weight, follows CSS font-style-weight options of action.- Returns:
- toast options builder instance
-
setActionFontLineHeight
public ToastOptionsBuilder setActionFontLineHeight(double lineHeight)
Sets the line height of action.- Parameters:
lineHeight
- the line height of action.- Returns:
- toast options builder instance
-
setActionFontLineHeight
public ToastOptionsBuilder setActionFontLineHeight(String lineHeight)
Sets the line height of action.- Parameters:
lineHeight
- the line height of action.- Returns:
- toast options builder instance
-
setActionBackgroundColor
public ToastOptionsBuilder setActionBackgroundColor(IsColor backgroundColor)
Sets the background color of action.- Parameters:
backgroundColor
- the background color of action.- Returns:
- toast options builder instance
-
setActionBackgroundColor
public ToastOptionsBuilder setActionBackgroundColor(String backgroundColor)
Sets the background color of action.- Parameters:
backgroundColor
- the background color of action.- Returns:
- toast options builder instance
-
setActionBorderWidth
public ToastOptionsBuilder setActionBorderWidth(int borderWidth)
Sets the border width of action.- Parameters:
borderWidth
- the border width of action.- Returns:
- toast options builder instance
-
setActionBorderColor
public ToastOptionsBuilder setActionBorderColor(IsColor borderColor)
Sets the border color of action.- Parameters:
borderColor
- the border color of action.- Returns:
- toast options builder instance
-
setActionBorderColor
public ToastOptionsBuilder setActionBorderColor(String borderColor)
Sets the border color of action.- Parameters:
borderColor
- the border color of action.- Returns:
- toast options builder instance
-
setActionBorderRadius
public ToastOptionsBuilder setActionBorderRadius(int borderRadius)
Sets the border radius (in pixels) of toast action.- Parameters:
borderRadius
- the border radius (in pixels) of toast action- Returns:
- toast options builder instance
-
setActionBorderStyle
public ToastOptionsBuilder setActionBorderStyle(BorderStyle style)
Sets the border style set for the action element.- Parameters:
style
- the border styles set for the action element.- Returns:
- toast options builder instance
-
setType
public ToastOptionsBuilder setType(IsToastType type)
Sets the type of the toast.- Parameters:
type
- the type of the toast- Returns:
- toast options builder instance
-
setProgressBarType
public ToastOptionsBuilder setProgressBarType(IsProgressBarType type)
Sets the type of the toast progress bar.- Parameters:
type
- the type of the toast progress bar- Returns:
- toast options builder instance
-
setHideProgressBar
public ToastOptionsBuilder setHideProgressBar(boolean hide)
Setstrue
whether to hide the progress bar.- Parameters:
hide
-true
whether to hide the progress bar- Returns:
- toast options builder instance
-
setAutoHide
public ToastOptionsBuilder setAutoHide(boolean hide)
Sets whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked.- Parameters:
hide
- whether to make the toast notification sticky, which means that the toast notification will never auto dismiss until clicked- Returns:
- toast options builder instance
-
setTimeout
public ToastOptionsBuilder setTimeout(int timeout)
Sets how long the toast notification should last.- Parameters:
timeout
- how long the toast notification should last- Returns:
- toast options builder instance
-
setIcon
public ToastOptionsBuilder setIcon(Img icon)
Sets the icon image set for toast.- Parameters:
icon
- the icon image set for toast- Returns:
- toast options builder instance
-
setBorderRadius
public ToastOptionsBuilder setBorderRadius(int borderRadius)
Sets the border radius (in pixels) of toast container.- Parameters:
borderRadius
- the border radius (in pixels) of toast container- Returns:
- toast options builder instance
-
setActions
public ToastOptionsBuilder setActions(ActionItem... actions)
Sets the actions to the toast.- Parameters:
actions
- the actions to the toast- Returns:
- toast options builder instance
-
setActions
public ToastOptionsBuilder setActions(List<ActionItem> actions)
Sets the actions to the toast.- Parameters:
actions
- the actions to the toast- Returns:
- toast options builder instance
-
setProgressBarHeight
public ToastOptionsBuilder setProgressBarHeight(int height)
Sets the height (in pixels) of the toast progress bar.- Parameters:
height
- the height (in pixels) of the toast progress bar- Returns:
- toast options builder instance
-
setHideShadow
public ToastOptionsBuilder setHideShadow(boolean hide)
Setstrue
whether to hide the shadow of toast.- Parameters:
hide
-true
whether the shadow of toast- Returns:
- toast options builder instance
-
setModifierKey
public ToastOptionsBuilder setModifierKey(ModifierKey modifierKey)
Sets the modifier key to close the toast by clicking on it.- Parameters:
modifierKey
- the modifier key to close the toast by clicking on it- Returns:
- toast options builder instance
-
setAlign
public ToastOptionsBuilder setAlign(Align align)
Sets the alignment of the toast action.- Parameters:
align
- the alignment of the toast action- Returns:
- toast options builder instance
-
setClickEventHandler
public ToastOptionsBuilder setClickEventHandler(ClickEventHandler clickEventHandler)
Sets the CLICK event hander.- Parameters:
clickEventHandler
- the CLICK event hander.- Returns:
- toast options builder instance
-
setOpenHandler
public ToastOptionsBuilder setOpenHandler(OpenHandler openHandler)
Sets the OPEN hander.- Parameters:
openHandler
- the OPEN hander.- Returns:
- toast options builder instance
-
setCloseHandler
public ToastOptionsBuilder setCloseHandler(CloseHandler closeHandler)
Sets the CLOSE hander.- Parameters:
closeHandler
- the CLOSE hander.- Returns:
- toast options builder instance
-
-