本文整理汇总了Java中com.google.gwt.storage.client.Storage.isLocalStorageSupported方法的典型用法代码示例。如果您正苦于以下问题:Java Storage.isLocalStorageSupported方法的具体用法?Java Storage.isLocalStorageSupported怎么用?Java Storage.isLocalStorageSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.storage.client.Storage
的用法示例。
在下文中一共展示了Storage.isLocalStorageSupported方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTokenStore
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
/**
* Returns the correct {@link TokenStore} implementation to use based on
* browser support for localStorage.
*/
// TODO(jasonhall): This will not result in CookieStoreImpl being compiled out
// for browsers that support localStorage, and vice versa? If not, this should
// be a deferred binding rule.
private static TokenStoreImpl getTokenStore() {
return Storage.isLocalStorageSupported() ? new TokenStoreImpl() : new CookieStoreImpl();
}
示例2: getCurrentThemeId
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
@Override
public String getCurrentThemeId() {
if (currentThemeId == null
&& Storage.isLocalStorageSupported()
&& Storage.getLocalStorageIfSupported().getItem(THEME_STORAGE) != null) {
setCurrentThemeId(Storage.getLocalStorageIfSupported().getItem(THEME_STORAGE));
}
return currentThemeId;
}
示例3: getFieldValue
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
protected String getFieldValue(String field, String defaultValue) {
if (Storage.isLocalStorageSupported()) {
Storage storage = Storage.getLocalStorageIfSupported();
String value = storage.getItem(field);
return (value != null) ? value : defaultValue;
} else {
return getCookie(field, defaultValue);
}
}
示例4: saveField
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
protected void saveField(String field, String value) {
if (Storage.isLocalStorageSupported()) {
Storage storage = Storage.getLocalStorageIfSupported();
storage.setItem(field, value);
} else {
saveCookie(value, field);
}
}
示例5: getTokenStore
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
/**
* Returns the correct {@link TokenStore} implementation to use based on browser support for localStorage.
*/
// TODO(jasonhall): This will not result in CookieStoreImpl being compiled out
// for browsers that support localStorage, and vice versa? If not, this should
// be a deferred binding rule.
private static TokenStoreImpl getTokenStore() {
return Storage.isLocalStorageSupported() ? new TokenStoreImpl() : new CookieStoreImpl();
}
示例6: getLocalStorage
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
/**
* Returns a Local Storage.
*
* @return the localStorage instance, or <code>null</code> if Web Storage is NOT supported.
*/
public static StorageExt getLocalStorage() {
if (localStorage == null && Storage.isLocalStorageSupported()) {
localStorage = new StorageExt(Storage.getLocalStorageIfSupported());
}
return localStorage;
}
示例7: StorageBackend
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
StorageBackend() {
storageBackend =
(Storage.isLocalStorageSupported())
? Storage.getLocalStorageIfSupported()
: Storage.getSessionStorageIfSupported();
}
示例8: loadStorage
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
protected boolean loadStorage() {
boolean result = false;
if (Storage.isLocalStorageSupported()) {
Storage storage = Storage.getLocalStorageIfSupported();
Collection<String> cookies = null;
if (Cookies.isCookieEnabled()) {
cookies = Cookies.getCookieNames();
}
for (Field f : getFields()) {
String value = storage.getItem(f.name);
if (value != null) {
// do nothing
} else if ((cookies != null) && (cookies.contains(f.name))) {
value = getCookie(f.name, f.defaultValue);
storage.setItem(f.name, value);
Cookies.removeCookie(f.name);
} else {
value = f.defaultValue;
storage.setItem(f.name, value);
}
setFieldValue(f, value);
}
result = true;
}
return result;
}
示例9: isSupported
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
/**
* @return localStorage is supported
*/
private boolean isSupported() {
return !getState().simulateNotSupported && Storage.isLocalStorageSupported();
}
示例10: isPerm
import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public static boolean isPerm() { return Storage.isLocalStorageSupported(); }