Example usage for com.google.gwt.storage.client StorageMap remove

List of usage examples for com.google.gwt.storage.client StorageMap remove

Introduction

In this page you can find the example usage for com.google.gwt.storage.client StorageMap remove.

Prototype

@Override
public String remove(Object key) 

Source Link

Document

Removes the key/value pair from the Storage.

Usage

From source file:com.data2semantics.yasgui.client.helpers.LocalStorageHelper.java

License:Open Source License

/**
 * Get value from local storage for given key. Appends current domain name to key, 
 * as we want different local storage when yasgui is loaded via iframe. 
 * /*from w  w  w  .  jav  a  2 s . c o m*/
 * @param key
 * @return
 */
private static String getFromLocalStorage(String key) {
    StorageMap storageMap = getStorageMap();
    String domain = Helper.getCurrentHost();
    if (storageMap.containsKey(domain + "_" + key)) {
        return storageMap.get(domain + "_" + key);
    } else if (storageMap.containsKey(key)) {
        //for backwards compatability (i.e. the time when we didnt use the basedomain as part of the key)
        String value = storageMap.get(key);
        setInLocalStorage(key, value); //settings it again stores it under correct key with domain name
        storageMap.remove(key);//remove old key
        return value;
    }
    return null;
}