diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java index b6af366f4b..b3577378d8 100644 --- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java +++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java @@ -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(); diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountPreferencesInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java similarity index 96% rename from gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountPreferencesInfo.java rename to gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java index afde038e77..3848f0af79 100644 --- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountPreferencesInfo.java +++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java @@ -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() { } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java index 1c44ebc076..dd1505c957 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java @@ -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); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java index 139b9c0d1a..a4a8471222 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java @@ -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() { + .get(cbg.add(new GerritCallback() { @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() { + .get(new GerritCallback() { @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(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java index c0b556cd55..b6322c6e49 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java @@ -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(this) { + .get(new ScreenLoadCallback(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() { + .put(p, new GerritCallback() { @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() { + new GerritCallback() { @Override - public void onSuccess(AccountPreferencesInfo p) { + public void onSuccess(GeneralPreferences p) { MyPreferencesScreen.this.display(p.my()); widget.setEnabled(true); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java index f368a79dd4..7a4853325c 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java @@ -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(); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java index c8326cc69d..e8707f42c6 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java @@ -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() { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java index 28812acb74..47393a7015 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java @@ -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 cb) { + public static void defaultPreferences(AsyncCallback cb) { new RestApi("/config/server/preferences").get(cb); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java index 2a3ca5ea87..086376ac72 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java @@ -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() { diff --git a/gerrit-plugin-gwtui/src/main/java/com/google/gerrit/plugin/client/Plugin.java b/gerrit-plugin-gwtui/src/main/java/com/google/gerrit/plugin/client/Plugin.java index 43540722e6..f4f427be1e 100644 --- a/gerrit-plugin-gwtui/src/main/java/com/google/gerrit/plugin/client/Plugin.java +++ b/gerrit-plugin-gwtui/src/main/java/com/google/gerrit/plugin/client/Plugin.java @@ -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. */