Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time. google-java-format is Google's standard formatter and is somewhat inspired by gofmt[1]. This commit formats everything using google-java-format version 1.2. The downside of this one-off formatting is breaking blame. This can be somewhat hacked around with a tool like git-hyper-blame[2], but it's definitely not optimal until/unless this kind of feature makes its way to git core. Not in this change: * Tool support, e.g. Eclipse. The command must be run manually [3]. * Documentation of best practice, e.g. new 100-column default. [1] https://talks.golang.org/2015/gofmt-en.slide#3 [2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html [3] git ls-files | grep java$ | xargs google-java-format -i Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3 Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
committed by
David Pursehouse
parent
6723b6d0fa
commit
292fa154c1
@@ -25,13 +25,14 @@ public class AccountFormatter {
|
||||
|
||||
/**
|
||||
* Formats an account as a name and an email address.
|
||||
* <p>
|
||||
* Example output:
|
||||
*
|
||||
* <p>Example output:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code A U. Thor <author@example.com>}: full populated</li>
|
||||
* <li>{@code A U. Thor (12)}: missing email address</li>
|
||||
* <li>{@code Anonymous Coward <author@example.com>}: missing name</li>
|
||||
* <li>{@code Anonymous Coward (12)}: missing name and email address</li>
|
||||
* <li>{@code A U. Thor <author@example.com>}: full populated
|
||||
* <li>{@code A U. Thor (12)}: missing email address
|
||||
* <li>{@code Anonymous Coward <author@example.com>}: missing name
|
||||
* <li>{@code Anonymous Coward (12)}: missing name and email address
|
||||
* </ul>
|
||||
*/
|
||||
public String nameEmail(AccountInfo info) {
|
||||
@@ -51,9 +52,9 @@ public class AccountFormatter {
|
||||
|
||||
/**
|
||||
* Formats an account name.
|
||||
* <p>
|
||||
* If the account has a full name, it returns only the full name. Otherwise it
|
||||
* returns a longer form that includes the email address.
|
||||
*
|
||||
* <p>If the account has a full name, it returns only the full name. Otherwise it returns a longer
|
||||
* form that includes the email address.
|
||||
*/
|
||||
public String name(AccountInfo ai) {
|
||||
if (ai.name() != null && !ai.name().trim().isEmpty()) {
|
||||
|
||||
@@ -21,16 +21,26 @@ public interface CommonConstants extends Constants {
|
||||
CommonConstants C = GWT.create(CommonConstants.class);
|
||||
|
||||
String inTheFuture();
|
||||
|
||||
String month();
|
||||
|
||||
String months();
|
||||
|
||||
String year();
|
||||
|
||||
String years();
|
||||
|
||||
String oneSecondAgo();
|
||||
|
||||
String oneMinuteAgo();
|
||||
|
||||
String oneHourAgo();
|
||||
|
||||
String oneDayAgo();
|
||||
|
||||
String oneWeekAgo();
|
||||
|
||||
String oneMonthAgo();
|
||||
|
||||
String oneYearAgo();
|
||||
}
|
||||
|
||||
@@ -21,13 +21,20 @@ public interface CommonMessages extends Messages {
|
||||
CommonMessages M = GWT.create(CommonMessages.class);
|
||||
|
||||
String secondsAgo(long seconds);
|
||||
|
||||
String minutesAgo(long minutes);
|
||||
|
||||
String hoursAgo(long hours);
|
||||
|
||||
String daysAgo(long days);
|
||||
|
||||
String weeksAgo(long weeks);
|
||||
|
||||
String monthsAgo(long months);
|
||||
|
||||
String yearsAgo(long years);
|
||||
|
||||
String years0MonthsAgo(long years, String yearLabel);
|
||||
String yearsMonthsAgo(long years, String yearLabel, long months,
|
||||
String monthLabel);
|
||||
|
||||
String yearsMonthsAgo(long years, String yearLabel, long months, String monthLabel);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package com.google.gerrit.client;
|
||||
|
||||
import com.google.gerrit.client.info.GeneralPreferences;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class DateFormatter {
|
||||
|
||||
@@ -34,9 +34,13 @@ public enum GerritUiExtensionPoint {
|
||||
PROFILE_SCREEN_BOTTOM,
|
||||
|
||||
/* ProjectInfoScreen */
|
||||
PROJECT_INFO_SCREEN_TOP, PROJECT_INFO_SCREEN_BOTTOM;
|
||||
PROJECT_INFO_SCREEN_TOP,
|
||||
PROJECT_INFO_SCREEN_BOTTOM;
|
||||
|
||||
public enum Key {
|
||||
ACCOUNT_INFO, CHANGE_INFO, PROJECT_NAME, REVISION_INFO
|
||||
ACCOUNT_INFO,
|
||||
CHANGE_INFO,
|
||||
PROJECT_NAME,
|
||||
REVISION_INFO
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import static com.google.gerrit.client.CommonMessages.M;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Formatter to format timestamps relative to the current time using time units
|
||||
* in the format defined by {@code git log --relative-date}.
|
||||
* Formatter to format timestamps relative to the current time using time units in the format
|
||||
* defined by {@code git log --relative-date}.
|
||||
*/
|
||||
public class RelativeDateFormatter {
|
||||
static final long SECOND_IN_MILLIS = 1000;
|
||||
@@ -34,8 +34,8 @@ public class RelativeDateFormatter {
|
||||
|
||||
/**
|
||||
* @param when {@link Date} to format
|
||||
* @return age of given {@link Date} compared to now formatted in the same
|
||||
* relative format as returned by {@code git log --relative-date}
|
||||
* @return age of given {@link Date} compared to now formatted in the same relative format as
|
||||
* returned by {@code git log --relative-date}
|
||||
*/
|
||||
@SuppressWarnings("boxing")
|
||||
public static String format(Date when) {
|
||||
|
||||
@@ -18,9 +18,7 @@ import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface Resources extends ClientBundle {
|
||||
/**
|
||||
* silk icons (CC-BY3.0): http://famfamfam.com/lab/icons/silk/
|
||||
*/
|
||||
/** silk icons (CC-BY3.0): http://famfamfam.com/lab/icons/silk/ */
|
||||
@Source("note_add.png")
|
||||
ImageResource addFileComment();
|
||||
|
||||
@@ -98,10 +96,7 @@ public interface Resources extends ClientBundle {
|
||||
@Source("help.png")
|
||||
ImageResource question();
|
||||
|
||||
/**
|
||||
* tango icon library (public domain):
|
||||
* http://tango.freedesktop.org/Tango_Icon_Library
|
||||
*/
|
||||
/** tango icon library (public domain): http://tango.freedesktop.org/Tango_Icon_Library */
|
||||
@Source("goNext.png")
|
||||
ImageResource goNext();
|
||||
|
||||
@@ -118,18 +113,14 @@ public interface Resources extends ClientBundle {
|
||||
@Source("merge.png")
|
||||
ImageResource merge();
|
||||
|
||||
/**
|
||||
* contributed by the artist under Apache2.0
|
||||
*/
|
||||
/** contributed by the artist under Apache2.0 */
|
||||
@Source("sideBySideDiff.png")
|
||||
ImageResource sideBySideDiff();
|
||||
|
||||
@Source("unifiedDiff.png")
|
||||
ImageResource unifiedDiff();
|
||||
|
||||
/**
|
||||
* contributed by the artist under CC-BY3.0
|
||||
*/
|
||||
/** contributed by the artist under CC-BY3.0 */
|
||||
@Source("diffy26.png")
|
||||
ImageResource gerritAvatar26();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class AccountInfo extends JavaScriptObject {
|
||||
@@ -28,10 +27,13 @@ public class AccountInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native int _accountId() /*-{ return this._account_id || 0; }-*/;
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String email() /*-{ return this.email; }-*/;
|
||||
public final native JsArrayString secondaryEmails()
|
||||
/*-{ return this.secondary_emails; }-*/;
|
||||
|
||||
public final native JsArrayString secondaryEmails() /*-{ return this.secondary_emails; }-*/;
|
||||
|
||||
public final native String username() /*-{ return this.username; }-*/;
|
||||
|
||||
public final Timestamp registeredOn() {
|
||||
@@ -44,17 +46,17 @@ public class AccountInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
private native String registeredOnRaw() /*-{ return this.registered_on; }-*/;
|
||||
|
||||
private native Timestamp _getRegisteredOn() /*-{ return this._cts; }-*/;
|
||||
|
||||
private native void _setRegisteredOn(Timestamp ts) /*-{ this._cts = ts; }-*/;
|
||||
|
||||
/**
|
||||
* @return true if the server supplied avatar information about this account.
|
||||
* The information may be an empty list, indicating no avatars are
|
||||
* available, such as when no plugin is installed. This method returns
|
||||
* false if the server did not check on avatars for the account.
|
||||
* @return true if the server supplied avatar information about this account. The information may
|
||||
* be an empty list, indicating no avatars are available, such as when no plugin is installed.
|
||||
* This method returns false if the server did not check on avatars for the account.
|
||||
*/
|
||||
public final native boolean hasAvatarInfo()
|
||||
/*-{ return this.hasOwnProperty('avatars') }-*/;
|
||||
public final native boolean hasAvatarInfo() /*-{ return this.hasOwnProperty('avatars') }-*/;
|
||||
|
||||
public final AvatarInfo avatar(int sz) {
|
||||
JsArray<AvatarInfo> a = avatars();
|
||||
@@ -67,29 +69,30 @@ public class AccountInfo extends JavaScriptObject {
|
||||
return null;
|
||||
}
|
||||
|
||||
private native JsArray<AvatarInfo> avatars()
|
||||
/*-{ return this.avatars }-*/;
|
||||
private native JsArray<AvatarInfo> avatars() /*-{ return this.avatars }-*/;
|
||||
|
||||
public final native void name(String n) /*-{ this.name = n }-*/;
|
||||
|
||||
public final native void email(String e) /*-{ this.email = e }-*/;
|
||||
|
||||
public final native void username(String n) /*-{ this.username = n }-*/;
|
||||
|
||||
public static native AccountInfo create(int id, String name,
|
||||
String email, String username) /*-{
|
||||
public static native AccountInfo create(int id, String name, String email, String username) /*-{
|
||||
return {'_account_id': id, 'name': name, 'email': email,
|
||||
'username': username};
|
||||
}-*/;
|
||||
|
||||
protected AccountInfo() {
|
||||
}
|
||||
protected AccountInfo() {}
|
||||
|
||||
public static class AvatarInfo extends JavaScriptObject {
|
||||
public static final int DEFAULT_SIZE = 26;
|
||||
|
||||
public final native String url() /*-{ return this.url }-*/;
|
||||
|
||||
public final native int height() /*-{ return this.height || 0 }-*/;
|
||||
|
||||
public final native int width() /*-{ return this.width || 0 }-*/;
|
||||
|
||||
protected AvatarInfo() {
|
||||
}
|
||||
protected AvatarInfo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,14 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
public class ActionInfo extends JavaScriptObject {
|
||||
|
||||
public final native String id() /*-{ return this.id; }-*/;
|
||||
|
||||
public final native String method() /*-{ return this.method; }-*/;
|
||||
|
||||
public final native String label() /*-{ return this.label; }-*/;
|
||||
|
||||
public final native String title() /*-{ return this.title; }-*/;
|
||||
|
||||
public final native boolean enabled() /*-{ return this.enabled || false; }-*/;
|
||||
|
||||
protected ActionInfo() {
|
||||
}
|
||||
protected ActionInfo() {}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
public class AgreementInfo extends JavaScriptObject {
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String description() /*-{ return this.description; }-*/;
|
||||
|
||||
public final native String url() /*-{ return this.url; }-*/;
|
||||
|
||||
public final native GroupInfo autoVerifyGroup() /*-{ return this.auto_verify_group; }-*/;
|
||||
|
||||
protected AgreementInfo() {
|
||||
}
|
||||
protected AgreementInfo() {}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.google.gerrit.extensions.client.GitBasicAuthPolicy;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,6 +32,7 @@ public class AuthInfo extends JavaScriptObject {
|
||||
public final boolean isLdap() {
|
||||
return authType() == AuthType.LDAP || authType() == AuthType.LDAP_BIND;
|
||||
}
|
||||
|
||||
public final boolean isOpenId() {
|
||||
return authType() == AuthType.OPENID;
|
||||
}
|
||||
@@ -74,9 +74,7 @@ public class AuthInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final boolean siteHasUsernames() {
|
||||
if (isCustomExtension()
|
||||
&& httpPasswordUrl() != null
|
||||
&& !canEdit(AccountFieldName.USER_NAME)) {
|
||||
if (isCustomExtension() && httpPasswordUrl() != null && !canEdit(AccountFieldName.USER_NAME)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -94,23 +92,33 @@ public class AuthInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native boolean useContributorAgreements()
|
||||
/*-{ return this.use_contributor_agreements || false; }-*/;
|
||||
public final native String loginUrl() /*-{ return this.login_url; }-*/;
|
||||
public final native String loginText() /*-{ return this.login_text; }-*/;
|
||||
public final native String switchAccountUrl() /*-{ return this.switch_account_url; }-*/;
|
||||
public final native String registerUrl() /*-{ return this.register_url; }-*/;
|
||||
public final native String registerText() /*-{ return this.register_text; }-*/;
|
||||
public final native String editFullNameUrl() /*-{ return this.edit_full_name_url; }-*/;
|
||||
public final native String httpPasswordUrl() /*-{ return this.http_password_url; }-*/;
|
||||
public final native boolean isGitBasicAuth() /*-{ return this.is_git_basic_auth || false; }-*/;
|
||||
private native String gitBasicAuthPolicyRaw()
|
||||
/*-{ return this.git_basic_auth_policy; }-*/;
|
||||
private native String authTypeRaw() /*-{ return this.auth_type; }-*/;
|
||||
private native JsArrayString _editableAccountFields()
|
||||
/*-{ return this.editable_account_fields; }-*/;
|
||||
private native JsArray<AgreementInfo> _contributorAgreements()
|
||||
/*-{ return this.contributor_agreements; }-*/;
|
||||
/*-{ return this.use_contributor_agreements || false; }-*/ ;
|
||||
|
||||
protected AuthInfo() {
|
||||
}
|
||||
public final native String loginUrl() /*-{ return this.login_url; }-*/;
|
||||
|
||||
public final native String loginText() /*-{ return this.login_text; }-*/;
|
||||
|
||||
public final native String switchAccountUrl() /*-{ return this.switch_account_url; }-*/;
|
||||
|
||||
public final native String registerUrl() /*-{ return this.register_url; }-*/;
|
||||
|
||||
public final native String registerText() /*-{ return this.register_text; }-*/;
|
||||
|
||||
public final native String editFullNameUrl() /*-{ return this.edit_full_name_url; }-*/;
|
||||
|
||||
public final native String httpPasswordUrl() /*-{ return this.http_password_url; }-*/;
|
||||
|
||||
public final native boolean isGitBasicAuth() /*-{ return this.is_git_basic_auth || false; }-*/;
|
||||
|
||||
private native String gitBasicAuthPolicyRaw() /*-{ return this.git_basic_auth_policy; }-*/;
|
||||
|
||||
private native String authTypeRaw() /*-{ return this.auth_type; }-*/;
|
||||
|
||||
private native JsArrayString _editableAccountFields()
|
||||
/*-{ return this.editable_account_fields; }-*/ ;
|
||||
|
||||
private native JsArray<AgreementInfo> _contributorAgreements()
|
||||
/*-{ return this.contributor_agreements; }-*/ ;
|
||||
|
||||
protected AuthInfo() {}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -72,6 +71,7 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
private native Timestamp _getCts() /*-{ return this._cts; }-*/;
|
||||
|
||||
private native void _setCts(Timestamp ts) /*-{ this._cts = ts; }-*/;
|
||||
|
||||
public final Timestamp updated() {
|
||||
@@ -105,46 +105,75 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String id() /*-{ return this.id; }-*/;
|
||||
|
||||
public final native String project() /*-{ return this.project; }-*/;
|
||||
|
||||
public final native String branch() /*-{ return this.branch; }-*/;
|
||||
|
||||
public final native String topic() /*-{ return this.topic; }-*/;
|
||||
|
||||
public final native String changeId() /*-{ return this.change_id; }-*/;
|
||||
|
||||
public final native boolean mergeable() /*-{ return this.mergeable ? true : false; }-*/;
|
||||
|
||||
public final native int insertions() /*-{ return this.insertions; }-*/;
|
||||
|
||||
public final native int deletions() /*-{ return this.deletions; }-*/;
|
||||
|
||||
private native String statusRaw() /*-{ return this.status; }-*/;
|
||||
|
||||
public final native String subject() /*-{ return this.subject; }-*/;
|
||||
|
||||
public final native AccountInfo owner() /*-{ return this.owner; }-*/;
|
||||
|
||||
public final native AccountInfo assignee() /*-{ return this.assignee; }-*/;
|
||||
|
||||
private native String createdRaw() /*-{ return this.created; }-*/;
|
||||
|
||||
private native String updatedRaw() /*-{ return this.updated; }-*/;
|
||||
|
||||
private native String submittedRaw() /*-{ return this.submitted; }-*/;
|
||||
|
||||
public final native boolean starred() /*-{ return this.starred ? true : false; }-*/;
|
||||
|
||||
public final native boolean reviewed() /*-{ return this.reviewed ? true : false; }-*/;
|
||||
|
||||
public final native NativeMap<LabelInfo> allLabels() /*-{ return this.labels; }-*/;
|
||||
|
||||
public final native LabelInfo label(String n) /*-{ return this.labels[n]; }-*/;
|
||||
|
||||
public final native String currentRevision() /*-{ return this.current_revision; }-*/;
|
||||
|
||||
public final native void setCurrentRevision(String r) /*-{ this.current_revision = r; }-*/;
|
||||
|
||||
public final native NativeMap<RevisionInfo> revisions() /*-{ return this.revisions; }-*/;
|
||||
|
||||
public final native RevisionInfo revision(String n) /*-{ return this.revisions[n]; }-*/;
|
||||
|
||||
public final native JsArray<MessageInfo> messages() /*-{ return this.messages; }-*/;
|
||||
|
||||
public final native void setEdit(EditInfo edit) /*-{ this.edit = edit; }-*/;
|
||||
|
||||
public final native EditInfo edit() /*-{ return this.edit; }-*/;
|
||||
|
||||
public final native boolean hasEdit() /*-{ return this.hasOwnProperty('edit') }-*/;
|
||||
|
||||
public final native JsArrayString hashtags() /*-{ return this.hashtags; }-*/;
|
||||
|
||||
public final native boolean hasPermittedLabels()
|
||||
/*-{ return this.hasOwnProperty('permitted_labels') }-*/;
|
||||
/*-{ return this.hasOwnProperty('permitted_labels') }-*/ ;
|
||||
|
||||
public final native NativeMap<JsArrayString> permittedLabels()
|
||||
/*-{ return this.permitted_labels; }-*/;
|
||||
/*-{ return this.permitted_labels; }-*/ ;
|
||||
|
||||
public final native JsArrayString permittedValues(String n)
|
||||
/*-{ return this.permitted_labels[n]; }-*/;
|
||||
/*-{ return this.permitted_labels[n]; }-*/ ;
|
||||
|
||||
public final native JsArray<AccountInfo> removableReviewers()
|
||||
/*-{ return this.removable_reviewers; }-*/;
|
||||
/*-{ return this.removable_reviewers; }-*/ ;
|
||||
|
||||
private native NativeMap<JsArray<AccountInfo>> _reviewers() /*-{ return this.reviewers; }-*/;
|
||||
|
||||
private native NativeMap<JsArray<AccountInfo>> _reviewers()
|
||||
/*-{ return this.reviewers; }-*/;
|
||||
public final Map<ReviewerState, List<AccountInfo>> reviewers() {
|
||||
NativeMap<JsArray<AccountInfo>> reviewers = _reviewers();
|
||||
Map<ReviewerState, List<AccountInfo>> result = new HashMap<>();
|
||||
@@ -161,11 +190,12 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
|
||||
|
||||
public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
|
||||
|
||||
public final native int _number() /*-{ return this._number; }-*/;
|
||||
public final native boolean _more_changes()
|
||||
/*-{ return this._more_changes ? true : false; }-*/;
|
||||
|
||||
public final native boolean _more_changes() /*-{ return this._more_changes ? true : false; }-*/;
|
||||
|
||||
public final SubmitType submitType() {
|
||||
String submitType = _submitType();
|
||||
@@ -174,6 +204,7 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
return SubmitType.valueOf(submitType);
|
||||
}
|
||||
|
||||
private native String _submitType() /*-{ return this.submit_type; }-*/;
|
||||
|
||||
public final boolean submittable() {
|
||||
@@ -181,12 +212,11 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
return _submittable();
|
||||
}
|
||||
|
||||
private native boolean _submittable()
|
||||
/*-{ return this.submittable ? true : false; }-*/;
|
||||
private native boolean _submittable() /*-{ return this.submittable ? true : false; }-*/;
|
||||
|
||||
/**
|
||||
* @return the index of the missing label or -1
|
||||
* if no label is missing, or if more than one label is missing.
|
||||
* @return the index of the missing label or -1 if no label is missing, or if more than one label
|
||||
* is missing.
|
||||
*/
|
||||
public final int getMissingLabelIndex() {
|
||||
int i = -1;
|
||||
@@ -225,8 +255,7 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected ChangeInfo() {
|
||||
}
|
||||
protected ChangeInfo() {}
|
||||
|
||||
public static class LabelInfo extends JavaScriptObject {
|
||||
public final SubmitRecord.Label.Status status() {
|
||||
@@ -242,13 +271,17 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String name() /*-{ return this._name; }-*/;
|
||||
|
||||
public final native AccountInfo approved() /*-{ return this.approved; }-*/;
|
||||
|
||||
public final native AccountInfo rejected() /*-{ return this.rejected; }-*/;
|
||||
|
||||
public final native AccountInfo recommended() /*-{ return this.recommended; }-*/;
|
||||
|
||||
public final native AccountInfo disliked() /*-{ return this.disliked; }-*/;
|
||||
|
||||
public final native JsArray<ApprovalInfo> all() /*-{ return this.all; }-*/;
|
||||
|
||||
public final ApprovalInfo forUser(int user) {
|
||||
JsArray<ApprovalInfo> all = all();
|
||||
for (int i = 0; all != null && i < all.length(); i++) {
|
||||
@@ -260,16 +293,20 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
private native NativeMap<NativeString> _values() /*-{ return this.values; }-*/;
|
||||
|
||||
public final Set<String> values() {
|
||||
return Natives.keys(_values());
|
||||
}
|
||||
|
||||
public final native String valueText(String n) /*-{ return this.values[n]; }-*/;
|
||||
|
||||
public final native boolean optional() /*-{ return this.optional ? true : false; }-*/;
|
||||
|
||||
public final native boolean blocking() /*-{ return this.blocking ? true : false; }-*/;
|
||||
|
||||
public final native short defaultValue() /*-{ return this.default_value; }-*/;
|
||||
public final native short _value()
|
||||
/*-{
|
||||
|
||||
public final native short _value() /*-{
|
||||
if (this.value) return this.value;
|
||||
if (this.disliked) return -1;
|
||||
if (this.recommended) return 1;
|
||||
@@ -297,45 +334,50 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
return Short.parseShort(formatted);
|
||||
}
|
||||
|
||||
protected LabelInfo() {
|
||||
}
|
||||
protected LabelInfo() {}
|
||||
}
|
||||
|
||||
public static class ApprovalInfo extends AccountInfo {
|
||||
public final native boolean hasValue() /*-{ return this.hasOwnProperty('value'); }-*/;
|
||||
|
||||
public final native short value() /*-{ return this.value || 0; }-*/;
|
||||
|
||||
public final native VotingRangeInfo permittedVotingRange() /*-{ return this.permitted_voting_range; }-*/;
|
||||
public final native VotingRangeInfo
|
||||
permittedVotingRange() /*-{ return this.permitted_voting_range; }-*/;
|
||||
|
||||
protected ApprovalInfo() {
|
||||
}
|
||||
protected ApprovalInfo() {}
|
||||
}
|
||||
|
||||
public static class VotingRangeInfo extends AccountInfo {
|
||||
public final native short min() /*-{ return this.min || 0; }-*/;
|
||||
|
||||
public final native short max() /*-{ return this.max || 0; }-*/;
|
||||
|
||||
protected VotingRangeInfo() {
|
||||
}
|
||||
protected VotingRangeInfo() {}
|
||||
}
|
||||
|
||||
public static class EditInfo extends JavaScriptObject {
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String setName(String n) /*-{ this.name = n; }-*/;
|
||||
|
||||
public final native String baseRevision() /*-{ return this.base_revision; }-*/;
|
||||
|
||||
public final native CommitInfo commit() /*-{ return this.commit; }-*/;
|
||||
|
||||
public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
|
||||
|
||||
public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
|
||||
|
||||
public final native boolean hasFetch() /*-{ return this.hasOwnProperty('fetch') }-*/;
|
||||
|
||||
public final native NativeMap<FetchInfo> fetch() /*-{ return this.fetch; }-*/;
|
||||
|
||||
public final native boolean hasFiles() /*-{ return this.hasOwnProperty('files') }-*/;
|
||||
|
||||
public final native NativeMap<FileInfo> files() /*-{ return this.files; }-*/;
|
||||
|
||||
protected EditInfo() {
|
||||
}
|
||||
protected EditInfo() {}
|
||||
}
|
||||
|
||||
public static class RevisionInfo extends JavaScriptObject {
|
||||
@@ -344,55 +386,74 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
revisionInfo.takeFromEdit(edit);
|
||||
return revisionInfo;
|
||||
}
|
||||
|
||||
public static RevisionInfo forParent(int number, CommitInfo commit) {
|
||||
RevisionInfo revisionInfo = createObject().cast();
|
||||
revisionInfo.takeFromParent(number, commit);
|
||||
return revisionInfo;
|
||||
}
|
||||
|
||||
private native void takeFromEdit(EditInfo edit) /*-{
|
||||
this._number = 0;
|
||||
this.name = edit.name;
|
||||
this.commit = edit.commit;
|
||||
this.edit_base = edit.base_revision;
|
||||
}-*/;
|
||||
|
||||
private native void takeFromParent(int number, CommitInfo commit) /*-{
|
||||
this._number = number;
|
||||
this.commit = commit;
|
||||
this.name = this._number;
|
||||
}-*/;
|
||||
|
||||
public final native int _number() /*-{ return this._number; }-*/;
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native boolean draft() /*-{ return this.draft || false; }-*/;
|
||||
|
||||
public final native AccountInfo uploader() /*-{ return this.uploader; }-*/;
|
||||
|
||||
public final native boolean isEdit() /*-{ return this._number == 0; }-*/;
|
||||
|
||||
public final native CommitInfo commit() /*-{ return this.commit; }-*/;
|
||||
|
||||
public final native void setCommit(CommitInfo c) /*-{ this.commit = c; }-*/;
|
||||
|
||||
public final native String editBase() /*-{ return this.edit_base; }-*/;
|
||||
|
||||
public final native boolean hasFiles() /*-{ return this.hasOwnProperty('files') }-*/;
|
||||
|
||||
public final native NativeMap<FileInfo> files() /*-{ return this.files; }-*/;
|
||||
|
||||
public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
|
||||
|
||||
public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
|
||||
|
||||
public final native boolean hasFetch() /*-{ return this.hasOwnProperty('fetch') }-*/;
|
||||
|
||||
public final native NativeMap<FetchInfo> fetch() /*-{ return this.fetch; }-*/;
|
||||
|
||||
public final native boolean hasPushCertificate() /*-{ return this.hasOwnProperty('push_certificate'); }-*/;
|
||||
public final native PushCertificateInfo pushCertificate() /*-{ return this.push_certificate; }-*/;
|
||||
public final native boolean
|
||||
hasPushCertificate() /*-{ return this.hasOwnProperty('push_certificate'); }-*/;
|
||||
|
||||
public final native PushCertificateInfo
|
||||
pushCertificate() /*-{ return this.push_certificate; }-*/;
|
||||
|
||||
public static void sortRevisionInfoByNumber(JsArray<RevisionInfo> list) {
|
||||
final int editParent = findEditParent(list);
|
||||
Collections.sort(Natives.asList(list), new Comparator<RevisionInfo>() {
|
||||
@Override
|
||||
public int compare(RevisionInfo a, RevisionInfo b) {
|
||||
return num(a) - num(b);
|
||||
}
|
||||
Collections.sort(
|
||||
Natives.asList(list),
|
||||
new Comparator<RevisionInfo>() {
|
||||
@Override
|
||||
public int compare(RevisionInfo a, RevisionInfo b) {
|
||||
return num(a) - num(b);
|
||||
}
|
||||
|
||||
private int num(RevisionInfo r) {
|
||||
return !r.isEdit() ? 2 * (r._number() - 1) + 1 : 2 * editParent;
|
||||
}
|
||||
});
|
||||
private int num(RevisionInfo r) {
|
||||
return !r.isEdit() ? 2 * (r._number() - 1) + 1 : 2 * editParent;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static int findEditParent(JsArray<RevisionInfo> list) {
|
||||
@@ -400,8 +461,7 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
return r == null ? -1 : r._number();
|
||||
}
|
||||
|
||||
public static RevisionInfo findEditParentRevision(
|
||||
JsArray<RevisionInfo> list) {
|
||||
public static RevisionInfo findEditParentRevision(JsArray<RevisionInfo> list) {
|
||||
for (int i = 0; i < list.length(); i++) {
|
||||
// edit under revisions?
|
||||
RevisionInfo editInfo = list.get(i);
|
||||
@@ -429,67 +489,77 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
return commit().parents().length() > 1;
|
||||
}
|
||||
|
||||
protected RevisionInfo () {
|
||||
}
|
||||
protected RevisionInfo() {}
|
||||
}
|
||||
|
||||
public static class FetchInfo extends JavaScriptObject {
|
||||
public final native String url() /*-{ return this.url }-*/;
|
||||
|
||||
public final native String ref() /*-{ return this.ref }-*/;
|
||||
|
||||
public final native NativeMap<NativeString> commands() /*-{ return this.commands }-*/;
|
||||
|
||||
public final native String command(String n) /*-{ return this.commands[n]; }-*/;
|
||||
|
||||
protected FetchInfo () {
|
||||
}
|
||||
protected FetchInfo() {}
|
||||
}
|
||||
|
||||
public static class CommitInfo extends JavaScriptObject {
|
||||
public final native String commit() /*-{ return this.commit; }-*/;
|
||||
|
||||
public final native JsArray<CommitInfo> parents() /*-{ return this.parents; }-*/;
|
||||
|
||||
public final native GitPerson author() /*-{ return this.author; }-*/;
|
||||
|
||||
public final native GitPerson committer() /*-{ return this.committer; }-*/;
|
||||
|
||||
public final native String subject() /*-{ return this.subject; }-*/;
|
||||
|
||||
public final native String message() /*-{ return this.message; }-*/;
|
||||
|
||||
public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
|
||||
|
||||
protected CommitInfo() {
|
||||
}
|
||||
protected CommitInfo() {}
|
||||
}
|
||||
|
||||
public static class GitPerson extends JavaScriptObject {
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String email() /*-{ return this.email; }-*/;
|
||||
|
||||
private native String dateRaw() /*-{ return this.date; }-*/;
|
||||
|
||||
public final Timestamp date() {
|
||||
return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());
|
||||
}
|
||||
|
||||
protected GitPerson() {
|
||||
}
|
||||
protected GitPerson() {}
|
||||
}
|
||||
|
||||
public static class MessageInfo extends JavaScriptObject {
|
||||
public final native AccountInfo author() /*-{ return this.author; }-*/;
|
||||
|
||||
public final native String message() /*-{ return this.message; }-*/;
|
||||
|
||||
public final native int _revisionNumber() /*-{ return this._revision_number || 0; }-*/;
|
||||
|
||||
public final native String tag() /*-{ return this.tag; }-*/;
|
||||
|
||||
private native String dateRaw() /*-{ return this.date; }-*/;
|
||||
|
||||
public final Timestamp date() {
|
||||
return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());
|
||||
}
|
||||
|
||||
protected MessageInfo() {
|
||||
}
|
||||
protected MessageInfo() {}
|
||||
}
|
||||
|
||||
public static class MergeableInfo extends JavaScriptObject {
|
||||
public final native String submitType() /*-{ return this.submit_type }-*/;
|
||||
|
||||
public final native boolean mergeable() /*-{ return this.mergeable }-*/;
|
||||
|
||||
protected MergeableInfo() {
|
||||
}
|
||||
protected MergeableInfo() {}
|
||||
}
|
||||
|
||||
public static class IncludedInInfo extends JavaScriptObject {
|
||||
@@ -498,11 +568,13 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native JsArrayString branches() /*-{ return this.branches; }-*/;
|
||||
|
||||
public final native JsArrayString tags() /*-{ return this.tags; }-*/;
|
||||
|
||||
public final native JsArrayString external(String n) /*-{ return this.external[n]; }-*/;
|
||||
|
||||
private native NativeMap<JsArrayString> external() /*-{ return this.external; }-*/;
|
||||
|
||||
protected IncludedInInfo() {
|
||||
}
|
||||
protected IncludedInInfo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.google.gerrit.client.rpc.NativeString;
|
||||
import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -39,11 +38,12 @@ public class DownloadInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native DownloadSchemeInfo scheme(String n) /*-{ return this.schemes[n]; }-*/;
|
||||
|
||||
private native NativeMap<DownloadSchemeInfo> _schemes() /*-{ return this.schemes; }-*/;
|
||||
|
||||
private native JsArrayString _archives() /*-{ return this.archives; }-*/;
|
||||
|
||||
protected DownloadInfo() {
|
||||
}
|
||||
protected DownloadInfo() {}
|
||||
|
||||
public static class DownloadSchemeInfo extends JavaScriptObject {
|
||||
public final List<String> commandNames() {
|
||||
@@ -53,8 +53,7 @@ public class DownloadInfo extends JavaScriptObject {
|
||||
public final Set<DownloadCommandInfo> commands(String project) {
|
||||
Set<DownloadCommandInfo> commands = new HashSet<>();
|
||||
for (String commandName : commandNames()) {
|
||||
commands.add(new DownloadCommandInfo(commandName, command(commandName,
|
||||
project)));
|
||||
commands.add(new DownloadCommandInfo(commandName, command(commandName, project)));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
@@ -75,14 +74,14 @@ public class DownloadInfo extends JavaScriptObject {
|
||||
List<String> commandNames = cloneCommandNames();
|
||||
List<DownloadCommandInfo> commands = new ArrayList<>(commandNames.size());
|
||||
for (String commandName : commandNames) {
|
||||
commands.add(new DownloadCommandInfo(commandName, cloneCommand(
|
||||
commandName, project)));
|
||||
commands.add(new DownloadCommandInfo(commandName, cloneCommand(commandName, project)));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
|
||||
public final String cloneCommand(String commandName, String project) {
|
||||
return cloneCommand(commandName).replaceAll("\\$\\{project\\}", project)
|
||||
return cloneCommand(commandName)
|
||||
.replaceAll("\\$\\{project\\}", project)
|
||||
.replaceAll("\\$\\{project-base-name\\}", projectBaseName(project));
|
||||
}
|
||||
|
||||
@@ -91,16 +90,22 @@ public class DownloadInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String url() /*-{ return this.url; }-*/;
|
||||
|
||||
public final native boolean isAuthRequired() /*-{ return this.is_auth_required || false; }-*/;
|
||||
|
||||
public final native boolean isAuthSupported() /*-{ return this.is_auth_supported || false; }-*/;
|
||||
|
||||
public final native String command(String n) /*-{ return this.commands[n]; }-*/;
|
||||
|
||||
public final native String cloneCommand(String n) /*-{ return this.clone_commands[n]; }-*/;
|
||||
|
||||
private native NativeMap<NativeString> _commands() /*-{ return this.commands; }-*/;
|
||||
|
||||
private native NativeMap<NativeString> _cloneCommands() /*-{ return this.clone_commands; }-*/;
|
||||
|
||||
protected DownloadSchemeInfo() {
|
||||
}
|
||||
protected DownloadSchemeInfo() {}
|
||||
}
|
||||
|
||||
public static class DownloadCommandInfo {
|
||||
|
||||
@@ -19,37 +19,44 @@ import com.google.gerrit.common.data.FilenameComparator;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class FileInfo extends JavaScriptObject {
|
||||
public final native String path() /*-{ return this.path; }-*/;
|
||||
|
||||
public final native String oldPath() /*-{ return this.old_path; }-*/;
|
||||
|
||||
public final native int linesInserted() /*-{ return this.lines_inserted || 0; }-*/;
|
||||
|
||||
public final native int linesDeleted() /*-{ return this.lines_deleted || 0; }-*/;
|
||||
|
||||
public final native boolean binary() /*-{ return this.binary || false; }-*/;
|
||||
|
||||
public final native String status() /*-{ return this.status; }-*/;
|
||||
|
||||
// JSNI methods cannot have 'long' as a parameter type or a return type and
|
||||
// it's suggested to use double in this case:
|
||||
// http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html#important
|
||||
public final long size() {
|
||||
return (long)_size();
|
||||
return (long) _size();
|
||||
}
|
||||
|
||||
private native double _size() /*-{ return this.size || 0; }-*/;
|
||||
|
||||
public final long sizeDelta() {
|
||||
return (long)_sizeDelta();
|
||||
return (long) _sizeDelta();
|
||||
}
|
||||
|
||||
private native double _sizeDelta() /*-{ return this.size_delta || 0; }-*/;
|
||||
|
||||
public final native int _row() /*-{ return this._row }-*/;
|
||||
|
||||
public final native void _row(int r) /*-{ this._row = r }-*/;
|
||||
|
||||
public static void sortFileInfoByPath(JsArray<FileInfo> list) {
|
||||
Collections.sort(Natives.asList(list),
|
||||
Comparator.comparing(FileInfo::path, FilenameComparator.INSTANCE));
|
||||
Collections.sort(
|
||||
Natives.asList(list), Comparator.comparing(FileInfo::path, FilenameComparator.INSTANCE));
|
||||
}
|
||||
|
||||
public static String getFileName(String path) {
|
||||
@@ -66,6 +73,5 @@ public class FileInfo extends JavaScriptObject {
|
||||
return s >= 0 ? fileName.substring(s + 1) : fileName;
|
||||
}
|
||||
|
||||
protected FileInfo() {
|
||||
}
|
||||
protected FileInfo() {}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategory
|
||||
import com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -38,8 +37,7 @@ public class GeneralPreferences extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public static GeneralPreferences createDefault() {
|
||||
GeneralPreferencesInfo d =
|
||||
GeneralPreferencesInfo.defaults();
|
||||
GeneralPreferencesInfo d = GeneralPreferencesInfo.defaults();
|
||||
GeneralPreferences p = createObject().cast();
|
||||
p.changesPerPage(d.changesPerPage);
|
||||
p.showSiteHeader(d.showSiteHeader);
|
||||
@@ -62,167 +60,154 @@ public class GeneralPreferences extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final int changesPerPage() {
|
||||
int changesPerPage =
|
||||
get("changes_per_page", GeneralPreferencesInfo.DEFAULT_PAGESIZE);
|
||||
return 0 < changesPerPage
|
||||
? changesPerPage
|
||||
: GeneralPreferencesInfo.DEFAULT_PAGESIZE;
|
||||
int changesPerPage = get("changes_per_page", GeneralPreferencesInfo.DEFAULT_PAGESIZE);
|
||||
return 0 < changesPerPage ? changesPerPage : GeneralPreferencesInfo.DEFAULT_PAGESIZE;
|
||||
}
|
||||
private native short get(String n, int d)
|
||||
/*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;
|
||||
|
||||
public final native boolean showSiteHeader()
|
||||
/*-{ return this.show_site_header || false }-*/;
|
||||
private native short get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;
|
||||
|
||||
public final native boolean showSiteHeader() /*-{ return this.show_site_header || false }-*/;
|
||||
|
||||
public final native boolean useFlashClipboard()
|
||||
/*-{ return this.use_flash_clipboard || false }-*/;
|
||||
/*-{ return this.use_flash_clipboard || false }-*/ ;
|
||||
|
||||
public final native String downloadScheme()
|
||||
/*-{ return this.download_scheme }-*/;
|
||||
public final native String downloadScheme() /*-{ return this.download_scheme }-*/;
|
||||
|
||||
public final DownloadCommand downloadCommand() {
|
||||
String s = downloadCommandRaw();
|
||||
return s != null ? DownloadCommand.valueOf(s) : null;
|
||||
}
|
||||
private native String downloadCommandRaw()
|
||||
/*-{ return this.download_command }-*/;
|
||||
|
||||
private native String downloadCommandRaw() /*-{ return this.download_command }-*/;
|
||||
|
||||
public final DateFormat dateFormat() {
|
||||
String s = dateFormatRaw();
|
||||
return s != null ? DateFormat.valueOf(s) : null;
|
||||
}
|
||||
private native String dateFormatRaw()
|
||||
/*-{ return this.date_format }-*/;
|
||||
|
||||
private native String dateFormatRaw() /*-{ return this.date_format }-*/;
|
||||
|
||||
public final TimeFormat timeFormat() {
|
||||
String s = timeFormatRaw();
|
||||
return s != null ? TimeFormat.valueOf(s) : null;
|
||||
}
|
||||
private native String timeFormatRaw()
|
||||
/*-{ return this.time_format }-*/;
|
||||
|
||||
private native String timeFormatRaw() /*-{ return this.time_format }-*/;
|
||||
|
||||
public final native boolean highlightAssigneeInChangeTable()
|
||||
/*-{ return this.highlight_assignee_in_change_table || false }-*/;
|
||||
/*-{ return this.highlight_assignee_in_change_table || false }-*/ ;
|
||||
|
||||
public final native boolean relativeDateInChangeTable()
|
||||
/*-{ return this.relative_date_in_change_table || false }-*/;
|
||||
/*-{ return this.relative_date_in_change_table || false }-*/ ;
|
||||
|
||||
public final native boolean sizeBarInChangeTable()
|
||||
/*-{ return this.size_bar_in_change_table || false }-*/;
|
||||
/*-{ return this.size_bar_in_change_table || false }-*/ ;
|
||||
|
||||
public final native boolean legacycidInChangeTable()
|
||||
/*-{ return this.legacycid_in_change_table || false }-*/;
|
||||
/*-{ return this.legacycid_in_change_table || false }-*/ ;
|
||||
|
||||
public final native boolean muteCommonPathPrefixes()
|
||||
/*-{ return this.mute_common_path_prefixes || false }-*/;
|
||||
/*-{ return this.mute_common_path_prefixes || false }-*/ ;
|
||||
|
||||
public final native boolean signedOffBy()
|
||||
/*-{ return this.signed_off_by || false }-*/;
|
||||
public final native boolean signedOffBy() /*-{ return this.signed_off_by || false }-*/;
|
||||
|
||||
public final ReviewCategoryStrategy reviewCategoryStrategy() {
|
||||
String s = reviewCategeoryStrategyRaw();
|
||||
return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
|
||||
}
|
||||
private native String reviewCategeoryStrategyRaw()
|
||||
/*-{ return this.review_category_strategy }-*/;
|
||||
|
||||
private native String reviewCategeoryStrategyRaw() /*-{ return this.review_category_strategy }-*/;
|
||||
|
||||
public final DiffView diffView() {
|
||||
String s = diffViewRaw();
|
||||
return s != null ? DiffView.valueOf(s) : null;
|
||||
}
|
||||
private native String diffViewRaw()
|
||||
/*-{ return this.diff_view }-*/;
|
||||
|
||||
private native String diffViewRaw() /*-{ return this.diff_view }-*/;
|
||||
|
||||
public final EmailStrategy emailStrategy() {
|
||||
String s = emailStrategyRaw();
|
||||
return s != null ? EmailStrategy.valueOf(s) : null;
|
||||
}
|
||||
|
||||
private native String emailStrategyRaw()
|
||||
/*-{ return this.email_strategy }-*/;
|
||||
private native String emailStrategyRaw() /*-{ return this.email_strategy }-*/;
|
||||
|
||||
public final DefaultBase defaultBaseForMerges() {
|
||||
String s = defaultBaseForMergesRaw();
|
||||
return s != null ? DefaultBase.valueOf(s) : null;
|
||||
}
|
||||
|
||||
private native String defaultBaseForMergesRaw()
|
||||
/*-{ return this.default_base_for_merges }-*/;
|
||||
private native String defaultBaseForMergesRaw() /*-{ return this.default_base_for_merges }-*/;
|
||||
|
||||
public final native JsArray<TopMenuItem> my()
|
||||
/*-{ return this.my; }-*/;
|
||||
public final native JsArray<TopMenuItem> my() /*-{ return this.my; }-*/;
|
||||
|
||||
public final native void changesPerPage(int n)
|
||||
/*-{ this.changes_per_page = n }-*/;
|
||||
public final native void changesPerPage(int n) /*-{ this.changes_per_page = n }-*/;
|
||||
|
||||
public final native void showSiteHeader(boolean s)
|
||||
/*-{ this.show_site_header = s }-*/;
|
||||
public final native void showSiteHeader(boolean s) /*-{ this.show_site_header = s }-*/;
|
||||
|
||||
public final native void useFlashClipboard(boolean u)
|
||||
/*-{ this.use_flash_clipboard = u }-*/;
|
||||
public final native void useFlashClipboard(boolean u) /*-{ this.use_flash_clipboard = u }-*/;
|
||||
|
||||
public final native void downloadScheme(String d)
|
||||
/*-{ this.download_scheme = d }-*/;
|
||||
public final native void downloadScheme(String d) /*-{ this.download_scheme = d }-*/;
|
||||
|
||||
public final void downloadCommand(DownloadCommand d) {
|
||||
downloadCommandRaw(d != null ? d.toString() : null);
|
||||
}
|
||||
public final native void downloadCommandRaw(String d)
|
||||
/*-{ this.download_command = d }-*/;
|
||||
|
||||
public final native void downloadCommandRaw(String d) /*-{ this.download_command = d }-*/;
|
||||
|
||||
public final void dateFormat(DateFormat f) {
|
||||
dateFormatRaw(f != null ? f.toString() : null);
|
||||
}
|
||||
private native void dateFormatRaw(String f)
|
||||
/*-{ this.date_format = f }-*/;
|
||||
|
||||
private native void dateFormatRaw(String f) /*-{ this.date_format = f }-*/;
|
||||
|
||||
public final void timeFormat(TimeFormat f) {
|
||||
timeFormatRaw(f != null ? f.toString() : null);
|
||||
}
|
||||
private native void timeFormatRaw(String f)
|
||||
/*-{ this.time_format = f }-*/;
|
||||
|
||||
private native void timeFormatRaw(String f) /*-{ this.time_format = f }-*/;
|
||||
|
||||
public final native void highlightAssigneeInChangeTable(boolean d)
|
||||
/*-{ this.highlight_assignee_in_change_table = d }-*/;
|
||||
/*-{ this.highlight_assignee_in_change_table = d }-*/ ;
|
||||
|
||||
public final native void relativeDateInChangeTable(boolean d)
|
||||
/*-{ this.relative_date_in_change_table = d }-*/;
|
||||
/*-{ this.relative_date_in_change_table = d }-*/ ;
|
||||
|
||||
public final native void sizeBarInChangeTable(boolean s)
|
||||
/*-{ this.size_bar_in_change_table = s }-*/;
|
||||
/*-{ this.size_bar_in_change_table = s }-*/ ;
|
||||
|
||||
public final native void legacycidInChangeTable(boolean s)
|
||||
/*-{ this.legacycid_in_change_table = s }-*/;
|
||||
/*-{ this.legacycid_in_change_table = s }-*/ ;
|
||||
|
||||
public final native void muteCommonPathPrefixes(boolean s)
|
||||
/*-{ this.mute_common_path_prefixes = s }-*/;
|
||||
/*-{ this.mute_common_path_prefixes = s }-*/ ;
|
||||
|
||||
public final native void signedOffBy(boolean s)
|
||||
/*-{ this.signed_off_by = s }-*/;
|
||||
public final native void signedOffBy(boolean s) /*-{ this.signed_off_by = s }-*/;
|
||||
|
||||
public final void reviewCategoryStrategy(ReviewCategoryStrategy s) {
|
||||
reviewCategoryStrategyRaw(s != null ? s.toString() : null);
|
||||
}
|
||||
|
||||
private native void reviewCategoryStrategyRaw(String s)
|
||||
/*-{ this.review_category_strategy = s }-*/;
|
||||
/*-{ this.review_category_strategy = s }-*/ ;
|
||||
|
||||
public final void diffView(DiffView d) {
|
||||
diffViewRaw(d != null ? d.toString() : null);
|
||||
}
|
||||
private native void diffViewRaw(String d)
|
||||
/*-{ this.diff_view = d }-*/;
|
||||
|
||||
private native void diffViewRaw(String d) /*-{ this.diff_view = d }-*/;
|
||||
|
||||
public final void emailStrategy(EmailStrategy s) {
|
||||
emailStrategyRaw(s != null ? s.toString() : null);
|
||||
}
|
||||
private native void emailStrategyRaw(String s)
|
||||
/*-{ this.email_strategy = s }-*/;
|
||||
|
||||
private native void emailStrategyRaw(String s) /*-{ this.email_strategy = s }-*/;
|
||||
|
||||
public final void defaultBaseForMerges(DefaultBase b) {
|
||||
defaultBaseForMergesRaw(b != null ? b.toString() : null);
|
||||
}
|
||||
private native void defaultBaseForMergesRaw(String b)
|
||||
/*-{ this.default_base_for_merges = b }-*/;
|
||||
|
||||
private native void defaultBaseForMergesRaw(String b) /*-{ this.default_base_for_merges = b }-*/;
|
||||
|
||||
public final void setMyMenus(List<TopMenuItem> myMenus) {
|
||||
initMy();
|
||||
@@ -230,7 +215,9 @@ public class GeneralPreferences extends JavaScriptObject {
|
||||
addMy(n);
|
||||
}
|
||||
}
|
||||
|
||||
final native void initMy() /*-{ this.my = []; }-*/;
|
||||
|
||||
final native void addMy(TopMenuItem m) /*-{ this.my.push(m); }-*/;
|
||||
|
||||
public final Map<String, String> urlAliases() {
|
||||
@@ -242,6 +229,7 @@ public class GeneralPreferences extends JavaScriptObject {
|
||||
}
|
||||
|
||||
private native String urlAliasToken(String m) /*-{ return this.url_aliases[m]; }-*/;
|
||||
|
||||
private native NativeMap<NativeString> _urlAliases() /*-{ return this.url_aliases; }-*/;
|
||||
|
||||
public final void setUrlAliases(Map<String, String> urlAliases) {
|
||||
@@ -250,9 +238,10 @@ public class GeneralPreferences extends JavaScriptObject {
|
||||
putUrlAlias(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private native void putUrlAlias(String m, String t) /*-{ this.url_aliases[m] = t; }-*/;
|
||||
|
||||
private native void initUrlAliases() /*-{ this.url_aliases = {}; }-*/;
|
||||
|
||||
protected GeneralPreferences() {
|
||||
}
|
||||
protected GeneralPreferences() {}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.google.gerrit.extensions.client.UiType;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,14 +39,21 @@ public class GerritInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String allProjects() /*-{ return this.all_projects; }-*/;
|
||||
|
||||
public final native String allUsers() /*-{ return this.all_users; }-*/;
|
||||
|
||||
public final native boolean docSearch() /*-{ return this.doc_search; }-*/;
|
||||
|
||||
public final native String docUrl() /*-{ return this.doc_url; }-*/;
|
||||
|
||||
public final native boolean editGpgKeys() /*-{ return this.edit_gpg_keys || false; }-*/;
|
||||
|
||||
public final native String reportBugUrl() /*-{ return this.report_bug_url; }-*/;
|
||||
|
||||
public final native String reportBugText() /*-{ return this.report_bug_text; }-*/;
|
||||
|
||||
private native JsArrayString _webUis() /*-{ return this.web_uis; }-*/;
|
||||
|
||||
public final List<UiType> webUis() {
|
||||
JsArrayString webUis = _webUis();
|
||||
List<UiType> result = new ArrayList<>(webUis.length());
|
||||
@@ -60,6 +66,5 @@ public class GerritInfo extends JavaScriptObject {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected GerritInfo() {
|
||||
}
|
||||
protected GerritInfo() {}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,21 @@ import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
public class GpgKeyInfo extends JavaScriptObject {
|
||||
public enum Status {
|
||||
BAD, OK, TRUSTED;
|
||||
BAD,
|
||||
OK,
|
||||
TRUSTED;
|
||||
}
|
||||
|
||||
public final native String id() /*-{ return this.id; }-*/;
|
||||
|
||||
public final native String fingerprint() /*-{ return this.fingerprint; }-*/;
|
||||
|
||||
public final native JsArrayString userIds() /*-{ return this.user_ids; }-*/;
|
||||
|
||||
public final native String key() /*-{ return this.key; }-*/;
|
||||
|
||||
private native String statusRaw() /*-{ return this.status; }-*/;
|
||||
|
||||
public final Status status() {
|
||||
String s = statusRaw();
|
||||
if (s == null) {
|
||||
@@ -36,10 +42,9 @@ public class GpgKeyInfo extends JavaScriptObject {
|
||||
return Status.valueOf(s);
|
||||
}
|
||||
|
||||
public final native boolean hasProblems()
|
||||
/*-{ return this.hasOwnProperty('problems'); }-*/;
|
||||
public final native boolean hasProblems() /*-{ return this.hasOwnProperty('problems'); }-*/;
|
||||
|
||||
public final native JsArrayString problems() /*-{ return this.problems; }-*/;
|
||||
|
||||
protected GpgKeyInfo() {
|
||||
}
|
||||
protected GpgKeyInfo() {}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ public class GroupBaseInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String id() /*-{ return this.id; }-*/;
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
protected GroupBaseInfo() {
|
||||
}
|
||||
protected GroupBaseInfo() {}
|
||||
}
|
||||
|
||||
@@ -25,21 +25,29 @@ public class GroupInfo extends GroupBaseInfo {
|
||||
}
|
||||
|
||||
public final native GroupOptionsInfo options() /*-{ return this.options; }-*/;
|
||||
|
||||
public final native String description() /*-{ return this.description; }-*/;
|
||||
|
||||
public final native String url() /*-{ return this.url; }-*/;
|
||||
|
||||
public final native String owner() /*-{ return this.owner; }-*/;
|
||||
|
||||
public final native void owner(String o) /*-{ if(o)this.owner=o; }-*/;
|
||||
|
||||
public final native JsArray<AccountInfo> members() /*-{ return this.members; }-*/;
|
||||
|
||||
public final native JsArray<GroupInfo> includes() /*-{ return this.includes; }-*/;
|
||||
|
||||
private native int group_id() /*-{ return this.group_id; }-*/;
|
||||
|
||||
private native String owner_id() /*-{ return this.owner_id; }-*/;
|
||||
|
||||
private native void owner_id(String o) /*-{ if(o)this.owner_id=o; }-*/;
|
||||
|
||||
public final AccountGroup.UUID getOwnerUUID() {
|
||||
String owner = owner_id();
|
||||
if (owner != null) {
|
||||
return new AccountGroup.UUID(URL.decodeQueryString(owner));
|
||||
return new AccountGroup.UUID(URL.decodeQueryString(owner));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -48,13 +56,12 @@ public class GroupInfo extends GroupBaseInfo {
|
||||
owner_id(URL.encodeQueryString(uuid.get()));
|
||||
}
|
||||
|
||||
protected GroupInfo() {
|
||||
}
|
||||
protected GroupInfo() {}
|
||||
|
||||
public static class GroupOptionsInfo extends JavaScriptObject {
|
||||
public final native boolean isVisibleToAll() /*-{ return this['visible_to_all'] ? true : false; }-*/;
|
||||
public final native boolean
|
||||
isVisibleToAll() /*-{ return this['visible_to_all'] ? true : false; }-*/;
|
||||
|
||||
protected GroupOptionsInfo() {
|
||||
}
|
||||
protected GroupOptionsInfo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,19 @@ package com.google.gerrit.client.info;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
|
||||
public class OAuthTokenInfo extends JavaScriptObject {
|
||||
|
||||
protected OAuthTokenInfo() {
|
||||
}
|
||||
protected OAuthTokenInfo() {}
|
||||
|
||||
public final native String username() /*-{ return this.username; }-*/;
|
||||
|
||||
public final native String resourceHost() /*-{ return this.resource_host; }-*/;
|
||||
|
||||
public final native String accessToken() /*-{ return this.access_token; }-*/;
|
||||
|
||||
public final native String providerId() /*-{ return this.provider_id; }-*/;
|
||||
|
||||
public final native String expiresAt() /*-{ return this.expires_at; }-*/;
|
||||
|
||||
public final native String type() /*-{ return this.type; }-*/;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
public class PushCertificateInfo extends JavaScriptObject {
|
||||
public final native String certificate() /*-{ return this.certificate; }-*/;
|
||||
|
||||
public final native GpgKeyInfo key() /*-{ return this.key; }-*/;
|
||||
|
||||
protected PushCertificateInfo() {
|
||||
}
|
||||
protected PushCertificateInfo() {}
|
||||
}
|
||||
|
||||
@@ -19,19 +19,26 @@ import com.google.gerrit.client.rpc.NativeString;
|
||||
import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ServerInfo extends JavaScriptObject {
|
||||
public final native AuthInfo auth() /*-{ return this.auth; }-*/;
|
||||
|
||||
public final native ChangeConfigInfo change() /*-{ return this.change; }-*/;
|
||||
|
||||
public final native DownloadInfo download() /*-{ return this.download; }-*/;
|
||||
|
||||
public final native GerritInfo gerrit() /*-{ return this.gerrit; }-*/;
|
||||
|
||||
public final native PluginConfigInfo plugin() /*-{ return this.plugin; }-*/;
|
||||
|
||||
public final native SshdInfo sshd() /*-{ return this.sshd; }-*/;
|
||||
|
||||
public final native SuggestInfo suggest() /*-{ return this.suggest; }-*/;
|
||||
|
||||
public final native UserConfigInfo user() /*-{ return this.user; }-*/;
|
||||
|
||||
public final native ReceiveInfo receive() /*-{ return this.receive; }-*/;
|
||||
|
||||
public final Map<String, String> urlAliases() {
|
||||
@@ -43,64 +50,65 @@ public class ServerInfo extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String urlAliasToken(String n) /*-{ return this.url_aliases[n]; }-*/;
|
||||
private native NativeMap<NativeString> _urlAliases() /*-{ return this.url_aliases; }-*/;
|
||||
|
||||
private native NativeMap<NativeString> _urlAliases() /*-{ return this.url_aliases; }-*/;
|
||||
|
||||
public final boolean hasSshd() {
|
||||
return sshd() != null;
|
||||
}
|
||||
|
||||
protected ServerInfo() {
|
||||
}
|
||||
protected ServerInfo() {}
|
||||
|
||||
public static class ChangeConfigInfo extends JavaScriptObject {
|
||||
public final native boolean allowDrafts() /*-{ return this.allow_drafts || false; }-*/;
|
||||
|
||||
public final native boolean allowBlame() /*-{ return this.allow_blame || false; }-*/;
|
||||
|
||||
public final native int largeChange() /*-{ return this.large_change || 0; }-*/;
|
||||
|
||||
public final native String replyLabel() /*-{ return this.reply_label; }-*/;
|
||||
|
||||
public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/;
|
||||
|
||||
public final native boolean showAssignee() /*-{ return this.show_assignee || false; }-*/;
|
||||
|
||||
public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/;
|
||||
|
||||
public final native boolean isSubmitWholeTopicEnabled() /*-{
|
||||
return this.submit_whole_topic; }-*/;
|
||||
|
||||
protected ChangeConfigInfo() {
|
||||
}
|
||||
protected ChangeConfigInfo() {}
|
||||
}
|
||||
|
||||
public static class PluginConfigInfo extends JavaScriptObject {
|
||||
public final native boolean hasAvatars() /*-{ return this.has_avatars || false; }-*/;
|
||||
|
||||
public final native JsArrayString jsResourcePaths() /*-{
|
||||
return this.js_resource_paths || []; }-*/;
|
||||
|
||||
protected PluginConfigInfo() {
|
||||
}
|
||||
protected PluginConfigInfo() {}
|
||||
}
|
||||
|
||||
public static class SshdInfo extends JavaScriptObject {
|
||||
protected SshdInfo() {
|
||||
}
|
||||
protected SshdInfo() {}
|
||||
}
|
||||
|
||||
public static class SuggestInfo extends JavaScriptObject {
|
||||
public final native int from() /*-{ return this.from || 0; }-*/;
|
||||
|
||||
protected SuggestInfo() {
|
||||
}
|
||||
protected SuggestInfo() {}
|
||||
}
|
||||
|
||||
public static class UserConfigInfo extends JavaScriptObject {
|
||||
public final native String anonymousCowardName() /*-{ return this.anonymous_coward_name; }-*/;
|
||||
|
||||
protected UserConfigInfo() {
|
||||
}
|
||||
protected UserConfigInfo() {}
|
||||
}
|
||||
|
||||
public static class ReceiveInfo extends JavaScriptObject {
|
||||
public final native boolean enableSignedPush()
|
||||
/*-{ return this.enable_signed_push || false; }-*/;
|
||||
/*-{ return this.enable_signed_push || false; }-*/ ;
|
||||
|
||||
protected ReceiveInfo() {
|
||||
}
|
||||
protected ReceiveInfo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ import com.google.gwt.core.client.JsArray;
|
||||
|
||||
public class TopMenu extends JavaScriptObject {
|
||||
|
||||
protected TopMenu() {
|
||||
}
|
||||
protected TopMenu() {}
|
||||
|
||||
public final native String getName() /*-{ return this.name; }-*/;
|
||||
|
||||
|
||||
@@ -25,13 +25,16 @@ public class TopMenuItem extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native String getName() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String getUrl() /*-{ return this.url; }-*/;
|
||||
|
||||
public final native String getTarget() /*-{ return this.target; }-*/;
|
||||
|
||||
public final native String getId() /*-{ return this.id; }-*/;
|
||||
|
||||
public final native void name(String n) /*-{ this.name = n }-*/;
|
||||
|
||||
public final native void url(String u) /*-{ this.url = u }-*/;
|
||||
|
||||
protected TopMenuItem() {
|
||||
}
|
||||
protected TopMenuItem() {}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,5 @@ import com.google.gwt.core.client.JsArray;
|
||||
|
||||
public class TopMenuList extends JsArray<TopMenu> {
|
||||
|
||||
protected TopMenuList() {
|
||||
}
|
||||
protected TopMenuList() {}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,14 @@ import com.google.gwt.user.client.ui.Image;
|
||||
public class WebLinkInfo extends JavaScriptObject {
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
|
||||
public final native String imageUrl() /*-{ return this.image_url; }-*/;
|
||||
|
||||
public final native String url() /*-{ return this.url; }-*/;
|
||||
|
||||
public final native String target() /*-{ return this.target; }-*/;
|
||||
|
||||
protected WebLinkInfo() {
|
||||
}
|
||||
protected WebLinkInfo() {}
|
||||
|
||||
public final Anchor toAnchor() {
|
||||
Anchor a = new Anchor();
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.google.gerrit.client.rpc;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -30,21 +29,18 @@ public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through the result map's entries and copy the key strings into the
|
||||
* "name" property of the corresponding child object. This only runs on the
|
||||
* top level map of the result, and requires the children to be JSON objects
|
||||
* and not a JSON primitive (e.g. boolean or string).
|
||||
* Loop through the result map's entries and copy the key strings into the "name" property of the
|
||||
* corresponding child object. This only runs on the top level map of the result, and requires the
|
||||
* children to be JSON objects and not a JSON primitive (e.g. boolean or string).
|
||||
*/
|
||||
public static <T extends JavaScriptObject,
|
||||
M extends NativeMap<T>> AsyncCallback<M> copyKeysIntoChildren(
|
||||
AsyncCallback<M> callback) {
|
||||
public static <T extends JavaScriptObject, M extends NativeMap<T>>
|
||||
AsyncCallback<M> copyKeysIntoChildren(AsyncCallback<M> callback) {
|
||||
return copyKeysIntoChildren("name", callback);
|
||||
}
|
||||
|
||||
/** Loop through the result map and set asProperty on the children. */
|
||||
public static <T extends JavaScriptObject,
|
||||
M extends NativeMap<T>> AsyncCallback<M> copyKeysIntoChildren(
|
||||
final String asProperty, AsyncCallback<M> callback) {
|
||||
public static <T extends JavaScriptObject, M extends NativeMap<T>>
|
||||
AsyncCallback<M> copyKeysIntoChildren(final String asProperty, AsyncCallback<M> callback) {
|
||||
return new TransformCallback<M, M>(callback) {
|
||||
@Override
|
||||
protected M transform(M result) {
|
||||
@@ -54,8 +50,7 @@ public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
|
||||
};
|
||||
}
|
||||
|
||||
protected NativeMap() {
|
||||
}
|
||||
protected NativeMap() {}
|
||||
|
||||
public final Set<String> keySet() {
|
||||
return Natives.keys(this);
|
||||
@@ -68,8 +63,7 @@ public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
|
||||
return sorted;
|
||||
}
|
||||
|
||||
public final native JsArray<T> values()
|
||||
/*-{
|
||||
public final native JsArray<T> values() /*-{
|
||||
var s = this;
|
||||
var v = [];
|
||||
var i = 0;
|
||||
@@ -94,10 +88,10 @@ public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native T get(String n) /*-{ return this[n]; }-*/;
|
||||
|
||||
public final native void put(String n, T v) /*-{ this[n] = v; }-*/;
|
||||
|
||||
public final native void copyKeysIntoChildren(String p)
|
||||
/*-{
|
||||
public final native void copyKeysIntoChildren(String p) /*-{
|
||||
var s = this;
|
||||
for (var k in s) {
|
||||
if (s.hasOwnProperty(k)) {
|
||||
|
||||
@@ -34,13 +34,11 @@ public final class NativeString extends JavaScriptObject {
|
||||
return wrap0(TYPE, s);
|
||||
}
|
||||
|
||||
private static native NativeString wrap0(JavaScriptObject T, String s)
|
||||
/*-{ return new T(s) }-*/;
|
||||
private static native NativeString wrap0(JavaScriptObject T, String s) /*-{ return new T(s) }-*/;
|
||||
|
||||
public native String asString() /*-{ return this.s; }-*/;
|
||||
|
||||
public static AsyncCallback<NativeString>
|
||||
unwrap(final AsyncCallback<String> cb) {
|
||||
public static AsyncCallback<NativeString> unwrap(final AsyncCallback<String> cb) {
|
||||
return new AsyncCallback<NativeString>() {
|
||||
@Override
|
||||
public void onSuccess(NativeString result) {
|
||||
@@ -59,8 +57,7 @@ public final class NativeString extends JavaScriptObject {
|
||||
}
|
||||
|
||||
private static native boolean is(JavaScriptObject T, JavaScriptObject o)
|
||||
/*-{ return o instanceof T }-*/;
|
||||
/*-{ return o instanceof T }-*/ ;
|
||||
|
||||
protected NativeString() {
|
||||
}
|
||||
protected NativeString() {}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -26,8 +25,8 @@ import java.util.Set;
|
||||
|
||||
public class Natives {
|
||||
/**
|
||||
* Get the names of defined properties on the object. The returned set
|
||||
* iterates in the native iteration order, which may match the source order.
|
||||
* Get the names of defined properties on the object. The returned set iterates in the native
|
||||
* iteration order, which may match the source order.
|
||||
*/
|
||||
public static Set<String> keys(JavaScriptObject obj) {
|
||||
if (obj != null) {
|
||||
@@ -60,8 +59,7 @@ public class Natives {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends JavaScriptObject> List<T> asList(
|
||||
final JsArray<T> arr) {
|
||||
public static <T extends JavaScriptObject> List<T> asList(final JsArray<T> arr) {
|
||||
if (arr == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -105,6 +103,5 @@ public class Natives {
|
||||
return arr;
|
||||
}
|
||||
|
||||
private Natives() {
|
||||
}
|
||||
private Natives() {}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class HighlightSuggestion implements Suggestion {
|
||||
int start = 0;
|
||||
int keyLen = keyword.length();
|
||||
SafeHtmlBuilder builder = new SafeHtmlBuilder();
|
||||
for (;;) {
|
||||
for (; ; ) {
|
||||
int index = value.indexOf(keyword, start);
|
||||
if (index == -1) {
|
||||
builder.appendEscaped(value.substring(start));
|
||||
|
||||
@@ -19,14 +19,13 @@ import com.google.gwt.user.client.ui.SuggestOracle;
|
||||
|
||||
/**
|
||||
* Delegates to a slow SuggestOracle, such as a remote server API.
|
||||
* <p>
|
||||
* A response is only supplied to the UI if no requests were made after the
|
||||
* oracle begin that request.
|
||||
* <p>
|
||||
* When a request is made while the delegate is still processing a prior request
|
||||
* all intermediate requests are discarded and the most recent request is
|
||||
* queued. The pending request's response is discarded and the most recent
|
||||
* request is started.
|
||||
*
|
||||
* <p>A response is only supplied to the UI if no requests were made after the oracle begin that
|
||||
* request.
|
||||
*
|
||||
* <p>When a request is made while the delegate is still processing a prior request all intermediate
|
||||
* requests are discarded and the most recent request is queued. The pending request's response is
|
||||
* discarded and the most recent request is started.
|
||||
*/
|
||||
public class RemoteSuggestOracle extends SuggestOracle {
|
||||
private final SuggestOracle oracle;
|
||||
@@ -47,7 +46,7 @@ public class RemoteSuggestOracle extends SuggestOracle {
|
||||
|
||||
@Override
|
||||
public void requestSuggestions(Request req, Callback cb) {
|
||||
if (!serveSuggestions){
|
||||
if (!serveSuggestions) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,18 +55,19 @@ public class RemoteSuggestOracle extends SuggestOracle {
|
||||
if (requestRetentionTimer != null) {
|
||||
requestRetentionTimer.cancel();
|
||||
}
|
||||
requestRetentionTimer = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
Query q = new Query(req, cb);
|
||||
if (query == null) {
|
||||
query = q;
|
||||
q.start();
|
||||
} else {
|
||||
query = q;
|
||||
}
|
||||
}
|
||||
};
|
||||
requestRetentionTimer =
|
||||
new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
Query q = new Query(req, cb);
|
||||
if (query == null) {
|
||||
query = q;
|
||||
q.start();
|
||||
} else {
|
||||
query = q;
|
||||
}
|
||||
}
|
||||
};
|
||||
requestRetentionTimer.schedule(200);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,13 @@ import static com.google.gerrit.client.RelativeDateFormatter.SECOND_IN_MILLIS;
|
||||
import static com.google.gerrit.client.RelativeDateFormatter.YEAR_IN_MILLIS;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Date;
|
||||
import org.eclipse.jgit.util.RelativeDateFormatter;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RelativeDateFormatterTest {
|
||||
|
||||
private static void assertFormat(long ageFromNow, long timeUnit,
|
||||
String expectedFormat) {
|
||||
private static void assertFormat(long ageFromNow, long timeUnit, String expectedFormat) {
|
||||
Date d = new Date(System.currentTimeMillis() - ageFromNow * timeUnit);
|
||||
String s = RelativeDateFormatter.format(d);
|
||||
assertEquals(expectedFormat, s);
|
||||
|
||||
@@ -25,9 +25,7 @@ public class HighlightSuggestionTest {
|
||||
String keyword = "key";
|
||||
String value = "somethingkeysomething";
|
||||
HighlightSuggestion suggestion = new HighlightSuggestion(keyword, value);
|
||||
assertEquals(
|
||||
"something<strong>key</strong>something",
|
||||
suggestion.getDisplayString());
|
||||
assertEquals("something<strong>key</strong>something", suggestion.getDisplayString());
|
||||
assertEquals(value, suggestion.getReplacementString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user