This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:zanata/zanata
- Loading branch information
Showing
8 changed files
with
370 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
server/zanata-war/src/main/java/org/zanata/webtrans/client/history/History.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.zanata.webtrans.client.history; | ||
|
||
import com.google.gwt.event.logical.shared.ValueChangeHandler; | ||
import com.google.gwt.event.shared.HandlerRegistration; | ||
|
||
/** | ||
* JRE-safe class that wraps GWT's {@link com.google.gwt.user.client.History} class, allowing non-GWT testing of code that uses gwt's History mechanism. | ||
* | ||
* @author David Mason, damason@redhat.com | ||
* | ||
*/ | ||
public interface History | ||
{ | ||
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler); | ||
|
||
public void back(); | ||
|
||
public void fireCurrentHistoryState(); | ||
|
||
public void forward(); | ||
|
||
public String getToken(); | ||
|
||
public void newItem(String historyToken); | ||
|
||
public void newItem(String historyToken, boolean issueEvent); | ||
} |
57 changes: 57 additions & 0 deletions
57
server/zanata-war/src/main/java/org/zanata/webtrans/client/history/HistoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.zanata.webtrans.client.history; | ||
|
||
import com.google.gwt.event.logical.shared.ValueChangeHandler; | ||
import com.google.gwt.event.shared.HandlerRegistration; | ||
|
||
//TODO inject this | ||
|
||
/** | ||
* @author David Mason, damason@redhat.com | ||
* | ||
*/ | ||
public class HistoryImpl implements History | ||
{ | ||
|
||
@Override | ||
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) | ||
{ | ||
return com.google.gwt.user.client.History.addValueChangeHandler(handler); | ||
} | ||
|
||
@Override | ||
public void back() | ||
{ | ||
com.google.gwt.user.client.History.back(); | ||
} | ||
|
||
@Override | ||
public void fireCurrentHistoryState() | ||
{ | ||
com.google.gwt.user.client.History.fireCurrentHistoryState(); | ||
} | ||
|
||
@Override | ||
public void forward() | ||
{ | ||
com.google.gwt.user.client.History.forward(); | ||
} | ||
|
||
@Override | ||
public String getToken() | ||
{ | ||
return com.google.gwt.user.client.History.getToken(); | ||
} | ||
|
||
@Override | ||
public void newItem(String historyToken) | ||
{ | ||
com.google.gwt.user.client.History.newItem(historyToken); | ||
} | ||
|
||
@Override | ||
public void newItem(String historyToken, boolean issueEvent) | ||
{ | ||
com.google.gwt.user.client.History.newItem(historyToken, issueEvent); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
server/zanata-war/src/main/java/org/zanata/webtrans/client/history/WindowLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* | ||
*/ | ||
package org.zanata.webtrans.client.history; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Wraps calls to the {@link com.google.gwt.user.client.Window.Location} object | ||
* to allow mocking for testing in a JRE (non-GWT) environment. | ||
* | ||
* Does not implement all Window.Location methods. | ||
* | ||
* @author David Mason, damason@redhat.com | ||
* | ||
*/ | ||
public interface WindowLocation | ||
{ | ||
public String getParameter(String name); | ||
|
||
public Map<String, List<String>> getParameterMap(); | ||
|
||
public String getHref(); | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
server/zanata-war/src/main/java/org/zanata/webtrans/client/history/WindowLocationImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.zanata.webtrans.client.history; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import com.google.gwt.user.client.Window; | ||
|
||
public class WindowLocationImpl implements WindowLocation | ||
{ | ||
|
||
@Override | ||
public String getParameter(String name) | ||
{ | ||
return Window.Location.getParameter(name); | ||
} | ||
|
||
@Override | ||
public Map<String, List<String>> getParameterMap() | ||
{ | ||
return Window.Location.getParameterMap(); | ||
} | ||
|
||
@Override | ||
public String getHref() | ||
{ | ||
return Window.Location.getHref(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.