Package com.google.gwt.storage.client

Examples of com.google.gwt.storage.client.Storage


    /**
     * Reads the stored state from localStorage.
     */
    private void readStoredState() {
        Storage storage = Storage.getLocalStorageIfSupported();
        if (storage == null) {
            return;
        }

        fullX = readState(storage, STORAGE_FULL_X, -510);
View Full Code Here


     */
    private void writeStoredState() {
        if (isClosed()) {
            return;
        }
        Storage storage = Storage.getLocalStorageIfSupported();
        if (storage == null) {
            return;
        }

        writeState(storage, STORAGE_FULL_X, fullX);
View Full Code Here

    /**
     * Resets (clears) the stored state from localStorage.
     */
    private void resetStoredState() {
        Storage storage = Storage.getLocalStorageIfSupported();
        if (storage == null) {
            return;
        }
        // note: length is live
        for (int i = 0; i < storage.getLength();) {
            String key = storage.key(i);
            if (key.startsWith(STORAGE_PREFIX)) {
                removeState(storage, key.substring(STORAGE_PREFIX.length()));
            } else {
                i++;
            }
View Full Code Here

     * Toggles scroll lock, writes state to persistent storage.
     */
    void toggleScrollLock() {
        setScrollLock(scrollTimer != null);

        Storage storage = Storage.getLocalStorageIfSupported();
        if (storage == null) {
            return;
        }
        VDebugWindow.writeState(storage, "log-scrollLock", scrollTimer == null);
    }
View Full Code Here

        return content;
    }

    @Override
    public void show() {
        Storage storage = Storage.getLocalStorageIfSupported();
        if (storage == null) {
            return;
        }
        setScrollLock(VDebugWindow.readState(storage, "log-scrollLock", false));
    }
View Full Code Here

        { "xxx", 1L, true, NOW }
    };

    @Before
    public void gwtSetUp() {
        Storage ls = Storage.getLocalStorageIfSupported();
        storage = new LocalStorage(ls);
        storage.clearValues();
    }
View Full Code Here

        if (loginInfo.isLoggedIn())
        {
          boolean signup = false;
          if (Configuration.appUserMode == Configuration.UserMode.umMultipleSeperate)
          {
            Storage stockStore = Storage.getLocalStorageIfSupported();
            if (stockStore != null)
            {
              if (stockStore.getItem("signup") != null)
              {
                signup = stockStore.getItem("signup").equals(Boolean.toString(true));
                stockStore.removeItem("signup");
              }
            }
          }

          if (signup)
View Full Code Here

    GWT.log("load login");
    // mSignup = signup;

    if (signup)
    {
      Storage stockStore = Storage.getLocalStorageIfSupported();
      if (stockStore != null)
      {
        stockStore.setItem("signup", Boolean.toString(signup));
      } else
      {
        Window.alert("HTML5 Storage Compatible Browser Required!");
      }
    }
View Full Code Here

      }
    }
  }-*/;

  public void testCoverageDataIsFlushedToLocalStorageOnBeforeUnload() {
    Storage localStorage = Storage.getLocalStorageIfSupported();
    assertNotNull("Test browser does not support localStorage", localStorage);
    // No coverage initially
    assertNull("Found unexpected initial coverage", localStorage.getItem("gwt_coverage"));

    CoverageTestModule.method();

    // Trigger the onbeforeunload handler to flush the coverage information to localStorage.
    fireOnBeforeUnloadEvent();
    String coverageAsJson = localStorage.getItem("gwt_coverage");
    assertNotNull("No coverage data found", coverageAsJson);
    JSONObject coverage = JSONParser.parseStrict(coverageAsJson).isObject();
    assertNotNull("Coverage data was not valid JSON", coverage);

    JSONObject fileCoverage =
View Full Code Here

  /**
   * Saves the current to-do items to local storage.
   */
  private void saveState() {
    Storage storage = Storage.getLocalStorageIfSupported();
    if (storage != null) {

      // JSON encode the items
      JSONArray todoItems = new JSONArray();
      for (int i = 0; i < todos.size(); i++) {
        ToDoItem toDoItem = todos.get(i);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("task", new JSONString(toDoItem.getTitle()));
        jsonObject.put("complete", JSONBoolean.getInstance(toDoItem.isCompleted()));
        todoItems.set(i, jsonObject);
      }

      // save to local storage
      storage.setItem(STORAGE_KEY, todoItems.toString());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.storage.client.Storage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.