Search in sources :

Example 51 with Image

use of com.google.gwt.user.client.ui.Image in project gerrit by GerritCodeReview.

the class GroupTable method populate.

void populate(final int row, final GroupInfo k, final String toHighlight) {
    if (k.url() != null) {
        if (isInteralGroup(k)) {
            table.setWidget(row, 1, new HighlightingInlineHyperlink(k.name(), Dispatcher.toGroup(k.getGroupId()), toHighlight));
        } else {
            Anchor link = new Anchor();
            link.setHTML(Util.highlight(k.name(), toHighlight));
            link.setHref(k.url());
            table.setWidget(row, 1, link);
        }
    } else {
        table.setHTML(row, 1, Util.highlight(k.name(), toHighlight));
    }
    table.setText(row, 2, k.description());
    if (k.options().isVisibleToAll()) {
        table.setWidget(row, 3, new Image(Gerrit.RESOURCES.greenCheck()));
    }
    final FlexCellFormatter fmt = table.getFlexCellFormatter();
    fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().groupName());
    for (int i = 1; i <= NUM_COLS; i++) {
        fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
    }
    setRowItem(row, k);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) Image(com.google.gwt.user.client.ui.Image) HighlightingInlineHyperlink(com.google.gerrit.client.ui.HighlightingInlineHyperlink)

Example 52 with Image

use of com.google.gwt.user.client.ui.Image in project gerrit by GerritCodeReview.

the class DashboardsTable method populate.

protected void populate(final int row, final DashboardInfo k) {
    if (k.isDefault()) {
        table.setWidget(row, 1, new Image(Gerrit.RESOURCES.greenCheck()));
        final FlexCellFormatter fmt = table.getFlexCellFormatter();
        fmt.getElement(row, 1).setTitle(Util.C.dashboardDefaultToolTip());
    }
    table.setWidget(row, 2, new Anchor(k.path(), "#" + PageLinks.toProjectDashboard(new Project.NameKey(k.project()), k.id())));
    table.setText(row, 3, k.title() != null ? k.title() : k.path());
    table.setText(row, 4, k.description());
    if (k.definingProject() != null && !k.definingProject().equals(k.project())) {
        table.setWidget(row, 5, new Anchor(k.definingProject(), "#" + PageLinks.toProjectDashboards(new Project.NameKey(k.definingProject()))));
    }
    setRowItem(row, k);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) Image(com.google.gwt.user.client.ui.Image)

Aggregations

Image (com.google.gwt.user.client.ui.Image)52 Test (org.junit.Test)13 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)9 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)9 Element (com.google.gwt.dom.client.Element)8 Label (com.google.gwt.user.client.ui.Label)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)7 ImageResource (com.google.gwt.resources.client.ImageResource)6 FlexTable (com.google.gwt.user.client.ui.FlexTable)5 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 HTML (com.google.gwt.user.client.ui.HTML)5 Style (com.google.gwt.dom.client.Style)4 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)4 Anchor (com.google.gwt.user.client.ui.Anchor)4 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)4 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)3 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)3 HighlightingInlineHyperlink (com.google.gerrit.client.ui.HighlightingInlineHyperlink)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2