Package org.vaadin.firitin.util
Class BrowserCookie
java.lang.Object
org.vaadin.firitin.util.BrowserCookie
A helper that provides access to browser cookies.
- Author:
 - Matti Tahvonen
 
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindValueToCookie(com.vaadin.flow.component.HasValue<? extends com.vaadin.flow.component.HasValue.ValueChangeEvent<String>, String> field, String name) Binds a HasValue<String> to a cookie that lives for a month.static <E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<V>,V> 
voidbindValueToCookie(com.vaadin.flow.component.HasValue<E, V> field, String name, BrowserCookie.Callback cb) Binds a HasValue<V> to a cookie that lives for a month.static voiddetectCookieValue(String key, BrowserCookie.Callback callback) static voidstatic voidstatic voidsetCookie(String key, String value, String path, LocalDateTime expirationTime) static voidsetCookie(String key, String value, LocalDateTime expirationTime)  
- 
Constructor Details
- 
BrowserCookie
public BrowserCookie() 
 - 
 - 
Method Details
- 
setCookie
 - 
setCookie
 - 
setCookie
 - 
setCookie
 - 
detectCookieValue
 - 
bindValueToCookie
public static <E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<V>,V> void bindValueToCookie(com.vaadin.flow.component.HasValue<E, V> field, String name, BrowserCookie.Callback cb) Binds a HasValue<V> to a cookie that lives for a month. The cookies value is updated via a ValueChangeListener.- Type Parameters:
 E- the type of the value change event fired by fieldV- The value-type of the HasValue<>- Parameters:
 field- The HasValue<V> that gets bound.name- The name of the cookiecb- A BrowserCookie.Callback that gets called with the actual value of the cookie. The value is guaranteed to be not null.- Throws:
 IllegalArgumentException- if field or name are null or if name is empty.
 - 
bindValueToCookie
public static void bindValueToCookie(com.vaadin.flow.component.HasValue<? extends com.vaadin.flow.component.HasValue.ValueChangeEvent<String>, String> field, String name) Binds a HasValue<String> to a cookie that lives for a month. The cookies value is updated via a ValueChangeListener. Its crrent value is copied into the HasValue<String>.- Parameters:
 field- The HasValue<String> that gets bound.name- The name of the cookie- Throws:
 IllegalArgumentException- if field or name are null or if name is empty.
 
 -