本文整理汇总了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);
}
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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));
//}
}
示例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);
}
}
}