Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/samphippen/spe
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Bevan committed Mar 7, 2011
2 parents 79e1df6 + 0f2d00e commit a75b16a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/uk/me/graphe/client/Graphemeui.java
Expand Up @@ -16,6 +16,7 @@
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;

public class Graphemeui implements EntryPoint {
Expand All @@ -28,6 +29,8 @@ public class Graphemeui implements EntryPoint {
public final GraphManager2d graphManager;
public final GraphManager2dFactory graphManagerFactory;
public final Drawing drawing;

private LocalStore mStore = LocalStoreFactory.newInstance();

public ArrayList<VertexDrawable> selectedVertices;
public ArrayList<EdgeDrawable> selectedEdges;
Expand Down Expand Up @@ -107,6 +110,14 @@ public void onKeyUp(KeyUpEvent e) {
ServerChannel sc = ServerChannel.getInstance();
ClientOT.getInstance().setOperatingGraph(this.graphManager);
sc.init();
mStore = LocalStoreFactory.newInstance();
new Timer() {

@Override
public void run() {
mStore.save();
}
}.scheduleRepeating(1000);
}


Expand Down
6 changes: 5 additions & 1 deletion src/uk/me/graphe/client/LocalStoreImpl.java
Expand Up @@ -27,7 +27,7 @@ public LocalStoreImpl() {
if (Storage.isSupported() == false )
Window.alert("Warning your broswer does not support local storage, permanent high speed internet connection will be required to play");
mStorage = Storage.getLocalStorage();
if (mStorage.getItem("itemID") == null)
if (mStorage.getItem("itemID") == null || mStorage.getItem("itemID").equals("none"))
mStorage.setItem("itemID", "none");
else
restore();
Expand Down Expand Up @@ -86,8 +86,12 @@ private boolean setgraph(int graphId) {

@Override
public void save() {
try {
String maxID = Integer.toString(maxHistoryId);
mStorage.setItem("maxHistory", maxID);
} catch (Exception e) {
e.printStackTrace();
}
saveState();
saveOps();
}
Expand Down

0 comments on commit a75b16a

Please sign in to comment.