Rename AccountPreferencesInfo to GeneralPreferences

Change-Id: I05a0ad236b635dd707f7d1997d8943b3f39d3864
This commit is contained in:
David Ostrovsky 2016-01-22 17:55:25 +01:00
parent 195eff5911
commit 70e4a9024a
10 changed files with 41 additions and 41 deletions

View File

@ -14,7 +14,7 @@
package com.google.gerrit.client;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gwt.i18n.client.DateTimeFormat;
import java.util.Date;
@ -28,7 +28,7 @@ public class DateFormatter {
private final DateTimeFormat mDate;
private final DateTimeFormat dtfmt;
public DateFormatter(AccountPreferencesInfo prefs) {
public DateFormatter(GeneralPreferences prefs) {
String fmt_sTime = prefs.timeFormat().getFormat();
String fmt_sDate = prefs.dateFormat().getShortFormat();
String fmt_mDate = prefs.dateFormat().getLongFormat();

View File

@ -31,15 +31,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AccountPreferencesInfo extends JavaScriptObject {
public static AccountPreferencesInfo create() {
public class GeneralPreferences extends JavaScriptObject {
public static GeneralPreferences create() {
return createObject().cast();
}
public static AccountPreferencesInfo createDefault() {
public static GeneralPreferences createDefault() {
AccountGeneralPreferences defaultPrefs =
AccountGeneralPreferences.createDefault();
AccountPreferencesInfo p = createObject().cast();
GeneralPreferences p = createObject().cast();
p.changesPerPage(defaultPrefs.getMaximumPageSize());
p.showSiteHeader(defaultPrefs.isShowSiteHeader());
p.useFlashClipboard(defaultPrefs.isUseFlashClipboard());
@ -223,6 +223,6 @@ public class AccountPreferencesInfo extends JavaScriptObject {
private final native void putUrlAlias(String m, String t) /*-{ this.url_aliases[m] = t; }-*/;
private final native void initUrlAliases() /*-{ this.url_aliases = {}; }-*/;
protected AccountPreferencesInfo() {
protected GeneralPreferences() {
}
}

View File

@ -16,7 +16,7 @@ package com.google.gerrit.client;
import com.google.gerrit.client.change.Resources;
import com.google.gerrit.client.info.AccountInfo;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gwt.i18n.client.NumberFormat;
@ -26,7 +26,7 @@ import java.util.Date;
public class FormatUtil {
private static DateFormatter dateFormatter;
public static void setPreferences(AccountPreferencesInfo prefs) {
public static void setPreferences(GeneralPreferences prefs) {
dateFormatter = new DateFormatter(prefs);
}

View File

@ -31,8 +31,8 @@ import com.google.gerrit.client.changes.ChangeListScreen;
import com.google.gerrit.client.config.ConfigServerApi;
import com.google.gerrit.client.documentation.DocInfo;
import com.google.gerrit.client.info.AccountInfo;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.AuthInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.info.ServerInfo;
import com.google.gerrit.client.info.TopMenu;
import com.google.gerrit.client.info.TopMenuItem;
@ -115,7 +115,7 @@ public class Gerrit implements EntryPoint {
private static String myHost;
private static ServerInfo myServerInfo;
private static AccountInfo myAccount;
private static AccountPreferencesInfo myPrefs;
private static GeneralPreferences myPrefs;
private static UrlAliasMatcher urlAliasMatcher;
private static boolean hasDocumentation;
private static boolean docSearch;
@ -323,7 +323,7 @@ public class Gerrit implements EntryPoint {
}
/** @return the preferences of the currently signed in user, the default preferences if not signed in */
public static AccountPreferencesInfo getUserPreferences() {
public static GeneralPreferences getUserPreferences() {
return myPrefs;
}
@ -409,7 +409,7 @@ public class Gerrit implements EntryPoint {
myAccount = AccountInfo.create(0, null, null, null);
myAccountDiffPref = null;
editPrefs = null;
myPrefs = AccountPreferencesInfo.createDefault();
myPrefs = GeneralPreferences.createDefault();
urlAliasMatcher.clearUserAliases();
xGerritAuth = null;
refreshMenuBar();
@ -514,9 +514,9 @@ public class Gerrit implements EntryPoint {
}
}));
AccountApi.self().view("preferences")
.get(cbg.add(new GerritCallback<AccountPreferencesInfo>() {
.get(cbg.add(new GerritCallback<GeneralPreferences>() {
@Override
public void onSuccess(AccountPreferencesInfo prefs) {
public void onSuccess(GeneralPreferences prefs) {
myPrefs = prefs;
onModuleLoad2(result);
}
@ -532,7 +532,7 @@ public class Gerrit implements EntryPoint {
}));
} else {
myAccount = AccountInfo.create(0, null, null, null);
myPrefs = AccountPreferencesInfo.createDefault();
myPrefs = GeneralPreferences.createDefault();
editPrefs = null;
onModuleLoad2(result);
}
@ -891,18 +891,18 @@ public class Gerrit implements EntryPoint {
public static void refreshUserPreferences() {
if (isSignedIn()) {
AccountApi.self().view("preferences")
.get(new GerritCallback<AccountPreferencesInfo>() {
.get(new GerritCallback<GeneralPreferences>() {
@Override
public void onSuccess(AccountPreferencesInfo prefs) {
public void onSuccess(GeneralPreferences prefs) {
setUserPreferences(prefs);
}
});
} else {
setUserPreferences(AccountPreferencesInfo.createDefault());
setUserPreferences(GeneralPreferences.createDefault());
}
}
public static void setUserPreferences(AccountPreferencesInfo prefs) {
public static void setUserPreferences(GeneralPreferences prefs) {
myPrefs = prefs;
applyUserPreferences();
refreshMenuBar();

View File

@ -22,7 +22,7 @@ import com.google.gerrit.client.GerritUiExtensionPoint;
import com.google.gerrit.client.StringListPanel;
import com.google.gerrit.client.api.ExtensionPanel;
import com.google.gerrit.client.config.ConfigServerApi;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.info.TopMenuItem;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.rpc.Natives;
@ -243,9 +243,9 @@ public class MyPreferencesScreen extends SettingsScreen {
add(extensionPanel);
AccountApi.self().view("preferences")
.get(new ScreenLoadCallback<AccountPreferencesInfo>(this) {
.get(new ScreenLoadCallback<GeneralPreferences>(this) {
@Override
public void preDisplay(AccountPreferencesInfo prefs) {
public void preDisplay(GeneralPreferences prefs) {
display(prefs);
}
});
@ -266,7 +266,7 @@ public class MyPreferencesScreen extends SettingsScreen {
emailStrategy.setEnabled(on);
}
private void display(AccountPreferencesInfo p) {
private void display(GeneralPreferences p) {
showSiteHeader.setValue(p.showSiteHeader());
useFlashClipboard.setValue(p.useFlashClipboard());
setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.changesPerPage());
@ -350,7 +350,7 @@ public class MyPreferencesScreen extends SettingsScreen {
}
private void doSave() {
AccountPreferencesInfo p = AccountPreferencesInfo.create();
GeneralPreferences p = GeneralPreferences.create();
p.showSiteHeader(showSiteHeader.getValue());
p.useFlashClipboard(useFlashClipboard.getValue());
p.changesPerPage(getListBox(maximumPageSize, DEFAULT_PAGESIZE));
@ -383,9 +383,9 @@ public class MyPreferencesScreen extends SettingsScreen {
save.setEnabled(false);
AccountApi.self().view("preferences")
.put(p, new GerritCallback<AccountPreferencesInfo>() {
.put(p, new GerritCallback<GeneralPreferences>() {
@Override
public void onSuccess(AccountPreferencesInfo prefs) {
public void onSuccess(GeneralPreferences prefs) {
Gerrit.setUserPreferences(prefs);
enable(true);
display(prefs);
@ -412,9 +412,9 @@ public class MyPreferencesScreen extends SettingsScreen {
@Override
public void onClick(ClickEvent event) {
ConfigServerApi.defaultPreferences(
new GerritCallback<AccountPreferencesInfo>() {
new GerritCallback<GeneralPreferences>() {
@Override
public void onSuccess(AccountPreferencesInfo p) {
public void onSuccess(GeneralPreferences p) {
MyPreferencesScreen.this.display(p.my());
widget.setEnabled(true);
}

View File

@ -17,7 +17,7 @@ package com.google.gerrit.client.api;
import com.google.gerrit.client.ErrorDialog;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.info.AccountInfo;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.info.ServerInfo;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
@ -265,7 +265,7 @@ public class ApiGlue {
return Gerrit.getUserAccount();
}
private static final AccountPreferencesInfo getUserPreferences() {
private static final GeneralPreferences getUserPreferences() {
return Gerrit.getUserPreferences();
}

View File

@ -18,10 +18,10 @@ import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.account.AccountApi;
import com.google.gerrit.client.changes.ChangeApi;
import com.google.gerrit.client.changes.ChangeList;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.ChangeInfo;
import com.google.gerrit.client.info.ChangeInfo.EditInfo;
import com.google.gerrit.client.info.ChangeInfo.FetchInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.rpc.NativeMap;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gerrit.extensions.client.ListChangesOption;
@ -236,10 +236,10 @@ class DownloadBox extends VerticalPanel {
private void saveScheme() {
String schemeStr = scheme.getValue(scheme.getSelectedIndex());
AccountPreferencesInfo prefs = Gerrit.getUserPreferences();
GeneralPreferences prefs = Gerrit.getUserPreferences();
if (Gerrit.isSignedIn() && !schemeStr.equals(prefs.downloadScheme())) {
prefs.downloadScheme(schemeStr);
AccountPreferencesInfo in = AccountPreferencesInfo.create();
GeneralPreferences in = GeneralPreferences.create();
in.downloadScheme(schemeStr);
AccountApi.self().view("preferences")
.put(in, new AsyncCallback<JavaScriptObject>() {

View File

@ -15,7 +15,7 @@
package com.google.gerrit.client.config;
import com.google.gerrit.client.VoidResult;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.info.ServerInfo;
import com.google.gerrit.client.info.TopMenuList;
import com.google.gerrit.client.rpc.NativeMap;
@ -37,7 +37,7 @@ public class ConfigServerApi {
new RestApi("/config/server/top-menus").get(cb);
}
public static void defaultPreferences(AsyncCallback<AccountPreferencesInfo> cb) {
public static void defaultPreferences(AsyncCallback<GeneralPreferences> cb) {
new RestApi("/config/server/preferences").get(cb);
}

View File

@ -16,8 +16,8 @@ package com.google.gerrit.client.download;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.account.AccountApi;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.DownloadInfo.DownloadSchemeInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.dom.client.ClickEvent;
@ -70,10 +70,10 @@ public class DownloadUrlLink extends Anchor implements ClickHandler {
select();
AccountPreferencesInfo prefs = Gerrit.getUserPreferences();
GeneralPreferences prefs = Gerrit.getUserPreferences();
if (Gerrit.isSignedIn() && !schemeName.equals(prefs.downloadScheme())) {
prefs.downloadScheme(schemeName);
AccountPreferencesInfo in = AccountPreferencesInfo.create();
GeneralPreferences in = GeneralPreferences.create();
in.downloadScheme(schemeName);
AccountApi.self().view("preferences")
.put(in, new AsyncCallback<JavaScriptObject>() {

View File

@ -16,7 +16,7 @@ package com.google.gerrit.plugin.client;
import com.google.gerrit.client.GerritUiExtensionPoint;
import com.google.gerrit.client.info.AccountInfo;
import com.google.gerrit.client.info.AccountPreferencesInfo;
import com.google.gerrit.client.info.GeneralPreferences;
import com.google.gerrit.client.info.ServerInfo;
import com.google.gerrit.plugin.client.extension.Panel;
import com.google.gerrit.plugin.client.screen.Screen;
@ -60,7 +60,7 @@ public final class Plugin extends JavaScriptObject {
/*-{ return this.refreshMenuBar() }-*/;
/** @return the preferences of the currently signed in user, the default preferences if not signed in */
public final native AccountPreferencesInfo getUserPreferences()
public final native GeneralPreferences getUserPreferences()
/*-{ return this.getUserPreferences() }-*/;
/** Refresh the user preferences of the current user. */