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


Java Storage.isLocalStorageSupported方法代码示例

本文整理汇总了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();
}
 
开发者ID:chetsmartboy,项目名称:gwt-oauth2,代码行数:11,代码来源:AuthImpl.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:ThemeAgentImpl.java

示例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);
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:11,代码来源:BasePanel.java

示例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);
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:9,代码来源:BasePanel.java

示例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();
}
 
开发者ID:reinert,项目名称:requestor,代码行数:10,代码来源:AuthImpl.java

示例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;
}
 
开发者ID:seanchenxi,项目名称:gwt-storage,代码行数:12,代码来源:StorageExt.java

示例7: StorageBackend

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
StorageBackend() {
  storageBackend =
      (Storage.isLocalStorageSupported())
          ? Storage.getLocalStorageIfSupported()
          : Storage.getSessionStorageIfSupported();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:LocalComments.java

示例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;
	}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:36,代码来源:BasePanel.java

示例9: isSupported

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
/**
 * @return localStorage is supported
 */
private boolean isSupported() {
	return !getState().simulateNotSupported && Storage.isLocalStorageSupported();
}
 
开发者ID:maxschuster,项目名称:Vaadin-LocalStorage,代码行数:7,代码来源:LocalStorageConnector.java

示例10: isPerm

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public static boolean isPerm() { return Storage.isLocalStorageSupported(); } 
开发者ID:lsst,项目名称:firefly,代码行数:2,代码来源:BrowserCache.java


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