Search in sources :

Example 76 with Image

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

the class WebLinkInfo method toAnchor.

public final Anchor toAnchor() {
    Anchor a = new Anchor();
    a.setHref(url());
    if (target() != null && !target().isEmpty()) {
        a.setTarget(target());
    }
    if (imageUrl() != null && !imageUrl().isEmpty()) {
        Image img = new Image();
        img.setAltText(name());
        img.setUrl(imageUrl());
        img.setTitle(name());
        a.getElement().appendChild(img.getElement());
    } else {
        a.setText("(" + name() + ")");
    }
    return a;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Image(com.google.gwt.user.client.ui.Image)

Example 77 with Image

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

the class ProjectAccessEditor method toAnchor.

private static Anchor toAnchor(WebLinkInfoCommon info) {
    Anchor a = new Anchor();
    a.setHref(info.url);
    if (info.target != null && !info.target.isEmpty()) {
        a.setTarget(info.target);
    }
    if (info.imageUrl != null && !info.imageUrl.isEmpty()) {
        Image img = new Image();
        img.setAltText(info.name);
        img.setUrl(info.imageUrl);
        img.setTitle(info.name);
        a.getElement().appendChild(img.getElement());
    } else {
        a.setText("(" + info.name + ")");
    }
    return a;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Image(com.google.gwt.user.client.ui.Image)

Example 78 with Image

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

the class ProjectInfoScreen method renderCheckBox.

private CheckBox renderCheckBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
    CheckBox checkBox = new CheckBox(getDisplayName(param));
    checkBox.setValue(Boolean.parseBoolean(param.value()));
    HorizontalPanel p = new HorizontalPanel();
    p.add(checkBox);
    if (param.description() != null) {
        Image infoImg = new Image(Gerrit.RESOURCES.info());
        infoImg.setTitle(param.description());
        p.add(infoImg);
    }
    if (param.warning() != null) {
        Image warningImg = new Image(Gerrit.RESOURCES.warning());
        warningImg.setTitle(param.warning());
        p.add(warningImg);
    }
    g.add((String) null, p);
    saveEnabler.listenTo(checkBox);
    return checkBox;
}
Also used : CheckBox(com.google.gwt.user.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Image(com.google.gwt.user.client.ui.Image)

Example 79 with Image

use of com.google.gwt.user.client.ui.Image 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);
}
Also used : WebLinkInfo(com.google.gerrit.client.info.WebLinkInfo) ProjectsTable(com.google.gerrit.client.ui.ProjectsTable) ProjectSearchLink(com.google.gerrit.client.ui.ProjectSearchLink) ProjectInfo(com.google.gerrit.client.projects.ProjectInfo) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) List(java.util.List) Image(com.google.gwt.user.client.ui.Image) HighlightingInlineHyperlink(com.google.gerrit.client.ui.HighlightingInlineHyperlink)

Example 80 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)

Aggregations

Image (com.google.gwt.user.client.ui.Image)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)28 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)28 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)15 Test (org.junit.Test)13 FlexTable (com.google.gwt.user.client.ui.FlexTable)12 HTML (com.google.gwt.user.client.ui.HTML)10 Element (com.google.gwt.dom.client.Element)8 Label (com.google.gwt.user.client.ui.Label)8 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)7 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)7 ImageResource (com.google.gwt.resources.client.ImageResource)6 Widget (com.google.gwt.user.client.ui.Widget)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 Style (com.google.gwt.dom.client.Style)4 Anchor (com.google.gwt.user.client.ui.Anchor)4 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)4 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)3