use of com.google.gerrit.client.rpc.GerritCallback in project gerrit by GerritCodeReview.
the class AccountGroupInfoScreen method initDescription.
private void initDescription() {
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName(Gerrit.RESOURCES.css().groupDescriptionPanel());
vp.add(new SmallHeading(AdminConstants.I.headingDescription()));
descTxt = new NpTextArea();
descTxt.setVisibleLines(6);
descTxt.setCharacterWidth(60);
vp.add(descTxt);
saveDesc = new Button(AdminConstants.I.buttonSaveDescription());
saveDesc.setEnabled(false);
saveDesc.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
final String txt = descTxt.getText().trim();
GroupApi.setGroupDescription(getGroupUUID(), txt, new GerritCallback<VoidResult>() {
@Override
public void onSuccess(final VoidResult result) {
saveDesc.setEnabled(false);
}
});
}
});
vp.add(saveDesc);
add(vp);
}
use of com.google.gerrit.client.rpc.GerritCallback in project gerrit by GerritCodeReview.
the class AccountGroupInfoScreen method initName.
private void initName() {
final VerticalPanel groupNamePanel = new VerticalPanel();
groupNamePanel.setStyleName(Gerrit.RESOURCES.css().groupNamePanel());
groupNameTxt = new NpTextBox();
groupNameTxt.setStyleName(Gerrit.RESOURCES.css().groupNameTextBox());
groupNameTxt.setVisibleLength(60);
groupNamePanel.add(groupNameTxt);
saveName = new Button(AdminConstants.I.buttonRenameGroup());
saveName.setEnabled(false);
saveName.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
final String newName = groupNameTxt.getText().trim();
GroupApi.renameGroup(getGroupUUID(), newName, new GerritCallback<com.google.gerrit.client.VoidResult>() {
@Override
public void onSuccess(final com.google.gerrit.client.VoidResult result) {
saveName.setEnabled(false);
setPageTitle(AdminMessages.I.group(newName));
groupNameTxt.setText(newName);
if (getGroupUUID().equals(getOwnerGroupUUID())) {
ownerTxt.setText(newName);
}
}
});
}
});
groupNamePanel.add(saveName);
add(groupNamePanel);
}
use of com.google.gerrit.client.rpc.GerritCallback in project gerrit by GerritCodeReview.
the class ActionContext method wrap.
private static GerritCallback<JavaScriptObject> wrap(final JavaScriptObject cb) {
return new GerritCallback<JavaScriptObject>() {
@Override
public void onSuccess(JavaScriptObject result) {
if (NativeString.is(result)) {
NativeString s = result.cast();
ApiGlue.invoke(cb, s.asString());
} else {
ApiGlue.invoke(cb, result);
}
}
};
}
use of com.google.gerrit.client.rpc.GerritCallback in project gerrit by GerritCodeReview.
the class RevertAction method call.
static void call(final Button b, final Change.Id id, final String revision, final String commitSubject) {
// TODO Replace ActionDialog with a nicer looking display.
b.setEnabled(false);
new TextAreaActionDialog(Util.C.revertChangeTitle(), Util.C.headingRevertMessage()) {
{
sendButton.setText(Util.C.buttonRevertChangeSend());
message.setText(Util.M.revertChangeDefaultMessage(commitSubject, revision));
}
@Override
public void onSend() {
ChangeApi.revert(id.get(), getMessageText(), new GerritCallback<ChangeInfo>() {
@Override
public void onSuccess(ChangeInfo result) {
sent = true;
hide();
Gerrit.display(PageLinks.toChange(result.legacyId()));
}
@Override
public void onFailure(Throwable caught) {
enableButtons(true);
super.onFailure(caught);
}
});
}
@Override
public void onClose(CloseEvent<PopupPanel> event) {
super.onClose(event);
b.setEnabled(true);
}
}.center();
}
use of com.google.gerrit.client.rpc.GerritCallback in project gerrit by GerritCodeReview.
the class RebaseAction method call.
static void call(final Button b, final String project, final String branch, final Change.Id id, final String revision, final boolean enabled) {
b.setEnabled(false);
new RebaseDialog(project, branch, id, enabled) {
@Override
public void onSend() {
ChangeApi.rebase(id.get(), revision, getBase(), new GerritCallback<ChangeInfo>() {
@Override
public void onSuccess(ChangeInfo result) {
sent = true;
hide();
Gerrit.display(PageLinks.toChange(id));
}
@Override
public void onFailure(Throwable caught) {
enableButtons(true);
super.onFailure(caught);
}
});
}
@Override
public void onClose(CloseEvent<PopupPanel> event) {
super.onClose(event);
b.setEnabled(true);
}
}.center();
}
Aggregations