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


Java Storage类代码示例

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


Storage类属于com.google.gwt.storage.client包,在下文中一共展示了Storage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JsListStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public JsListStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    String indexData = storage.getItem("list_" + prefix + "_index");
    if (indexData != null) {
        try {
            byte[] data = fromBase64(indexData);
            DataInput dataInput = new DataInput(data, 0, data.length);
            int count = dataInput.readInt();
            for (int i = 0; i < count; i++) {
                long id = dataInput.readLong();
                long order = dataInput.readLong();
                index.add(new Index(id, order));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    updateIndex();
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:23,代码来源:JsListStorage.java

示例2: JsKeyValueStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public JsKeyValueStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    try {
        String index = storage.getItem("kv_" + prefix + "_index");
        if (index != null) {
            byte[] data = fromBase64(index);
            DataInput dataInput = new DataInput(data, 0, data.length);
            int count = dataInput.readInt();
            for (int i = 0; i < count; i++) {
                items.add(dataInput.readLong());
            }
        }
    } catch (Exception e) {
        Log.e(TAG, e);
    }
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:19,代码来源:JsKeyValueStorage.java

示例3: JsListStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public JsListStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    String indexData = storage.getItem("list_" + prefix + "_index");
    if (indexData != null) {
        try {
            byte[] data = fromBase64(indexData);
            DataInput dataInput = new DataInput(data, 0, data.length);
            int count = dataInput.readInt();
            for (int i = 0; i < count; i++) {
                long id = dataInput.readLong();
                long order = dataInput.readLong();
                index.add(new Index(id, order));
            }
        } catch (Exception e) {
            Log.e(TAG, e);
        }
    }

    updateIndex();
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:23,代码来源:JsListStorage.java

示例4: start

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
	view = clientFactory.getSeattleView();
	dbService = clientFactory.getDbService();
	analytics = clientFactory.getAnalytics();
	view.setPresenter(this);
	
	localStorage = Storage.getLocalStorageIfSupported();

	buildStationList();
       getCameras();

       timer = new Timer() {

           @Override
           public void run() {
               getFlowData();
               timer = null;
           }
       };

       timer.schedule(250);

	if (Consts.ANALYTICS_ENABLED) {
           analytics.trackView("/Seattle");
       }

       panel.setWidget(view);

}
 
开发者ID:waynedyck,项目名称:mgwt-traffic-flow,代码行数:31,代码来源:SeattleActivity.java

示例5: SeattleViewGwtImpl

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public SeattleViewGwtImpl() {

		mapCanvas = Canvas.createIfSupported();
		flowCanvas = Canvas.createIfSupported();
		cameraCanvas = Canvas.createIfSupported();
		localStorage = Storage.getLocalStorageIfSupported();
		touchDelegate = new TouchDelegate(cameraCanvas);

		initWidget(uiBinder.createAndBindUi(this));

        if (MGWT.getOsDetection().isAndroid()) {
            leftFlexSpacer.setVisible(false);
        } else if (MGWT.getOsDetection().isIOs()) {
            leftFlexSpacer.setVisible(false);
        }

		getMap();
	}
 
开发者ID:waynedyck,项目名称:mgwt-traffic-flow,代码行数:19,代码来源:SeattleViewGwtImpl.java

示例6: TacomaViewGwtImpl

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public TacomaViewGwtImpl() {

		mapCanvas = Canvas.createIfSupported();
		flowCanvas = Canvas.createIfSupported();
		cameraCanvas = Canvas.createIfSupported();
		localStorage = Storage.getLocalStorageIfSupported();
		touchDelegate = new TouchDelegate(cameraCanvas);

		initWidget(uiBinder.createAndBindUi(this));

        if (MGWT.getOsDetection().isAndroid()) {
            leftFlexSpacer.setVisible(false);
        } else if (MGWT.getOsDetection().isIOs()) {
            leftFlexSpacer.setVisible(false);
        }

		getMap();
	}
 
开发者ID:waynedyck,项目名称:mgwt-traffic-flow,代码行数:19,代码来源:TacomaViewGwtImpl.java

示例7: start

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
	view = clientFactory.getTacomaView();
	dbService = clientFactory.getDbService();
	analytics = clientFactory.getAnalytics();
	view.setPresenter(this);

	localStorage = Storage.getLocalStorageIfSupported();

	buildStationList();
       getCameras();
       getFlowData();

       if (Consts.ANALYTICS_ENABLED) {
           analytics.trackView("/Tacoma");
       }

       panel.setWidget(view);

}
 
开发者ID:waynedyck,项目名称:mgwt-traffic-flow,代码行数:21,代码来源:TacomaActivity.java

示例8: get

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public static String get(String prefname) {
    String value = null;
    // check browser session storage
    Storage sessionStorage = Storage.getSessionStorageIfSupported();
    if (sessionStorage != null) {
        value = sessionStorage.getItem(PREFIX+prefname);
    }

    // check browser local storage
    if (value == null) {
        Storage localStorage = Storage.getLocalStorageIfSupported();
        if (localStorage != null) {
            value = localStorage.getItem(PREFIX+prefname);
        }
    }

    // check map
    if (value==null) {
        value = localPrefMap.get(prefname);
    }
    return value;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:23,代码来源:Preferences.java

示例9: getSavedItems

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private JsoArray<Entry> getSavedItems() {
	Storage storage = getStorage();

	if (storage != null) {
		String data = storage.getItem(SAVED_ITEMS);
		JsoArray<Entry> list = null;

		if (data != null) {
			list = JsonUtils.safeEval(data);
		} else {
			list = (JsoArray<Entry>) JavaScriptObject.createArray();
		}

		return list;

	} else {
		return (JsoArray<Entry>) JavaScriptObject.createArray();
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:21,代码来源:GearPanel.java

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

示例11: restoreLocalStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
protected void restoreLocalStorage() {
	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);

			if (value == null)
				value = "";

			final String json = value;

			if (listener != null) {

				FormData data = JsonUtil.parseFormData(json);
				listener.setFormData(data);
				
			}
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:27,代码来源:SavePanel.java

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

示例13: onLoad

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
@Override
public void onLoad() {
	tabPanel.selectTab(0);

	if (!Beans.isDesignTime()) {
		Storage s = Storage.getLocalStorageIfSupported();

		if (s != null) {

			for (int i = 0; i < s.getLength(); i++) {
				String key = s.key(i);

				if ((key != null) && key.startsWith(STORAGE_KEY)) {
					String name = key.substring(STORAGE_KEY.length());
					storageList.addItem(name, key);
				}
			}
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:21,代码来源:SavePanel.java

示例14: JsKeyValueStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public JsKeyValueStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    try {
        String index = storage.getItem("kv_" + prefix + "_index");
        if (index != null) {
            byte[] data = fromBase64(index);
            DataInput dataInput = new DataInput(data, 0, data.length);
            int count = dataInput.readInt();
            for (int i = 0; i < count; i++) {
                items.add(dataInput.readLong());
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:19,代码来源:JsKeyValueStorage.java

示例15: JsIndexStorage

import com.google.gwt.storage.client.Storage; //导入依赖的package包/类
public JsIndexStorage(String prefix, Storage storage) {
    this.storage = storage;
    this.prefix = prefix;

    try {
        String index = storage.getItem("index_" + prefix + "_index");
        if (index != null) {
            byte[] data = fromBase64(index);
            DataInput dataInput = new DataInput(data, 0, data.length);
            int count = dataInput.readInt();
            for (int i = 0; i < count; i++) {
                long id = dataInput.readLong();
                long value = dataInput.readLong();
                items.add(new Item(id, value));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:21,代码来源:JsIndexStorage.java


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