Class BrowserColumnPreferenceStorage
java.lang.Object
org.vaadin.addons.antlerflow.grid.columns.storage.BrowserColumnPreferenceStorage
- All Implemented Interfaces:
Serializable, ColumnPreferenceStorage
Stores preferences in the browser's Web Storage (
localStorage or
sessionStorage) as {"version":1,"columns":{"<id>":true|false}}. Use ColumnPreferenceStorage.localStorage() or ColumnPreferenceStorage.sessionStorage().
Storage errors in the browser (private mode, quota, corrupted JSON) are handled there: a failed read yields an empty preference and a failed write leaves the choice in effect for the current view only.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear(ColumnPreferenceContext context) Removes the preference stored under the context's key, if any.getArea()Returns the Web Storage area:localStorageorsessionStorage.voidload(ColumnPreferenceContext context, com.vaadin.flow.function.SerializableConsumer<Map<String, Boolean>> onLoaded) Loads the preference and passes it toonLoaded, possibly later (for example after a browser round trip).voidsave(ColumnPreferenceContext context, Map<String, Boolean> visibility) Stores the preference, replacing any previous one under the same key.
-
Method Details
-
getArea
Returns the Web Storage area:localStorageorsessionStorage. -
load
public void load(ColumnPreferenceContext context, com.vaadin.flow.function.SerializableConsumer<Map<String, Boolean>> onLoaded) Description copied from interface:ColumnPreferenceStorageLoads the preference and passes it toonLoaded, possibly later (for example after a browser round trip). Pass an empty map when nothing is stored. Must be called on the UI thread (with the session locked), as the grid applies the result directly.- Specified by:
loadin interfaceColumnPreferenceStorage
-
save
Description copied from interface:ColumnPreferenceStorageStores the preference, replacing any previous one under the same key.- Specified by:
savein interfaceColumnPreferenceStorage
-
clear
Description copied from interface:ColumnPreferenceStorageRemoves the preference stored under the context's key, if any.- Specified by:
clearin interfaceColumnPreferenceStorage
-