Make hyperlinks update URL when screen is visible
Instead of updating the URL to the screen and then loading the RPCs, update the URL after the RPCs are complete and the screen is going to be made visible to the user. This allows us to behave similar to the way Gmail reacts, which is to avoid the URL update until the data you are viewing matches the URL. Change-Id: Iadde8240d506e3a51b9f064ecfa5fb91045616f5 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -50,6 +50,7 @@ import com.google.gerrit.client.changes.PatchTable;
|
|||||||
import com.google.gerrit.client.changes.PublishCommentScreen;
|
import com.google.gerrit.client.changes.PublishCommentScreen;
|
||||||
import com.google.gerrit.client.patches.PatchScreen;
|
import com.google.gerrit.client.patches.PatchScreen;
|
||||||
import com.google.gerrit.client.ui.Screen;
|
import com.google.gerrit.client.ui.Screen;
|
||||||
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.common.auth.SignInMode;
|
import com.google.gerrit.common.auth.SignInMode;
|
||||||
import com.google.gerrit.reviewdb.Account;
|
import com.google.gerrit.reviewdb.Account;
|
||||||
import com.google.gerrit.reviewdb.AccountGroup;
|
import com.google.gerrit.reviewdb.AccountGroup;
|
||||||
@@ -60,11 +61,9 @@ import com.google.gerrit.reviewdb.Project;
|
|||||||
import com.google.gerrit.reviewdb.Change.Status;
|
import com.google.gerrit.reviewdb.Change.Status;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.RunAsyncCallback;
|
import com.google.gwt.core.client.RunAsyncCallback;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
||||||
import com.google.gwtorm.client.KeyUtil;
|
import com.google.gwtorm.client.KeyUtil;
|
||||||
|
|
||||||
public class HistoryHandler implements ValueChangeHandler<String> {
|
public class Dispatcher {
|
||||||
public static String toPatchSideBySide(final Patch.Key id) {
|
public static String toPatchSideBySide(final Patch.Key id) {
|
||||||
return toPatch("sidebyside", id);
|
return toPatch("sidebyside", id);
|
||||||
}
|
}
|
||||||
@@ -100,34 +99,31 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValueChange(final ValueChangeEvent<String> event) {
|
void display(final String token) {
|
||||||
final String token = event.getValue();
|
assert token != null;
|
||||||
try {
|
try {
|
||||||
select(token);
|
select(token);
|
||||||
} catch (RuntimeException err) {
|
} catch (RuntimeException err) {
|
||||||
GWT.log("Error parsing history token: " + token, err);
|
GWT.log("Error parsing history token: " + token, err);
|
||||||
Gerrit.display(new NotFoundScreen());
|
Gerrit.display(token, new NotFoundScreen());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void select(final String token) {
|
private static void select(final String token) {
|
||||||
if (token == null) {
|
if (token.startsWith("patch,")) {
|
||||||
Gerrit.display(new NotFoundScreen());
|
|
||||||
|
|
||||||
} else if (token.startsWith("patch,")) {
|
|
||||||
patch(token, null, 0, null);
|
patch(token, null, 0, null);
|
||||||
|
|
||||||
} else if (token.startsWith("change,publish,")) {
|
} else if (token.startsWith("change,publish,")) {
|
||||||
publish(token);
|
publish(token);
|
||||||
|
|
||||||
} else if (MINE.equals(token) || token.startsWith("mine,")) {
|
} else if (MINE.equals(token) || token.startsWith("mine,")) {
|
||||||
Gerrit.display(mine(token));
|
Gerrit.display(token, mine(token));
|
||||||
|
|
||||||
} else if (token.startsWith("all,")) {
|
} else if (token.startsWith("all,")) {
|
||||||
Gerrit.display(all(token));
|
Gerrit.display(token, all(token));
|
||||||
|
|
||||||
} else if (token.startsWith("project,")) {
|
} else if (token.startsWith("project,")) {
|
||||||
Gerrit.display(project(token));
|
Gerrit.display(token, project(token));
|
||||||
|
|
||||||
} else if (SETTINGS.equals(token) //
|
} else if (SETTINGS.equals(token) //
|
||||||
|| REGISTER.equals(token) //
|
|| REGISTER.equals(token) //
|
||||||
@@ -141,7 +137,7 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
admin(token);
|
admin(token);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Gerrit.display(core(token));
|
Gerrit.display(token, core(token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +236,7 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
private static void publish(final String token) {
|
private static void publish(final String token) {
|
||||||
new RunAsyncCallback() {
|
new RunAsyncCallback() {
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Gerrit.display(select());
|
Gerrit.display(token, select());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Screen select() {
|
private Screen select() {
|
||||||
@@ -260,7 +256,7 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
final int patchIndex, final PatchTable patchTable) {
|
final int patchIndex, final PatchTable patchTable) {
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Gerrit.display(select());
|
Gerrit.display(token, select());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Screen select() {
|
private Screen select() {
|
||||||
@@ -296,7 +292,7 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
private static void settings(final String token) {
|
private static void settings(final String token) {
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Gerrit.display(select());
|
Gerrit.display(token, select());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Screen select() {
|
private Screen select() {
|
||||||
@@ -318,12 +314,13 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
final String[] args = skip(p, token).split(",");
|
final String[] args = skip(p, token).split(",");
|
||||||
final SignInMode mode = SignInMode.valueOf(args[0]);
|
final SignInMode mode = SignInMode.valueOf(args[0]);
|
||||||
final String msg = KeyUtil.decode(args[1]);
|
final String msg = KeyUtil.decode(args[1]);
|
||||||
|
final String to = PageLinks.MINE;
|
||||||
switch (Gerrit.getConfig().getAuthType()) {
|
switch (Gerrit.getConfig().getAuthType()) {
|
||||||
case OPENID:
|
case OPENID:
|
||||||
new OpenIdSignInDialog(mode, msg).center();
|
new OpenIdSignInDialog(mode, to, msg).center();
|
||||||
break;
|
break;
|
||||||
case LDAP:
|
case LDAP:
|
||||||
new UserPassSignInDialog(msg).center();
|
new UserPassSignInDialog(to, msg).center();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -356,7 +353,7 @@ public class HistoryHandler implements ValueChangeHandler<String> {
|
|||||||
private static void admin(final String token) {
|
private static void admin(final String token) {
|
||||||
GWT.runAsync(new RunAsyncCallback() {
|
GWT.runAsync(new RunAsyncCallback() {
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
Gerrit.display(select());
|
Gerrit.display(token, select());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Screen select() {
|
private Screen select() {
|
||||||
@@ -60,7 +60,8 @@ import java.util.ArrayList;
|
|||||||
public class Gerrit implements EntryPoint {
|
public class Gerrit implements EntryPoint {
|
||||||
public static final GerritConstants C = GWT.create(GerritConstants.class);
|
public static final GerritConstants C = GWT.create(GerritConstants.class);
|
||||||
public static final GerritMessages M = GWT.create(GerritMessages.class);
|
public static final GerritMessages M = GWT.create(GerritMessages.class);
|
||||||
public static final GerritResources RESOURCES = GWT.create(GerritResources.class);
|
public static final GerritResources RESOURCES =
|
||||||
|
GWT.create(GerritResources.class);
|
||||||
public static final SystemInfoService SYSTEM_SVC;
|
public static final SystemInfoService SYSTEM_SVC;
|
||||||
|
|
||||||
private static String myHost;
|
private static String myHost;
|
||||||
@@ -73,6 +74,7 @@ public class Gerrit implements EntryPoint {
|
|||||||
private static RootPanel siteHeader;
|
private static RootPanel siteHeader;
|
||||||
private static RootPanel siteFooter;
|
private static RootPanel siteFooter;
|
||||||
private static SearchPanel searchPanel;
|
private static SearchPanel searchPanel;
|
||||||
|
private static final Dispatcher dispatcher = new Dispatcher();
|
||||||
private static ViewSite<Screen> body;
|
private static ViewSite<Screen> body;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -80,29 +82,65 @@ public class Gerrit implements EntryPoint {
|
|||||||
JsonUtil.bind(SYSTEM_SVC, "rpc/SystemInfoService");
|
JsonUtil.bind(SYSTEM_SVC, "rpc/SystemInfoService");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void display(final String historyToken, final boolean go) {
|
/**
|
||||||
History.newItem(historyToken, go);
|
* Load the screen at the given location, displaying when ready.
|
||||||
if (!go && historyHooks != null) {
|
* <p>
|
||||||
dispatchHistoryHooks(historyToken);
|
* If the URL is not already pointing at this location, a new item will be
|
||||||
|
* added to the browser's history when the screen is fully loaded and
|
||||||
|
* displayed on the UI.
|
||||||
|
*
|
||||||
|
* @param token location to parse, load, and render.
|
||||||
|
*/
|
||||||
|
public static void display(final String token) {
|
||||||
|
if (body.getView() == null || !body.getView().displayToken(token)) {
|
||||||
|
dispatcher.display(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void display(final String historyToken, final Screen view) {
|
/**
|
||||||
History.newItem(historyToken, false);
|
* Load the screen passed, assuming token can be used to locate it.
|
||||||
display(view);
|
* <p>
|
||||||
if (historyHooks != null) {
|
* The screen is loaded in the background. When it is ready to be visible a
|
||||||
dispatchHistoryHooks(historyToken);
|
* new item will be added to the browser's history, the screen will be made
|
||||||
}
|
* visible, and the window title may be updated.
|
||||||
}
|
* <p>
|
||||||
|
* If {@link Screen#isRequiresSignIn()} is true and the user is not signed in
|
||||||
public static void display(final Screen view) {
|
* yet the screen instance will be discarded, sign-in will take place, and
|
||||||
|
* will redirect to this location upon success.
|
||||||
|
*
|
||||||
|
* @param token location that refers to {@code view}.
|
||||||
|
* @param view the view to load.
|
||||||
|
*/
|
||||||
|
public static void display(final String token, final Screen view) {
|
||||||
if (view.isRequiresSignIn() && !isSignedIn()) {
|
if (view.isRequiresSignIn() && !isSignedIn()) {
|
||||||
doSignIn();
|
doSignIn(token);
|
||||||
} else {
|
} else {
|
||||||
|
view.setToken(token);
|
||||||
body.setView(view);
|
body.setView(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the current history token after a screen change.
|
||||||
|
* <p>
|
||||||
|
* The caller has already updated the UI, but wants to publish a different
|
||||||
|
* history token for the current browser state. This really only makes sense
|
||||||
|
* if the caller is a {@code TabPanel} and is firing an event when the tab
|
||||||
|
* changed to a different part.
|
||||||
|
*
|
||||||
|
* @param token new location that is already visible.
|
||||||
|
*/
|
||||||
|
public static void updateImpl(final String token) {
|
||||||
|
History.newItem(token, false);
|
||||||
|
|
||||||
|
if (historyHooks != null) {
|
||||||
|
// Because we blocked firing the event our history hooks won't be
|
||||||
|
// informed of the current token. Manually fire the event to them.
|
||||||
|
//
|
||||||
|
dispatchHistoryHooks(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void setQueryString(String query) {
|
public static void setQueryString(String query) {
|
||||||
searchPanel.setText(query);
|
searchPanel.setText(query);
|
||||||
}
|
}
|
||||||
@@ -133,11 +171,11 @@ public class Gerrit implements EntryPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Sign the user into the application. */
|
/** Sign the user into the application. */
|
||||||
public static void doSignIn() {
|
public static void doSignIn(final String token) {
|
||||||
switch (myConfig.getAuthType()) {
|
switch (myConfig.getAuthType()) {
|
||||||
case HTTP:
|
case HTTP:
|
||||||
case HTTP_LDAP:
|
case HTTP_LDAP:
|
||||||
Location.assign(Location.getPath() + "login/" + History.getToken());
|
Location.assign(Location.getPath() + "login/" + token);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVELOPMENT_BECOME_ANY_ACCOUNT:
|
case DEVELOPMENT_BECOME_ANY_ACCOUNT:
|
||||||
@@ -145,11 +183,11 @@ public class Gerrit implements EntryPoint {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OPENID:
|
case OPENID:
|
||||||
new OpenIdSignInDialog(SignInMode.SIGN_IN, null).center();
|
new OpenIdSignInDialog(SignInMode.SIGN_IN, token, null).center();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LDAP:
|
case LDAP:
|
||||||
new UserPassSignInDialog(null).center();
|
new UserPassSignInDialog(token, null).center();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,6 +236,13 @@ public class Gerrit implements EntryPoint {
|
|||||||
body = new ViewSite<Screen>() {
|
body = new ViewSite<Screen>() {
|
||||||
@Override
|
@Override
|
||||||
protected void onShowView(Screen view) {
|
protected void onShowView(Screen view) {
|
||||||
|
final String token = view.getToken();
|
||||||
|
if (!token.equals(History.getToken())) {
|
||||||
|
History.newItem(token, false);
|
||||||
|
if (historyHooks != null) {
|
||||||
|
dispatchHistoryHooks(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
super.onShowView(view);
|
super.onShowView(view);
|
||||||
view.onShowView();
|
view.onShowView();
|
||||||
}
|
}
|
||||||
@@ -302,17 +347,21 @@ public class Gerrit implements EntryPoint {
|
|||||||
starting.getElement().getParentElement().removeChild(starting.getElement());
|
starting.getElement().getParentElement().removeChild(starting.getElement());
|
||||||
RootPanel.detachNow(starting);
|
RootPanel.detachNow(starting);
|
||||||
|
|
||||||
History.addValueChangeHandler(new HistoryHandler());
|
History.addValueChangeHandler(new ValueChangeHandler<String>() {
|
||||||
|
public void onValueChange(final ValueChangeEvent<String> event) {
|
||||||
|
display(event.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
JumpKeys.register(body);
|
JumpKeys.register(body);
|
||||||
|
|
||||||
if ("".equals(History.getToken())) {
|
if ("".equals(History.getToken())) {
|
||||||
if (isSignedIn()) {
|
if (isSignedIn()) {
|
||||||
History.newItem(PageLinks.MINE);
|
display(PageLinks.MINE);
|
||||||
} else {
|
} else {
|
||||||
History.newItem(PageLinks.ALL_OPEN);
|
display(PageLinks.ALL_OPEN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
History.fireCurrentHistoryState();
|
display(History.getToken());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,12 +410,13 @@ public class Gerrit implements EntryPoint {
|
|||||||
case OPENID:
|
case OPENID:
|
||||||
menuRight.addItem(C.menuRegister(), new Command() {
|
menuRight.addItem(C.menuRegister(), new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
new OpenIdSignInDialog(SignInMode.REGISTER, null).center();
|
final String to = History.getToken();
|
||||||
|
new OpenIdSignInDialog(SignInMode.REGISTER, to, null).center();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menuRight.addItem(C.menuSignIn(), new Command() {
|
menuRight.addItem(C.menuSignIn(), new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
doSignIn();
|
doSignIn(History.getToken());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -377,7 +427,7 @@ public class Gerrit implements EntryPoint {
|
|||||||
}
|
}
|
||||||
menuRight.addItem(C.menuSignIn(), new Command() {
|
menuRight.addItem(C.menuSignIn(), new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
doSignIn();
|
doSignIn(History.getToken());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ class JumpKeys {
|
|||||||
jumps.add(new KeyCommand(0, 'o', Gerrit.C.jumpAllOpen()) {
|
jumps.add(new KeyCommand(0, 'o', Gerrit.C.jumpAllOpen()) {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
Gerrit.display(PageLinks.ALL_OPEN, true);
|
Gerrit.display(PageLinks.ALL_OPEN);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jumps.add(new KeyCommand(0, 'm', Gerrit.C.jumpAllMerged()) {
|
jumps.add(new KeyCommand(0, 'm', Gerrit.C.jumpAllMerged()) {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
Gerrit.display(PageLinks.ALL_MERGED, true);
|
Gerrit.display(PageLinks.ALL_MERGED);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -43,19 +43,19 @@ class JumpKeys {
|
|||||||
jumps.add(new KeyCommand(0, 'i', Gerrit.C.jumpMine()) {
|
jumps.add(new KeyCommand(0, 'i', Gerrit.C.jumpMine()) {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
Gerrit.display(PageLinks.MINE, true);
|
Gerrit.display(PageLinks.MINE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jumps.add(new KeyCommand(0, 'd', Gerrit.C.jumpMineDrafts()) {
|
jumps.add(new KeyCommand(0, 'd', Gerrit.C.jumpMineDrafts()) {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
Gerrit.display(PageLinks.MINE_DRAFTS, true);
|
Gerrit.display(PageLinks.MINE_DRAFTS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jumps.add(new KeyCommand(0, 's', Gerrit.C.jumpMineStarred()) {
|
jumps.add(new KeyCommand(0, 's', Gerrit.C.jumpMineStarred()) {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
Gerrit.display(PageLinks.MINE_STARRED, true);
|
Gerrit.display(PageLinks.MINE_STARRED);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ package com.google.gerrit.client;
|
|||||||
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
@@ -36,7 +37,7 @@ public class NotSignedInDialog extends AutoCenterDialogBox {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
hide();
|
hide();
|
||||||
Gerrit.doSignIn();
|
Gerrit.doSignIn(History.getToken());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
buttons.add(signin);
|
buttons.add(signin);
|
||||||
|
|||||||
@@ -136,10 +136,9 @@ class SearchPanel extends Composite {
|
|||||||
searchBox.setFocus(false);
|
searchBox.setFocus(false);
|
||||||
|
|
||||||
if (query.matches("^[1-9][0-9]*$")) {
|
if (query.matches("^[1-9][0-9]*$")) {
|
||||||
final Change.Id ck = Change.Id.parse(query);
|
Gerrit.display(PageLinks.toChange(Change.Id.parse(query)));
|
||||||
Gerrit.display(PageLinks.toChange(ck), new ChangeScreen(ck));
|
|
||||||
} else {
|
} else {
|
||||||
Gerrit.display(PageLinks.toChangeQuery(query), true);
|
Gerrit.display(PageLinks.toChangeQuery(query));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,15 +20,18 @@ import com.google.gwtexpui.user.client.AutoCenterDialogBox;
|
|||||||
/** Prompts the user to sign in to their account. */
|
/** Prompts the user to sign in to their account. */
|
||||||
public abstract class SignInDialog extends AutoCenterDialogBox {
|
public abstract class SignInDialog extends AutoCenterDialogBox {
|
||||||
protected final SignInMode mode;
|
protected final SignInMode mode;
|
||||||
|
protected final String token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new dialog to handle user sign in.
|
* Create a new dialog to handle user sign in.
|
||||||
*
|
*
|
||||||
* @param signInMode type of mode the login will perform.
|
* @param signInMode type of mode the login will perform.
|
||||||
|
* @param token the token to jump to after sign-in is complete.
|
||||||
*/
|
*/
|
||||||
protected SignInDialog(final SignInMode signInMode) {
|
protected SignInDialog(final SignInMode signInMode, final String token) {
|
||||||
super(/* auto hide */true, /* modal */true);
|
super(/* auto hide */true, /* modal */true);
|
||||||
mode = signInMode;
|
this.mode = signInMode;
|
||||||
|
this.token = token;
|
||||||
|
|
||||||
switch (signInMode) {
|
switch (signInMode) {
|
||||||
case LINK_IDENTIY:
|
case LINK_IDENTIY:
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ public class AccountSettings extends AccountScreen {
|
|||||||
initialTabToken = tabToken;
|
initialTabToken = tabToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayToken(String token) {
|
||||||
|
final int tabIdx = tabTokens.indexOf(token);
|
||||||
|
if (0 <= tabIdx) {
|
||||||
|
tabs.selectTab(tabIdx);
|
||||||
|
setToken(token);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLoad() {
|
protected void onLoad() {
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
@@ -149,14 +161,15 @@ public class AccountSettings extends AccountScreen {
|
|||||||
tabs.addSelectionHandler(new SelectionHandler<Integer>() {
|
tabs.addSelectionHandler(new SelectionHandler<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelection(final SelectionEvent<Integer> event) {
|
public void onSelection(final SelectionEvent<Integer> event) {
|
||||||
Gerrit.display(tabTokens.get(event.getSelectedItem()), false);
|
setToken(tabTokens.get(event.getSelectedItem()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void infoRow(final int row, final String name) {
|
private void infoRow(final int row, final String name) {
|
||||||
info.setText(row, labelIdx, name);
|
info.setText(row, labelIdx, name);
|
||||||
info.getCellFormatter().addStyleName(row, 0, Gerrit.RESOURCES.css().header());
|
info.getCellFormatter().addStyleName(row, 0,
|
||||||
|
Gerrit.RESOURCES.css().header());
|
||||||
}
|
}
|
||||||
|
|
||||||
void display(final Account account) {
|
void display(final Account account) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.google.gerrit.reviewdb.ContributorAgreement;
|
|||||||
import com.google.gwt.user.client.ui.Anchor;
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.Hyperlink;
|
import com.google.gerrit.client.ui.Hyperlink;
|
||||||
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
||||||
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
|
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.google.gerrit.common.auth.openid.OpenIdUrls;
|
|||||||
import com.google.gerrit.reviewdb.AccountExternalId;
|
import com.google.gerrit.reviewdb.AccountExternalId;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.CheckBox;
|
import com.google.gwt.user.client.ui.CheckBox;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
@@ -61,7 +62,8 @@ class ExternalIdPanel extends Composite {
|
|||||||
linkIdentity.addClickHandler(new ClickHandler() {
|
linkIdentity.addClickHandler(new ClickHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final ClickEvent event) {
|
public void onClick(final ClickEvent event) {
|
||||||
new OpenIdSignInDialog(SignInMode.LINK_IDENTIY, null).center();
|
final String to = History.getToken();
|
||||||
|
new OpenIdSignInDialog(SignInMode.LINK_IDENTIY, to, null).center();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
body.add(linkIdentity);
|
body.add(linkIdentity);
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class NewAgreementScreen extends AccountScreen {
|
|||||||
Util.ACCOUNT_SEC.enterAgreement(current.getId(),
|
Util.ACCOUNT_SEC.enterAgreement(current.getId(),
|
||||||
new GerritCallback<VoidResult>() {
|
new GerritCallback<VoidResult>() {
|
||||||
public void onSuccess(final VoidResult result) {
|
public void onSuccess(final VoidResult result) {
|
||||||
Gerrit.display(nextToken, true);
|
Gerrit.display(nextToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.google.gerrit.reviewdb.Account;
|
|||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.FormPanel;
|
import com.google.gwt.user.client.ui.FormPanel;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.InlineHyperlink;
|
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||||
|
|
||||||
public class RegisterScreen extends AccountScreen {
|
public class RegisterScreen extends AccountScreen {
|
||||||
private final String nextToken;
|
private final String nextToken;
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.account;
|
package com.google.gerrit.client.account;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||||
import com.google.gerrit.client.ui.AccountScreen;
|
import com.google.gerrit.client.ui.AccountScreen;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gwt.user.client.History;
|
|
||||||
import com.google.gwtjsonrpc.client.VoidResult;
|
import com.google.gwtjsonrpc.client.VoidResult;
|
||||||
|
|
||||||
public class ValidateEmailScreen extends AccountScreen {
|
public class ValidateEmailScreen extends AccountScreen {
|
||||||
@@ -44,7 +44,7 @@ public class ValidateEmailScreen extends AccountScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void postDisplay() {
|
protected void postDisplay() {
|
||||||
History.newItem(PageLinks.SETTINGS_CONTACT, true);
|
Gerrit.display(PageLinks.SETTINGS_CONTACT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
package com.google.gerrit.client.admin;
|
package com.google.gerrit.client.admin;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.rpc.GerritCallback;
|
import com.google.gerrit.client.rpc.GerritCallback;
|
||||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||||
import com.google.gerrit.client.ui.AccountScreen;
|
import com.google.gerrit.client.ui.AccountScreen;
|
||||||
@@ -91,7 +91,7 @@ public class GroupListScreen extends AccountScreen {
|
|||||||
|
|
||||||
Util.GROUP_SVC.createGroup(newName, new GerritCallback<AccountGroup.Id>() {
|
Util.GROUP_SVC.createGroup(newName, new GerritCallback<AccountGroup.Id>() {
|
||||||
public void onSuccess(final AccountGroup.Id result) {
|
public void onSuccess(final AccountGroup.Id result) {
|
||||||
History.newItem(HistoryHandler.toAccountGroup(result));
|
History.newItem(Dispatcher.toAccountGroup(result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
package com.google.gerrit.client.admin;
|
package com.google.gerrit.client.admin;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.ui.NavigationTable;
|
import com.google.gerrit.client.ui.NavigationTable;
|
||||||
import com.google.gerrit.reviewdb.AccountGroup;
|
import com.google.gerrit.reviewdb.AccountGroup;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.KeyCodes;
|
import com.google.gwt.event.dom.client.KeyCodes;
|
||||||
import com.google.gwt.user.client.History;
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.ui.Hyperlink;
|
import com.google.gerrit.client.ui.Hyperlink;
|
||||||
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class GroupTable extends NavigationTable<AccountGroup> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onOpenRow(final int row) {
|
protected void onOpenRow(final int row) {
|
||||||
History.newItem(HistoryHandler.toAccountGroup(getRowItem(row).getId()));
|
History.newItem(Dispatcher.toAccountGroup(getRowItem(row).getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void display(final List<AccountGroup> result) {
|
public void display(final List<AccountGroup> result) {
|
||||||
@@ -88,7 +88,7 @@ public class GroupTable extends NavigationTable<AccountGroup> {
|
|||||||
|
|
||||||
void populate(final int row, final AccountGroup k) {
|
void populate(final int row, final AccountGroup k) {
|
||||||
if (enableLink) {
|
if (enableLink) {
|
||||||
table.setWidget(row, 1, new Hyperlink(k.getName(), HistoryHandler.toAccountGroup(k
|
table.setWidget(row, 1, new Hyperlink(k.getName(), Dispatcher.toAccountGroup(k
|
||||||
.getId())));
|
.getId())));
|
||||||
} else {
|
} else {
|
||||||
table.setText(row, 1, k.getName());
|
table.setText(row, 1, k.getName());
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.admin;
|
package com.google.gerrit.client.admin;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
|
||||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||||
import com.google.gerrit.client.ui.AccountScreen;
|
import com.google.gerrit.client.ui.AccountScreen;
|
||||||
import com.google.gerrit.common.data.ProjectDetail;
|
import com.google.gerrit.common.data.ProjectDetail;
|
||||||
@@ -44,6 +44,18 @@ public class ProjectAdminScreen extends AccountScreen {
|
|||||||
initialTabToken = token;
|
initialTabToken = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean displayToken(String token) {
|
||||||
|
final int tabIdx = tabTokens.indexOf(token);
|
||||||
|
if (0 <= tabIdx) {
|
||||||
|
tabs.selectTab(tabIdx);
|
||||||
|
setToken(token);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLoad() {
|
protected void onLoad() {
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
@@ -71,7 +83,7 @@ public class ProjectAdminScreen extends AccountScreen {
|
|||||||
return new ProjectInfoPanel(projectName);
|
return new ProjectInfoPanel(projectName);
|
||||||
}
|
}
|
||||||
}, Util.C.projectAdminTabGeneral());
|
}, Util.C.projectAdminTabGeneral());
|
||||||
tabTokens.add(HistoryHandler.toProjectAdmin(projectName, INFO_TAB));
|
tabTokens.add(Dispatcher.toProjectAdmin(projectName, INFO_TAB));
|
||||||
|
|
||||||
if (!Gerrit.getConfig().getWildProject().equals(projectName)) {
|
if (!Gerrit.getConfig().getWildProject().equals(projectName)) {
|
||||||
tabs.add(new LazyPanel() {
|
tabs.add(new LazyPanel() {
|
||||||
@@ -80,7 +92,7 @@ public class ProjectAdminScreen extends AccountScreen {
|
|||||||
return new ProjectBranchesPanel(projectName);
|
return new ProjectBranchesPanel(projectName);
|
||||||
}
|
}
|
||||||
}, Util.C.projectAdminTabBranches());
|
}, Util.C.projectAdminTabBranches());
|
||||||
tabTokens.add(HistoryHandler.toProjectAdmin(projectName, BRANCH_TAB));
|
tabTokens.add(Dispatcher.toProjectAdmin(projectName, BRANCH_TAB));
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs.add(new LazyPanel() {
|
tabs.add(new LazyPanel() {
|
||||||
@@ -89,12 +101,12 @@ public class ProjectAdminScreen extends AccountScreen {
|
|||||||
return new ProjectRightsPanel(projectName);
|
return new ProjectRightsPanel(projectName);
|
||||||
}
|
}
|
||||||
}, Util.C.projectAdminTabAccess());
|
}, Util.C.projectAdminTabAccess());
|
||||||
tabTokens.add(HistoryHandler.toProjectAdmin(projectName, ACCESS_TAB));
|
tabTokens.add(Dispatcher.toProjectAdmin(projectName, ACCESS_TAB));
|
||||||
|
|
||||||
tabs.addSelectionHandler(new SelectionHandler<Integer>() {
|
tabs.addSelectionHandler(new SelectionHandler<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelection(final SelectionEvent<Integer> event) {
|
public void onSelection(final SelectionEvent<Integer> event) {
|
||||||
Gerrit.display(tabTokens.get(event.getSelectedItem()), false);
|
setToken(tabTokens.get(event.getSelectedItem()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
package com.google.gerrit.client.admin;
|
package com.google.gerrit.client.admin;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||||
import com.google.gerrit.client.ui.AccountScreen;
|
import com.google.gerrit.client.ui.AccountScreen;
|
||||||
import com.google.gerrit.client.ui.NavigationTable;
|
import com.google.gerrit.client.ui.NavigationTable;
|
||||||
@@ -26,7 +26,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
|||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.KeyCodes;
|
import com.google.gwt.event.dom.client.KeyCodes;
|
||||||
import com.google.gwt.user.client.History;
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.ui.Hyperlink;
|
import com.google.gerrit.client.ui.Hyperlink;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
||||||
@@ -105,7 +105,7 @@ public class ProjectListScreen extends AccountScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String link(final Project item) {
|
private String link(final Project item) {
|
||||||
return HistoryHandler.toProjectAdmin(item.getNameKey(), ProjectAdminScreen.INFO_TAB);
|
return Dispatcher.toProjectAdmin(item.getNameKey(), ProjectAdminScreen.INFO_TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display(final List<Project> result) {
|
void display(final List<Project> result) {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import com.google.gwt.user.client.Command;
|
|||||||
import com.google.gwt.user.client.Cookies;
|
import com.google.gwt.user.client.Cookies;
|
||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.DeferredCommand;
|
import com.google.gwt.user.client.DeferredCommand;
|
||||||
import com.google.gwt.user.client.History;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.CheckBox;
|
import com.google.gwt.user.client.ui.CheckBox;
|
||||||
@@ -67,9 +66,9 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
|||||||
private CheckBox rememberId;
|
private CheckBox rememberId;
|
||||||
private boolean discovering;
|
private boolean discovering;
|
||||||
|
|
||||||
public OpenIdSignInDialog(final SignInMode requestedMode,
|
public OpenIdSignInDialog(final SignInMode requestedMode, final String token,
|
||||||
final String initialErrorMsg) {
|
final String initialErrorMsg) {
|
||||||
super(requestedMode);
|
super(requestedMode, token);
|
||||||
|
|
||||||
formBody = new FlowPanel();
|
formBody = new FlowPanel();
|
||||||
formBody.setStyleName(OpenIdResources.I.css().loginForm());
|
formBody.setStyleName(OpenIdResources.I.css().loginForm());
|
||||||
@@ -94,8 +93,10 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
|||||||
createErrorBox();
|
createErrorBox();
|
||||||
createIdentBox();
|
createIdentBox();
|
||||||
|
|
||||||
link(OpenIdUrls.URL_GOOGLE, OpenIdUtil.C.nameGoogle(), OpenIdResources.I.iconGoogle());
|
link(OpenIdUrls.URL_GOOGLE, OpenIdUtil.C.nameGoogle(), OpenIdResources.I
|
||||||
link(OpenIdUrls.URL_YAHOO, OpenIdUtil.C.nameYahoo(), OpenIdResources.I.iconYahoo());
|
.iconGoogle());
|
||||||
|
link(OpenIdUrls.URL_YAHOO, OpenIdUtil.C.nameYahoo(), OpenIdResources.I
|
||||||
|
.iconYahoo());
|
||||||
|
|
||||||
if (initialErrorMsg != null) {
|
if (initialErrorMsg != null) {
|
||||||
showError(initialErrorMsg);
|
showError(initialErrorMsg);
|
||||||
@@ -313,7 +314,6 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
|||||||
hideError();
|
hideError();
|
||||||
|
|
||||||
final boolean remember = rememberId != null && rememberId.getValue();
|
final boolean remember = rememberId != null && rememberId.getValue();
|
||||||
final String token = History.getToken();
|
|
||||||
OpenIdUtil.SVC.discover(openidIdentifier, mode, remember, token,
|
OpenIdUtil.SVC.discover(openidIdentifier, mode, remember, token,
|
||||||
new GerritCallback<DiscoveryResult>() {
|
new GerritCallback<DiscoveryResult>() {
|
||||||
public void onSuccess(final DiscoveryResult result) {
|
public void onSuccess(final DiscoveryResult result) {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.google.gwt.event.dom.client.KeyPressHandler;
|
|||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.DeferredCommand;
|
import com.google.gwt.user.client.DeferredCommand;
|
||||||
import com.google.gwt.user.client.History;
|
|
||||||
import com.google.gwt.user.client.Window.Location;
|
import com.google.gwt.user.client.Window.Location;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
@@ -55,8 +54,8 @@ public class UserPassSignInDialog extends SignInDialog {
|
|||||||
private TextBox username;
|
private TextBox username;
|
||||||
private TextBox password;
|
private TextBox password;
|
||||||
|
|
||||||
public UserPassSignInDialog(final String initialErrorMsg) {
|
public UserPassSignInDialog(final String token, final String initialErrorMsg) {
|
||||||
super(SignInMode.SIGN_IN);
|
super(SignInMode.SIGN_IN, token);
|
||||||
|
|
||||||
formBody = new FlowPanel();
|
formBody = new FlowPanel();
|
||||||
formBody.setStyleName(UserPassResources.I.css().loginForm());
|
formBody.setStyleName(UserPassResources.I.css().loginForm());
|
||||||
@@ -199,9 +198,9 @@ public class UserPassSignInDialog extends SignInDialog {
|
|||||||
Util.SVC.authenticate(user, pass, new GerritCallback<LoginResult>() {
|
Util.SVC.authenticate(user, pass, new GerritCallback<LoginResult>() {
|
||||||
public void onSuccess(final LoginResult result) {
|
public void onSuccess(final LoginResult result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
String token = History.getToken();
|
String to = token;
|
||||||
if (result.isNew && !token.startsWith(PageLinks.REGISTER + ",")) {
|
if (result.isNew && !to.startsWith(PageLinks.REGISTER + ",")) {
|
||||||
token = PageLinks.REGISTER + "," + token;
|
to = PageLinks.REGISTER + "," + to;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unfortunately we no longer support updating the web UI when the
|
// Unfortunately we no longer support updating the web UI when the
|
||||||
@@ -209,7 +208,7 @@ public class UserPassSignInDialog extends SignInDialog {
|
|||||||
// that isn't easy because we might need to change the anchor. So
|
// that isn't easy because we might need to change the anchor. So
|
||||||
// we bounce through a little redirection servlet on the server.
|
// we bounce through a little redirection servlet on the server.
|
||||||
//
|
//
|
||||||
Location.replace(Location.getPath() + "login/" + token);
|
Location.replace(Location.getPath() + "login/" + to);
|
||||||
} else {
|
} else {
|
||||||
showError(Util.C.invalidLogin());
|
showError(Util.C.invalidLogin());
|
||||||
enable(true);
|
enable(true);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.google.gwt.event.dom.client.KeyPressEvent;
|
|||||||
import com.google.gwt.user.client.History;
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Hyperlink;
|
import com.google.gerrit.client.ui.Hyperlink;
|
||||||
import com.google.gwtexpui.globalkey.client.KeyCommand;
|
import com.google.gwtexpui.globalkey.client.KeyCommand;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -370,9 +370,9 @@ public class ChangeScreen extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void onKeyPress(final KeyPressEvent event) {
|
public void onKeyPress(final KeyPressEvent event) {
|
||||||
if (Gerrit.isSignedIn()) {
|
if (Gerrit.isSignedIn()) {
|
||||||
Gerrit.display(PageLinks.MINE, true);
|
Gerrit.display(PageLinks.MINE);
|
||||||
} else {
|
} else {
|
||||||
Gerrit.display(PageLinks.ALL_OPEN, true);
|
Gerrit.display(PageLinks.ALL_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ package com.google.gerrit.client.changes;
|
|||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.patches.PatchScreen;
|
import com.google.gerrit.client.patches.PatchScreen;
|
||||||
import com.google.gerrit.client.ui.DirectScreenLink;
|
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||||
import com.google.gerrit.client.ui.NavigationTable;
|
import com.google.gerrit.client.ui.NavigationTable;
|
||||||
import com.google.gerrit.client.ui.PatchLink;
|
import com.google.gerrit.client.ui.PatchLink;
|
||||||
import com.google.gerrit.reviewdb.Patch;
|
import com.google.gerrit.reviewdb.Patch;
|
||||||
@@ -102,7 +102,7 @@ public class PatchTable extends Composite {
|
|||||||
/**
|
/**
|
||||||
* @return a link to the previous file in this patch set, or null.
|
* @return a link to the previous file in this patch set, or null.
|
||||||
*/
|
*/
|
||||||
public DirectScreenLink getPreviousPatchLink(int index, PatchScreen.Type patchType) {
|
public InlineHyperlink getPreviousPatchLink(int index, PatchScreen.Type patchType) {
|
||||||
if (0 < index)
|
if (0 < index)
|
||||||
return createLink(index - 1, patchType, SafeHtml.asis(Util.C
|
return createLink(index - 1, patchType, SafeHtml.asis(Util.C
|
||||||
.prevPatchLinkIcon()), null);
|
.prevPatchLinkIcon()), null);
|
||||||
@@ -112,7 +112,7 @@ public class PatchTable extends Composite {
|
|||||||
/**
|
/**
|
||||||
* @return a link to the next file in this patch set, or null.
|
* @return a link to the next file in this patch set, or null.
|
||||||
*/
|
*/
|
||||||
public DirectScreenLink getNextPatchLink(int index, PatchScreen.Type patchType) {
|
public InlineHyperlink getNextPatchLink(int index, PatchScreen.Type patchType) {
|
||||||
if (index < patchList.size() - 1)
|
if (index < patchList.size() - 1)
|
||||||
return createLink(index + 1, patchType, null, SafeHtml.asis(Util.C
|
return createLink(index + 1, patchType, null, SafeHtml.asis(Util.C
|
||||||
.nextPatchLinkIcon()));
|
.nextPatchLinkIcon()));
|
||||||
@@ -457,8 +457,8 @@ public class PatchTable extends Composite {
|
|||||||
if (link instanceof FlowPanel) {
|
if (link instanceof FlowPanel) {
|
||||||
link = ((FlowPanel) link).getWidget(0);
|
link = ((FlowPanel) link).getWidget(0);
|
||||||
}
|
}
|
||||||
if (link instanceof DirectScreenLink) {
|
if (link instanceof InlineHyperlink) {
|
||||||
((DirectScreenLink) link).go();
|
((InlineHyperlink) link).go();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.google.gwt.event.shared.HandlerRegistration;
|
|||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.Element;
|
import com.google.gwt.user.client.Element;
|
||||||
import com.google.gwt.user.client.Event;
|
import com.google.gwt.user.client.Event;
|
||||||
|
import com.google.gwt.user.client.History;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.google.gwt.user.client.ui.UIObject;
|
import com.google.gwt.user.client.ui.UIObject;
|
||||||
@@ -310,7 +311,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Gerrit.isSignedIn()) {
|
if (!Gerrit.isSignedIn()) {
|
||||||
Gerrit.doSignIn();
|
Gerrit.doSignIn(History.getToken());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import static com.google.gerrit.reviewdb.AccountGeneralPreferences.DEFAULT_CONTE
|
|||||||
import static com.google.gerrit.reviewdb.AccountGeneralPreferences.WHOLE_FILE_CONTEXT;
|
import static com.google.gerrit.reviewdb.AccountGeneralPreferences.WHOLE_FILE_CONTEXT;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.changes.ChangeScreen;
|
import com.google.gerrit.client.changes.ChangeScreen;
|
||||||
import com.google.gerrit.client.changes.PatchTable;
|
import com.google.gerrit.client.changes.PatchTable;
|
||||||
import com.google.gerrit.client.changes.Util;
|
import com.google.gerrit.client.changes.Util;
|
||||||
import com.google.gerrit.client.rpc.GerritCallback;
|
import com.google.gerrit.client.rpc.GerritCallback;
|
||||||
import com.google.gerrit.client.ui.ChangeLink;
|
import com.google.gerrit.client.ui.ChangeLink;
|
||||||
import com.google.gerrit.client.ui.DirectScreenLink;
|
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||||
import com.google.gerrit.client.ui.Screen;
|
import com.google.gerrit.client.ui.Screen;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.common.data.CommentDetail;
|
import com.google.gerrit.common.data.CommentDetail;
|
||||||
@@ -144,10 +144,10 @@ public abstract class PatchScreen extends Screen {
|
|||||||
private HandlerRegistration regNavigation;
|
private HandlerRegistration regNavigation;
|
||||||
|
|
||||||
/** Link to the screen for the previous file, null if not applicable */
|
/** Link to the screen for the previous file, null if not applicable */
|
||||||
private DirectScreenLink previousFileLink;
|
private InlineHyperlink previousFileLink;
|
||||||
|
|
||||||
/** Link to the screen for the next file, null if not applicable */
|
/** Link to the screen for the next file, null if not applicable */
|
||||||
private DirectScreenLink nextFileLink;
|
private InlineHyperlink nextFileLink;
|
||||||
|
|
||||||
private static final char SHORTCUT_PREVIOUS_FILE = '[';
|
private static final char SHORTCUT_PREVIOUS_FILE = '[';
|
||||||
private static final char SHORTCUT_NEXT_FILE = ']';
|
private static final char SHORTCUT_NEXT_FILE = ']';
|
||||||
@@ -244,7 +244,7 @@ public abstract class PatchScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installLinkShortCut(final DirectScreenLink link, char shortcut,
|
private void installLinkShortCut(final InlineHyperlink link, char shortcut,
|
||||||
String help) {
|
String help) {
|
||||||
keysNavigation.add(new KeyCommand(0, shortcut, help) {
|
keysNavigation.add(new KeyCommand(0, shortcut, help) {
|
||||||
@Override
|
@Override
|
||||||
@@ -483,7 +483,7 @@ public abstract class PatchScreen extends Screen {
|
|||||||
contentTable = new UnifiedDiffTable();
|
contentTable = new UnifiedDiffTable();
|
||||||
contentTable.fileList = fileList;
|
contentTable.fileList = fileList;
|
||||||
contentPanel.add(contentTable);
|
contentPanel.add(contentTable);
|
||||||
History.newItem(HistoryHandler.toPatchUnified(patchKey), false);
|
setToken(Dispatcher.toPatchUnified(patchKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDifferences) {
|
if (hasDifferences) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public abstract class ScreenLoadCallback<T> extends GerritCallback<T> {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(final Throwable caught) {
|
public void onFailure(final Throwable caught) {
|
||||||
if (isNoSuchEntity(caught)) {
|
if (isNoSuchEntity(caught)) {
|
||||||
Gerrit.display(new NotFoundScreen());
|
Gerrit.display(screen.getToken(), new NotFoundScreen());
|
||||||
} else {
|
} else {
|
||||||
super.onFailure(caught);
|
super.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.google.gerrit.common.data.AccountInfoCache;
|
|||||||
import com.google.gerrit.reviewdb.Account;
|
import com.google.gerrit.reviewdb.Account;
|
||||||
|
|
||||||
/** Link to any user's account dashboard. */
|
/** Link to any user's account dashboard. */
|
||||||
public class AccountDashboardLink extends DirectScreenLink {
|
public class AccountDashboardLink extends InlineHyperlink {
|
||||||
/** Create a link after locating account details from an active cache. */
|
/** Create a link after locating account details from an active cache. */
|
||||||
public static AccountDashboardLink link(final AccountInfoCache cache,
|
public static AccountDashboardLink link(final AccountInfoCache cache,
|
||||||
final Account.Id id) {
|
final Account.Id id) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.google.gerrit.reviewdb.Change;
|
|||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
|
|
||||||
public class ChangeLink extends DirectScreenLink {
|
public class ChangeLink extends InlineHyperlink {
|
||||||
public static String permalink(final Change.Id c) {
|
public static String permalink(final Change.Id c) {
|
||||||
return GWT.getHostPageBaseURL() + c.get();
|
return GWT.getHostPageBaseURL() + c.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
// Copyright (C) 2008 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package com.google.gerrit.client.ui;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.Gerrit;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.DOM;
|
||||||
|
import com.google.gwt.user.client.Event;
|
||||||
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
|
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
|
||||||
|
|
||||||
|
/** Standard GWT hyperlink with late updating of the token. */
|
||||||
|
public class Hyperlink extends com.google.gwt.user.client.ui.Hyperlink {
|
||||||
|
static final HyperlinkImpl impl = GWT.create(HyperlinkImpl.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a hyperlink with its text and target history token specified.
|
||||||
|
*
|
||||||
|
* @param text the hyperlink's text
|
||||||
|
* @param token the history token to which it will link, which may not be null
|
||||||
|
* (use {@link Anchor} instead if you don't need history processing)
|
||||||
|
*/
|
||||||
|
public Hyperlink(final String text, final String token) {
|
||||||
|
super(text, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a hyperlink with its text and target history token specified.
|
||||||
|
*
|
||||||
|
* @param text the hyperlink's text
|
||||||
|
* @param asHTML <code>true</code> to treat the specified text as html
|
||||||
|
* @param token the history token to which it will link
|
||||||
|
* @see #setTargetHistoryToken
|
||||||
|
*/
|
||||||
|
public Hyperlink(String text, boolean asHTML, String token) {
|
||||||
|
super(text, asHTML, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(final Event event) {
|
||||||
|
if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
|
||||||
|
DOM.eventPreventDefault(event);
|
||||||
|
go();
|
||||||
|
} else {
|
||||||
|
super.onBrowserEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create the screen and start rendering, updating the browser history. */
|
||||||
|
public void go() {
|
||||||
|
Gerrit.display(getTargetHistoryToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,30 +14,23 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.ui;
|
package com.google.gerrit.client.ui;
|
||||||
|
|
||||||
import static com.google.gerrit.client.ui.LinkMenuItem.impl;
|
import static com.google.gerrit.client.ui.Hyperlink.impl;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.Event;
|
import com.google.gwt.user.client.Event;
|
||||||
import com.google.gwt.user.client.ui.InlineHyperlink;
|
|
||||||
|
|
||||||
/**
|
/** Standard GWT hyperlink with late updating of the token. */
|
||||||
* Link to a Screen which can carry richer payload.
|
public class InlineHyperlink extends
|
||||||
* <p>
|
com.google.gwt.user.client.ui.InlineHyperlink {
|
||||||
* A standard Hyperlink widget which updates the current history token when
|
|
||||||
* activated, but subclasses are able to create the Screen instance themselves,
|
|
||||||
* passing additional data into the Screen's constructor. This may permit the
|
|
||||||
* screen to show some limited information early, before RPCs required to fully
|
|
||||||
* populate it are even started.
|
|
||||||
*/
|
|
||||||
public abstract class DirectScreenLink extends InlineHyperlink {
|
|
||||||
/**
|
/**
|
||||||
* Creates a link with its text and target history token specified.
|
* Creates a link with its text and target history token specified.
|
||||||
*
|
*
|
||||||
* @param text the hyperlink's text
|
* @param text the hyperlink's text
|
||||||
* @param historyToken the history token to which it will link
|
* @param token the history token to which it will link
|
||||||
*/
|
*/
|
||||||
protected DirectScreenLink(final String text, final String historyToken) {
|
public InlineHyperlink(final String text, final String token) {
|
||||||
super(text, historyToken);
|
super(text, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,9 +38,13 @@ public abstract class DirectScreenLink extends InlineHyperlink {
|
|||||||
if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
|
if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
|
||||||
DOM.eventPreventDefault(event);
|
DOM.eventPreventDefault(event);
|
||||||
go();
|
go();
|
||||||
|
} else {
|
||||||
|
super.onBrowserEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create the screen and start rendering, updating the browser history. */
|
/** Create the screen and start rendering, updating the browser history. */
|
||||||
public abstract void go();
|
public void go() {
|
||||||
|
Gerrit.display(getTargetHistoryToken());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,17 +15,10 @@
|
|||||||
package com.google.gerrit.client.ui;
|
package com.google.gerrit.client.ui;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.dom.client.AnchorElement;
|
import com.google.gwt.dom.client.AnchorElement;
|
||||||
import com.google.gwt.user.client.DOM;
|
|
||||||
import com.google.gwt.user.client.Event;
|
|
||||||
import com.google.gwt.user.client.ui.Accessibility;
|
import com.google.gwt.user.client.ui.Accessibility;
|
||||||
import com.google.gwt.user.client.ui.InlineHyperlink;
|
|
||||||
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
|
|
||||||
|
|
||||||
public class LinkMenuItem extends InlineHyperlink {
|
public class LinkMenuItem extends InlineHyperlink {
|
||||||
static final HyperlinkImpl impl = GWT.create(HyperlinkImpl.class);
|
|
||||||
|
|
||||||
public LinkMenuItem(final String text, final String targetHistoryToken) {
|
public LinkMenuItem(final String text, final String targetHistoryToken) {
|
||||||
super(text, targetHistoryToken);
|
super(text, targetHistoryToken);
|
||||||
setStyleName(Gerrit.RESOURCES.css().menuItem());
|
setStyleName(Gerrit.RESOURCES.css().menuItem());
|
||||||
@@ -33,10 +26,8 @@ public class LinkMenuItem extends InlineHyperlink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBrowserEvent(Event event) {
|
public void go() {
|
||||||
super.onBrowserEvent(event);
|
super.go();
|
||||||
if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
|
|
||||||
AnchorElement.as(getElement()).blur();
|
AnchorElement.as(getElement()).blur();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,12 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.ui;
|
package com.google.gerrit.client.ui;
|
||||||
|
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.changes.PatchTable;
|
import com.google.gerrit.client.changes.PatchTable;
|
||||||
import com.google.gerrit.reviewdb.Patch;
|
import com.google.gerrit.reviewdb.Patch;
|
||||||
|
import com.google.gwt.user.client.History;
|
||||||
|
|
||||||
public abstract class PatchLink extends DirectScreenLink {
|
public abstract class PatchLink extends InlineHyperlink {
|
||||||
protected Patch.Key patchKey;
|
protected Patch.Key patchKey;
|
||||||
protected int patchIndex;
|
protected int patchIndex;
|
||||||
protected PatchTable parentPatchTable;
|
protected PatchTable parentPatchTable;
|
||||||
@@ -41,7 +42,7 @@ public abstract class PatchLink extends DirectScreenLink {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void go() {
|
public void go() {
|
||||||
HistoryHandler.patch( //
|
Dispatcher.patch( //
|
||||||
getTargetHistoryToken(), //
|
getTargetHistoryToken(), //
|
||||||
patchKey, //
|
patchKey, //
|
||||||
patchIndex, //
|
patchIndex, //
|
||||||
@@ -52,7 +53,7 @@ public abstract class PatchLink extends DirectScreenLink {
|
|||||||
public static class SideBySide extends PatchLink {
|
public static class SideBySide extends PatchLink {
|
||||||
public SideBySide(final String text, final Patch.Key patchKey,
|
public SideBySide(final String text, final Patch.Key patchKey,
|
||||||
final int patchIndex, PatchTable parentPatchTable) {
|
final int patchIndex, PatchTable parentPatchTable) {
|
||||||
super(text, patchKey, patchIndex, HistoryHandler
|
super(text, patchKey, patchIndex, Dispatcher
|
||||||
.toPatchSideBySide(patchKey), parentPatchTable);
|
.toPatchSideBySide(patchKey), parentPatchTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +62,7 @@ public abstract class PatchLink extends DirectScreenLink {
|
|||||||
public Unified(final String text, final Patch.Key patchKey,
|
public Unified(final String text, final Patch.Key patchKey,
|
||||||
final int patchIndex, PatchTable parentPatchTable) {
|
final int patchIndex, PatchTable parentPatchTable) {
|
||||||
super(text, patchKey, patchIndex,
|
super(text, patchKey, patchIndex,
|
||||||
HistoryHandler.toPatchUnified(patchKey), parentPatchTable);
|
Dispatcher.toPatchUnified(patchKey), parentPatchTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
package com.google.gerrit.client.ui;
|
package com.google.gerrit.client.ui;
|
||||||
|
|
||||||
import com.google.gerrit.client.Gerrit;
|
import com.google.gerrit.client.Gerrit;
|
||||||
import com.google.gerrit.client.HistoryHandler;
|
import com.google.gerrit.client.Dispatcher;
|
||||||
import com.google.gerrit.client.changes.ByProjectAbandonedChangesScreen;
|
import com.google.gerrit.client.changes.ByProjectAbandonedChangesScreen;
|
||||||
import com.google.gerrit.client.changes.ByProjectMergedChangesScreen;
|
import com.google.gerrit.client.changes.ByProjectMergedChangesScreen;
|
||||||
import com.google.gerrit.client.changes.ByProjectOpenChangesScreen;
|
import com.google.gerrit.client.changes.ByProjectOpenChangesScreen;
|
||||||
@@ -24,7 +24,7 @@ import com.google.gerrit.reviewdb.Project;
|
|||||||
import com.google.gerrit.reviewdb.Change.Status;
|
import com.google.gerrit.reviewdb.Change.Status;
|
||||||
|
|
||||||
/** Link to the open changes of a project. */
|
/** Link to the open changes of a project. */
|
||||||
public class ProjectLink extends DirectScreenLink {
|
public class ProjectLink extends InlineHyperlink {
|
||||||
private Project.NameKey project;
|
private Project.NameKey project;
|
||||||
private Status status;
|
private Status status;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public class ProjectLink extends DirectScreenLink {
|
|||||||
|
|
||||||
public ProjectLink(final String text, final Project.NameKey proj,
|
public ProjectLink(final String text, final Project.NameKey proj,
|
||||||
Change.Status stat) {
|
Change.Status stat) {
|
||||||
super(text, HistoryHandler.toProject(proj, stat));
|
super(text, Dispatcher.toProject(proj, stat));
|
||||||
status = stat;
|
status = stat;
|
||||||
project = proj;
|
project = proj;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public abstract class Screen extends View {
|
|||||||
private FlowPanel header;
|
private FlowPanel header;
|
||||||
private InlineLabel headerText;
|
private InlineLabel headerText;
|
||||||
private FlowPanel body;
|
private FlowPanel body;
|
||||||
|
private String token;
|
||||||
private boolean requiresSignIn;
|
private boolean requiresSignIn;
|
||||||
private String windowTitle;
|
private String windowTitle;
|
||||||
|
|
||||||
@@ -75,6 +76,31 @@ public abstract class Screen extends View {
|
|||||||
body.add(w);
|
body.add(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the history token for this screen. */
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set the history token for this screen. */
|
||||||
|
public void setToken(final String t) {
|
||||||
|
assert t != null && !t.isEmpty();
|
||||||
|
token = t;
|
||||||
|
|
||||||
|
if (isCurrentView()) {
|
||||||
|
Gerrit.updateImpl(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this view can display the given token, update it.
|
||||||
|
*
|
||||||
|
* @param newToken token the UI wants to show.
|
||||||
|
* @return true if this view can show the token immediately, false if not.
|
||||||
|
*/
|
||||||
|
public boolean displayToken(String newToken) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Set whether or not {@link Gerrit#isSignedIn()} must be true. */
|
/** Set whether or not {@link Gerrit#isSignedIn()} must be true. */
|
||||||
public final void setRequiresSignIn(final boolean b) {
|
public final void setRequiresSignIn(final boolean b) {
|
||||||
requiresSignIn = b;
|
requiresSignIn = b;
|
||||||
|
|||||||
Reference in New Issue
Block a user