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


Java Storage.setItem方法代码示例

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


在下文中一共展示了Storage.setItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: saveLocalStorage

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

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

		if (i < 0) {
			ApplicationPanel.showErrorDialog("Select a Storage entry");
		} else {
			if (listener != null) {
				final FormData data = listener.getFormData();

				JSONObject obj = JsonUtil.toJSONObject(data);
				String key = storageList.getValue(i);
				s.setItem(key, obj.toString());
				
				ApplicationPanel.showInfoDialog("Configuration Saved.");
			}
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:22,代码来源:SavePanel.java

示例3: createLocalId

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public final static int createLocalId()
{
	Storage storage = Storage.getLocalStorageIfSupported();
	if( storage == null )
		return 0;

	int increment = 0;
	String incrementString = storage.getItem( LOCAL_CURRENT_ID_INCREMENT );
	try
	{
		increment = Integer.parseInt( incrementString );
	}
	catch( Exception e )
	{
	}

	increment += 1;

	storage.setItem( LOCAL_CURRENT_ID_INCREMENT, increment + "" );

	return -increment;
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:23,代码来源:SQLite.java

示例4: writeToHTML5Localstore

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public void writeToHTML5Localstore()
{
   final Storage localStorage = Storage.getLocalStorageIfSupported();
   if (localStorage != null)
   {
      JSONStructure jsonStructure = new JSONStructure(0);
      try
      {
         new FavouriteBusStationListMarshaller().marschall(this, jsonStructure);
         String tmp = jsonStructure.toString();
         localStorage.setItem(SASAbusHTML5_FAVOURITES, tmp);
      }
      catch (Exception e)
      {
         SASAbusHTML5.handleException(e);
      }
   }
}
 
开发者ID:davidebz,项目名称:SASAbusHTML5,代码行数:19,代码来源:FavouriteBusStationList.java

示例5: 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

示例6: getUniqueId

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
public static String getUniqueId() {
    Storage storage = Storage.getLocalStorageIfSupported();
    String id = storage.getItem("tech_unique_id");
    if (id != null) {
        return id;
    }
    Random rnd = new Random();
    id = "";
    for (int i = 0; i < 128; i++) {
        id += ((char) ('a' + rnd.nextInt('z' - 'a')));
    }
    storage.setItem("tech_unique_id", id);
    return id;
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:15,代码来源:IdentityUtils.java

示例7: saveItems

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
private void saveItems(JsoArray<Entry> list) {
	Storage storage = getStorage();

	if (storage != null) {
		storage.setItem(SAVED_ITEMS, list.stringify());
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:8,代码来源:GearPanel.java

示例8: addLocalStorage

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

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

		if (s != null) {

			final String key = STORAGE_KEY + name;

			if (s.getItem(key) != null) {
				ApplicationPanel
						.showErrorDialog("That entry already exists.");
			} else {
				final FormData data = listener.getFormData();

				JSONObject obj = JsonUtil.toJSONObject(data);
				s.setItem(key, obj.toString());
				storageList.addItem(name, key);
				
				storageList.setSelectedIndex(storageList.getItemCount() - 1);
				
				ApplicationPanel.showInfoDialog("Configuration Saved");
			}
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:28,代码来源:SavePanel.java

示例9: 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

示例10: onSuccess

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
@Override
public void onSuccess(SecureNavigationCommand command, SecureNavigationResult result, Authentication authentication) {
	if (result != null && result.getAuthentication() != null) {
		authenticationAsyncDAO.saveOrUpdate(result.getAuthentication());
		pageAccessAsyncDAO.saveOrUpdate(PageAccessJS.createPageAccessJS(command.getPage(), result.isGranted()));

		final Storage storage = Storage.getLocalStorageIfSupported();
		storage.setItem(LocalDispatchServiceAsync.LAST_USER_ITEM, result.getAuthentication().getUserEmail());
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:11,代码来源:SecureNavigationAsyncHandler.java

示例11: 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

示例12: setSigmahActivationTraceDate

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

示例13: onDelayedEvent

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
@Override
public void onDelayedEvent()
{
	Storage store = Storage.getLocalStorageIfSupported();
	if( store == null )
		return;

	JsArrayInteger jsArray = sqlite.exportData();
	if( jsArray != null )
		store.setItem( "db_" + name, new JSONArray( jsArray ).toString() );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:12,代码来源:EntityManagerFactoryImpl.java

示例14: savePreferences

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
@Override
public void savePreferences(String name, JSONObject preferences)
{
    Storage localStorage = Storage.getLocalStorageIfSupported();

    if (localStorage == null)
        return;

    localStorage.setItem(name, JSON.write(preferences));
}
 
开发者ID:sriharshachilakapati,项目名称:SilenceEngine,代码行数:11,代码来源:GwtIODevice.java

示例15: setOptionInStorage

import com.google.gwt.storage.client.Storage; //导入方法依赖的package包/类
void setOptionInStorage(String key, boolean val) {
    Storage stor = Storage.getLocalStorageIfSupported();
    if (stor == null)
        return;
    stor.setItem(key,  val ? "true" : "false");
}
 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:7,代码来源:CirSim.java


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