use of com.google.gwt.core.client.JsArray in project gerrit by GerritCodeReview.
the class MyWatchesTable method addNotifyButton.
protected void addNotifyButton(final ProjectWatchInfo.Type type, final ProjectWatchInfo info, final int row, final int col) {
final CheckBox cbox = new CheckBox();
cbox.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
final Boolean oldVal = info.notify(type);
info.notify(type, cbox.getValue());
cbox.setEnabled(false);
AccountApi.updateWatchedProject("self", info, new GerritCallback<JsArray<ProjectWatchInfo>>() {
@Override
public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
cbox.setEnabled(true);
}
@Override
public void onFailure(Throwable caught) {
cbox.setEnabled(true);
info.notify(type, oldVal);
cbox.setValue(oldVal);
super.onFailure(caught);
}
});
}
});
cbox.setValue(info.notify(type));
table.setWidget(row, col, cbox);
}
use of com.google.gwt.core.client.JsArray in project gerrit by GerritCodeReview.
the class ChangeScreen method onLoad.
@Override
protected void onLoad() {
super.onLoad();
CallbackGroup group = new CallbackGroup();
if (Gerrit.isSignedIn()) {
ChangeList.query("change:" + changeId.get() + " has:draft", Collections.<ListChangesOption>emptySet(), group.add(new AsyncCallback<ChangeList>() {
@Override
public void onSuccess(ChangeList result) {
hasDraftComments = result.length() > 0;
}
@Override
public void onFailure(Throwable caught) {
}
}));
ChangeApi.editWithFiles(changeId.get(), group.add(new AsyncCallback<EditInfo>() {
@Override
public void onSuccess(EditInfo result) {
edit = result;
}
@Override
public void onFailure(Throwable caught) {
}
}));
}
loadChangeInfo(true, group.addFinal(new GerritCallback<ChangeInfo>() {
@Override
public void onSuccess(final ChangeInfo info) {
info.init();
initCurrentRevision(info);
final RevisionInfo rev = info.revision(revision);
CallbackGroup group = new CallbackGroup();
loadCommit(rev, group);
group.addListener(new GerritCallback<Void>() {
@Override
public void onSuccess(Void result) {
if (base.isBase() && rev.isMerge()) {
base = DiffObject.parse(info.legacyId(), Gerrit.getUserPreferences().defaultBaseForMerges().getBase());
}
loadConfigInfo(info, base);
JsArray<MessageInfo> mAr = info.messages();
for (int i = 0; i < mAr.length(); i++) {
if (mAr.get(i).tag() != null) {
hideTaggedComments.setVisible(true);
break;
}
}
}
});
group.done();
}
}));
}
use of com.google.gwt.core.client.JsArray in project gerrit by GerritCodeReview.
the class ReplyBox method onLoad.
@Override
protected void onLoad() {
commentsPanel.setVisible(false);
post.setEnabled(false);
if (lc.hasReplyComment()) {
message.setText(lc.getReplyComment());
lc.removeReplyComment();
}
ChangeApi.drafts(psId.getParentKey().get()).get(new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
@Override
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
displayComments(result);
post.setEnabled(true);
}
@Override
public void onFailure(Throwable caught) {
post.setEnabled(true);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
message.setFocus(true);
}
});
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
String t = message.getText();
if (t != null) {
message.setCursorPos(t.length());
}
return false;
}
}, 0);
}
use of com.google.gwt.core.client.JsArray in project gerrit by GerritCodeReview.
the class ChangeScreen method filterForRevision.
private static NativeMap<JsArray<CommentInfo>> filterForRevision(NativeMap<JsArray<CommentInfo>> comments, int id) {
NativeMap<JsArray<CommentInfo>> filtered = NativeMap.create();
for (String k : comments.keySet()) {
JsArray<CommentInfo> allRevisions = comments.get(k);
JsArray<CommentInfo> thisRevision = JsArray.createArray().cast();
for (int i = 0; i < allRevisions.length(); i++) {
CommentInfo c = allRevisions.get(i);
if (c.patchSet() == id) {
thisRevision.push(c);
}
}
filtered.put(k, thisRevision);
}
return filtered;
}
Aggregations