Java 类com.google.gwt.user.client.ui.ImageResourceRenderer 实例源码

项目:gerrit    文件:FileTable.java   
private void columnDeleteRestore(SafeHtmlBuilder sb, FileInfo info) {
  sb.openTd().setStyleName(R.css().restoreDelete());
  if (hasUser) {
    if (!Patch.isMagic(info.path())) {
      boolean editable = isEditable(info);
      sb.openDiv()
          .openElement("button")
          .setAttribute("title", Resources.C.restoreFileInline())
          .setAttribute("onclick", RESTORE + "(event," + info._row() + ")")
          .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.editUndo()))
          .closeElement("button");
      if (editable) {
        sb.openElement("button")
            .setAttribute("title", Resources.C.removeFileInline())
            .setAttribute("onclick", DELETE + "(event," + info._row() + ")")
            .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.redNot()))
            .closeElement("button");
      }
      sb.closeDiv();
    }
  }
  sb.closeTd();
}
项目:wte4j    文件:MyMenuItem.java   
@UiConstructor
public MyMenuItem(String text, ImageResource res) {
    super(SafeHtmlUtils.fromString(text));

    ImageResourceRenderer renderer = new ImageResourceRenderer();
    setHTML(renderer.render(res).asString() + " " + text);
}
项目:gerrit    文件:PluginListScreen.java   
void populate(int row, PluginInfo plugin) {
  if (plugin.disabled() || plugin.indexUrl() == null) {
    table.setText(row, 1, plugin.name());
  } else {
    table.setWidget(
        row, 1, new Anchor(plugin.name(), Gerrit.selfRedirect(plugin.indexUrl()), "_blank"));

    if (new ExtensionScreen(plugin.name() + "/settings").isFound()) {
      InlineHyperlink adminScreenLink = new InlineHyperlink();
      adminScreenLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.gear()));
      adminScreenLink.setTargetHistoryToken("/x/" + plugin.name() + "/settings");
      adminScreenLink.setTitle(AdminConstants.I.pluginSettingsToolTip());
      table.setWidget(row, 2, adminScreenLink);
    }
  }

  table.setText(row, 3, plugin.version());
  table.setText(
      row,
      4,
      plugin.disabled() ? AdminConstants.I.pluginDisabled() : AdminConstants.I.pluginEnabled());

  final FlexCellFormatter fmt = table.getFlexCellFormatter();
  fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
  fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
  fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
  fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());

  setRowItem(row, plugin);
}
项目:gerrit    文件:SideBySide.java   
private List<InlineHyperlink> getUnifiedDiffLink() {
  InlineHyperlink toUnifiedDiffLink = new InlineHyperlink();
  toUnifiedDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff()));
  toUnifiedDiffLink.setTargetHistoryToken(
      Dispatcher.toUnified(getProject(), base, revision, path));
  toUnifiedDiffLink.setTitle(PatchUtil.C.unifiedDiff());
  return Collections.singletonList(toUnifiedDiffLink);
}
项目:gerrit    文件:PatchSetSelectBox.java   
private Widget createEditIcon() {
  PatchSet.Id id =
      idActive.isBaseOrAutoMerge() ? other.idActive.asPatchSetId() : idActive.asPatchSetId();
  Anchor anchor =
      new Anchor(
          new ImageResourceRenderer().render(Gerrit.RESOURCES.edit()),
          "#" + Dispatcher.toEditScreen(project, id, path));
  anchor.setTitle(PatchUtil.C.edit());
  return anchor;
}
项目:gerrit    文件:PatchSetSelectBox.java   
private Anchor createDownloadLink() {
  DiffObject diffObject = idActive.isBaseOrAutoMerge() ? other.idActive : idActive;
  String sideURL = idActive.isBaseOrAutoMerge() ? "1" : "0";
  String base = GWT.getHostPageBaseURL() + "cat/";
  Anchor anchor =
      new Anchor(
          new ImageResourceRenderer().render(Gerrit.RESOURCES.downloadIcon()),
          base + KeyUtil.encode(diffObject.asPatchSetId() + "," + path) + "^" + sideURL);
  anchor.setTitle(PatchUtil.C.download());
  return anchor;
}
项目:gerrit    文件:Unified.java   
private List<InlineHyperlink> getSideBySideDiffLink() {
  InlineHyperlink toSideBySideDiffLink = new InlineHyperlink();
  toSideBySideDiffLink.setHTML(
      new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff()));
  toSideBySideDiffLink.setTargetHistoryToken(
      Dispatcher.toSideBySide(getProject(), base, revision, path));
  toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff());
  return Collections.singletonList(toSideBySideDiffLink);
}
项目:gerrit    文件:Hashtags.java   
private SafeHtmlBuilder formatHashtags(JsArrayString hashtags) {
  SafeHtmlBuilder html = new SafeHtmlBuilder();
  Iterator<String> itr = Natives.asList(hashtags).iterator();
  while (itr.hasNext()) {
    String hashtagName = itr.next();
    html.openSpan()
        .setAttribute(DATA_ID, hashtagName)
        .setStyleName(style.hashtagName())
        .openAnchor()
        .setAttribute("href", "#" + PageLinks.toChangeQuery("hashtag:\"" + hashtagName + "\""))
        .setAttribute("role", "listitem")
        .openSpan()
        .setStyleName(style.hashtagIcon())
        .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.hashtag()))
        .closeSpan()
        .append(" ")
        .append(hashtagName)
        .closeAnchor();
    if (canEdit) {
      html.openElement("button")
          .setAttribute("title", "Remove hashtag")
          .setAttribute("onclick", REMOVE + "(event)")
          .append("×")
          .closeElement("button");
    }
    html.closeSpan();
    if (itr.hasNext()) {
      html.append(' ');
    }
  }
  return html;
}
项目:gerrit    文件:EditScreen.java   
private void renderLinksToDiff() {
  InlineHyperlink sbs = new InlineHyperlink();
  sbs.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff()));
  sbs.setTargetHistoryToken(
      Dispatcher.toPatch(projectKey, "sidebyside", null, new Patch.Key(revision, path)));
  sbs.setTitle(PatchUtil.C.sideBySideDiff());
  linkPanel.add(sbs);

  InlineHyperlink unified = new InlineHyperlink();
  unified.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff()));
  unified.setTargetHistoryToken(
      Dispatcher.toPatch(projectKey, "unified", null, new Patch.Key(revision, path)));
  unified.setTitle(PatchUtil.C.unifiedDiff());
  linkPanel.add(unified);
}
项目:gerrit    文件:PatchSetSelectBox.java   
private Anchor createBlameIcon() {
  Anchor anchor = new Anchor(new ImageResourceRenderer().render(Gerrit.RESOURCES.blame()));
  anchor.setTitle(PatchUtil.C.blame());
  return anchor;
}
项目:wsdot-mobile-app    文件:FerriesRouteSchedulesViewGwtImpl.java   
public FerriesRouteSchedulesViewGwtImpl() {

    pullToRefresh = new PullPanel();
    pullArrowHeader = new PullArrowHeader();
    pullToRefresh.setHeader(pullArrowHeader);

    cellList = new CellList<FerriesRouteItem>(
            new FerriesRouteSchedulesCell<FerriesRouteItem>() {

        private ImageResourceRenderer imageRenderer = new ImageResourceRenderer();

        @Override
        public String getDescription(FerriesRouteItem model) {
            return model.getDescription();
        }

        @Override
        public String getLastUpdated(FerriesRouteItem model) {
            return ParserUtils.relativeTime(model.getCacheDate(),
                    "MMMM d, yyyy h:mm a", false);
        }

        @Override
        public SafeHtml getAlertImage(FerriesRouteItem model) {
            boolean hasAlerts = false;

            if (!model.getRouteAlert().equals("[]")) hasAlerts = true;
            SafeHtml image = imageRenderer.render(AppBundle.INSTANCE.btnAlertPNG());

            return hasAlerts ? image : SafeHtmlUtils.fromString("");
        }

           @Override
           public String getCrossingTime(FerriesRouteItem model) {
               try {
                   if (model.getCrossingTime().equalsIgnoreCase("null")) {
                       return "";
                   } else {
                       return "Crossing Time: ~ " + model.getCrossingTime() + " min";
                   }
               } catch (Exception e) {
                   return "";
               }
           }
    });

    initWidget(uiBinder.createAndBindUi(this));

    accessibilityPrepare();

    if (MGWT.getOsDetection().isAndroid()) {
           leftFlexSpacer.setVisible(false);
       }
}