use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.
the class DownloadBox method insertPatch.
private void insertPatch() {
String id = revision.substring(0, 7);
Anchor patchBase64 = new Anchor(id + ".diff.base64");
patchBase64.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("download").url());
Anchor patchZip = new Anchor(id + ".diff.zip");
patchZip.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("zip").url());
HorizontalPanel p = new HorizontalPanel();
p.add(patchBase64);
InlineLabel spacer = new InlineLabel("|");
spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
p.add(spacer);
p.add(patchZip);
insertCommand("Patch-File", p);
}
use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.
the class DownloadBox method insertArchive.
private void insertArchive() {
List<String> activated = Gerrit.info().download().archives();
if (activated.isEmpty()) {
return;
}
List<Anchor> anchors = new ArrayList<>(activated.size());
for (String f : activated) {
Anchor archive = new Anchor(f);
archive.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("archive").addParameter("format", f).url());
anchors.add(archive);
}
HorizontalPanel p = new HorizontalPanel();
Iterator<Anchor> it = anchors.iterator();
while (it.hasNext()) {
Anchor a = it.next();
p.add(a);
if (it.hasNext()) {
InlineLabel spacer = new InlineLabel("|");
spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
p.add(spacer);
}
}
insertCommand("Archive", p);
}
use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.
the class MyProfileScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
HorizontalPanel h = new HorizontalPanel();
add(h);
if (Gerrit.info().plugin().hasAvatars()) {
VerticalPanel v = new VerticalPanel();
v.addStyleName(Gerrit.RESOURCES.css().avatarInfoPanel());
h.add(v);
avatar = new AvatarImage();
v.add(avatar);
changeAvatar = new Anchor(Util.C.changeAvatar(), "", "_blank");
changeAvatar.setVisible(false);
v.add(changeAvatar);
}
if (LocaleInfo.getCurrentLocale().isRTL()) {
labelIdx = 1;
fieldIdx = 0;
} else {
labelIdx = 0;
fieldIdx = 1;
}
info = new Grid((Gerrit.info().auth().siteHasUsernames() ? 1 : 0) + 4, 2);
info.setStyleName(Gerrit.RESOURCES.css().infoBlock());
info.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
h.add(info);
int row = 0;
if (Gerrit.info().auth().siteHasUsernames()) {
infoRow(row++, Util.C.userName());
}
infoRow(row++, Util.C.fullName());
infoRow(row++, Util.C.preferredEmail());
infoRow(row++, Util.C.registeredOn());
infoRow(row++, Util.C.accountId());
final CellFormatter fmt = info.getCellFormatter();
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
}
use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.
the class Gerrit method addDocLink.
private static void addDocLink(final LinkMenuBar m, final String text, final String href) {
final Anchor atag = anchor(text, docUrl + href);
atag.setTarget("_blank");
m.add(atag);
}
use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.
the class CreateProjectScreen method initSuggestedParents.
private void initSuggestedParents() {
suggestedParentsTab = new ProjectsTable() {
{
table.setText(0, 1, AdminConstants.I.parentSuggestions());
}
@Override
protected void populate(final int row, final ProjectInfo k) {
final Anchor projectLink = new Anchor(k.name());
projectLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
parent.setText(getRowItem(row).name());
}
});
table.setWidget(row, 2, projectLink);
table.setText(row, 3, k.description());
setRowItem(row, k);
}
};
suggestedParentsTab.setVisible(false);
ProjectMap.parentCandidates(new GerritCallback<ProjectMap>() {
@Override
public void onSuccess(ProjectMap list) {
if (!list.isEmpty()) {
suggestedParentsTab.setVisible(true);
suggestedParentsTab.display(list);
suggestedParentsTab.finishDisplay();
}
}
});
}
Aggregations