use of com.google.gerrit.client.info.WebLinkInfo in project gerrit by GerritCodeReview.
the class PatchSetSelectBox method setUpPatchSetNav.
void setUpPatchSetNav(JsArray<RevisionInfo> list, int parents, DiffInfo.FileMeta meta, boolean editExists, boolean current, boolean open, boolean binary) {
InlineHyperlink selectedLink = null;
if (sideA) {
if (parents <= 1) {
InlineHyperlink link = createLink(PatchUtil.C.patchBase(), DiffObject.base());
linkPanel.add(link);
selectedLink = link;
} else {
for (int i = parents; i > 0; i--) {
PatchSet.Id id = new PatchSet.Id(changeId, -i);
InlineHyperlink link = createLink(Util.M.diffBaseParent(i), DiffObject.patchSet(id));
linkPanel.add(link);
if (revision != null && id.equals(revision)) {
selectedLink = link;
}
}
InlineHyperlink link = createLink(Util.C.autoMerge(), DiffObject.autoMerge());
linkPanel.add(link);
if (selectedLink == null) {
selectedLink = link;
}
}
}
for (int i = 0; i < list.length(); i++) {
RevisionInfo r = list.get(i);
InlineHyperlink link = createLink(r.id(), DiffObject.patchSet(new PatchSet.Id(changeId, r._number())));
linkPanel.add(link);
if (revision != null && r.id().equals(revision.getId())) {
selectedLink = link;
}
}
if (selectedLink != null) {
selectedLink.setStyleName(style.selected());
}
if (meta == null) {
return;
}
if (!Patch.isMagic(path)) {
linkPanel.add(createDownloadLink());
}
if (!binary && open && !idActive.isBaseOrAutoMerge() && Gerrit.isSignedIn()) {
if ((editExists && idActive.isEdit()) || (!editExists && current)) {
linkPanel.add(createEditIcon());
}
}
List<WebLinkInfo> webLinks = Natives.asList(meta.webLinks());
if (webLinks != null) {
for (WebLinkInfo webLink : webLinks) {
linkPanel.add(webLink.toAnchor());
}
}
}
use of com.google.gerrit.client.info.WebLinkInfo in project gerrit by GerritCodeReview.
the class ProjectListScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(AdminConstants.I.projectListTitle());
initPageHeader();
prev = PagingHyperlink.createPrev();
prev.setVisible(false);
next = PagingHyperlink.createNext();
next.setVisible(false);
projects = new ProjectsTable() {
@Override
protected void initColumnHeaders() {
super.initColumnHeaders();
table.setText(0, ProjectsTable.C_REPO_BROWSER, AdminConstants.I.projectRepoBrowser());
table.getFlexCellFormatter().addStyleName(0, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataHeader());
}
@Override
protected void onOpenRow(final int row) {
History.newItem(link(getRowItem(row)));
}
private String link(final ProjectInfo item) {
return Dispatcher.toProject(item.name_key());
}
@Override
protected void insert(int row, ProjectInfo k) {
super.insert(row, k);
table.getFlexCellFormatter().addStyleName(row, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataCell());
}
@Override
protected void populate(final int row, final ProjectInfo k) {
Image state = new Image();
switch(k.state()) {
case HIDDEN:
state.setResource(Gerrit.RESOURCES.redNot());
state.setTitle(Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case READ_ONLY:
state.setResource(Gerrit.RESOURCES.readOnly());
state.setTitle(Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case ACTIVE:
default:
// Intentionally left blank, do not show an icon when active.
break;
}
FlowPanel fp = new FlowPanel();
fp.add(new ProjectSearchLink(k.name_key()));
fp.add(new HighlightingInlineHyperlink(k.name(), link(k), match));
table.setWidget(row, ProjectsTable.C_NAME, fp);
table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
addWebLinks(row, k);
setRowItem(row, k);
}
private void addWebLinks(int row, ProjectInfo k) {
List<WebLinkInfo> webLinks = Natives.asList(k.webLinks());
if (webLinks != null && !webLinks.isEmpty()) {
FlowPanel p = new FlowPanel();
table.setWidget(row, ProjectsTable.C_REPO_BROWSER, p);
for (WebLinkInfo weblink : webLinks) {
p.add(weblink.toAnchor());
}
}
}
};
projects.setSavePointerId(PageLinks.ADMIN_PROJECTS);
add(projects);
final HorizontalPanel buttons = new HorizontalPanel();
buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
buttons.add(prev);
buttons.add(next);
add(buttons);
}
use of com.google.gerrit.client.info.WebLinkInfo in project gerrit by GerritCodeReview.
the class Header method init.
void init(PreferencesAction pa, List<InlineHyperlink> links, List<WebLinkInfo> webLinks) {
prefsAction = pa;
prefsAction.setPartner(preferences);
for (InlineHyperlink link : links) {
linkPanel.add(link);
}
for (WebLinkInfo webLink : webLinks) {
linkPanel.add(webLink.toAnchor());
}
}
use of com.google.gerrit.client.info.WebLinkInfo in project gerrit by GerritCodeReview.
the class DiffInfo method filterWebLinks.
private List<WebLinkInfo> filterWebLinks(DiffView diffView) {
List<WebLinkInfo> filteredDiffWebLinks = new ArrayList<>();
List<DiffWebLinkInfo> allDiffWebLinks = Natives.asList(webLinks());
if (allDiffWebLinks != null) {
for (DiffWebLinkInfo webLink : allDiffWebLinks) {
if (diffView == DiffView.SIDE_BY_SIDE && webLink.showOnSideBySideDiffView()) {
filteredDiffWebLinks.add(webLink);
}
if (diffView == DiffView.UNIFIED_DIFF && webLink.showOnUnifiedDiffView()) {
filteredDiffWebLinks.add(webLink);
}
}
}
return filteredDiffWebLinks;
}
Aggregations