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