当前位置: 首页>>代码示例>>Java>>正文


Java Storage.removeItem方法代码示例

本文整理汇总了Java中com.google.gwt.storage.client.Storage.removeItem方法的典型用法代码示例。如果您正苦于以下问题:Java Storage.removeItem方法的具体用法?Java Storage.removeItem怎么用?Java Storage.removeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.storage.client.Storage的用法示例。


在下文中一共展示了Storage.removeItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renameLocalStorage

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
protected void renameLocalStorage() {
	String name = getName();

	if (name != null) {
		final Storage s = getStorage();

		if (s != null) {
			final int i = storageList.getSelectedIndex();

			if (i < 0) {
				ApplicationPanel.showErrorDialog("Select a Storage entry");
			} else {
				String key = storageList.getValue(i);
				String value = s.getItem(key);
				storageList.removeItem(i);
				s.removeItem(key);
				key = STORAGE_KEY + name;
				s.setItem(key, value);
				storageList.insertItem(name, key, i);
			}
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:24,代码来源:SavePanel.java

示例2: setItem

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
@Override
public void setItem(String key, String data,
		int callback) {
	boolean supported = isSupported();
	String oldData = null;
	
	if (supported) {
		Storage s = Storage.getLocalStorageIfSupported();
		oldData = s.getItem(key);
		if (data != null) {
			s.setItem(key, data);
		} else {
			s.removeItem(key);
		}
	}
	
	if (callback > -1) {
		serverRpc.callLocalStorageItemCallback(callback, supported, key, oldData, data);
	}
}
 
开发者ID:maxschuster,项目名称:Vaadin-LocalStorage,代码行数:21,代码来源:LocalStorageConnector.java

示例3: setDatabaseUpdateDate

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public static void setDatabaseUpdateDate(String email, Date date) {
    final Storage storage = Storage.getLocalStorageIfSupported();
    if(storage != null) {
        final String item = email + ITEM_DATABASE_UPDATE_DATE;
        
        if(date != null) {
            storage.setItem(item, Long.toString(date.getTime()));
        } else {
            storage.removeItem(item);
        }
    }
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:13,代码来源:UpdateDates.java

示例4: set

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public static void set(String prefname, String prefvalue, boolean sessionScope) {

       if (sessionScope) {
            // put preference into session storage, if available
            // otherwise into local static map
            Storage sessionStorage = Storage.getSessionStorageIfSupported();
            if (sessionStorage != null) {
                //oldvalue = sessionStorage.getItem(PREFIX+prefname);
                if (prefvalue == null) {
                    sessionStorage.removeItem(PREFIX+prefname);
                } else {
                    sessionStorage.setItem(PREFIX+prefname, prefvalue);
                }
            } else {
                //oldvalue =  localPrefMap.get(prefname);
                localPrefMap.put(prefname, prefvalue);
            }
        }

        else {
            // check browser local storage
            Storage localStorage = Storage.getLocalStorageIfSupported();
            String oldvalue;
            if (localStorage != null) {
                oldvalue = localStorage.getItem(PREFIX+prefname);
                if (prefvalue == null) {
                    localStorage.removeItem(PREFIX+prefname);
                } else {
                    localStorage.setItem(PREFIX+prefname, prefvalue);
                }
            } else {
                oldvalue =  localPrefMap.get(prefname);
                localPrefMap.put(prefname, prefvalue);
            }
           if (notBulkUpdate && loginManager != null && loginManager.isLoggedIn()) {
               if ((prefvalue != null && !prefvalue.equals(oldvalue)) ||
                       (oldvalue != null && !oldvalue.equals(prefvalue))) {
                   // logged in user - also put preferences to db
                   loginManager.setPreference(prefname, prefvalue);
               }
           }
       }

        // no need to fire event
        // fire event if preference value has changed 
        //if ((prefvalue != null && !prefvalue.equals(oldvalue)) ||
        //        (oldvalue != null && !oldvalue.equals(prefvalue))) {
        //    HashMap<String,String> prefmap = new HashMap<String,String>(1);
        //    prefmap.put(prefname,prefvalue);
        //    WebEventManager.getAppEvManager().fireEvent(new WebEvent(Preferences.class, Name.PREFERENCE_UPDATE, prefmap));
        //}
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:53,代码来源:Preferences.java

示例5: deleteLocalStorage

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
protected void deleteLocalStorage() {
	final Storage s = getStorage();

	if (s != null) {
		final int i = storageList.getSelectedIndex();

		if (i < 0) {
			ApplicationPanel.showErrorDialog("Select a Storage entry");
		} else {
			String key = storageList.getValue(i);
			storageList.removeItem(i);
			s.removeItem(key);
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:16,代码来源:SavePanel.java


注:本文中的com.google.gwt.storage.client.Storage.removeItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。