com.vaadin.ui.Button.setIcon()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.vaadin.ui.Button.setIcon()方法的一些代码示例,展示了Button.setIcon()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setIcon()方法的具体详情如下:
包路径:com.vaadin.ui.Button
类名称:Button
方法名:setIcon

Button.setIcon介绍

[英]Sets the component's icon and alt text.

An alt text is shown when an image could not be loaded, and read by assistive devices.
[中]设置组件的图标和alt文本。
当图像无法加载并被辅助设备读取时,将显示alt文本。

代码示例

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Creates a new push button with the given icon.
 *
 * @param icon
 *            the icon
 */
public Button(Resource icon) {
  this();
  setIcon(icon);
}

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Creates a new push button with the given caption and icon.
 *
 * @param caption
 *            the caption
 * @param icon
 *            the icon
 */
public Button(String caption, Resource icon) {
  this();
  setCaption(caption);
  setIcon(icon);
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private void setButtonIcon(final Resource icon) {

    if (icon == null) {
      return;
    }
    button.setIcon(icon);
  }
}

代码示例来源:origin: eclipse/hawkbit

private void setButtonIcon(final Resource icon) {

    if (icon == null) {
      return;
    }
    button.setIcon(icon);
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
  public void buttonClick(Button.ClickEvent event) {
    if(eyeClosed[0]) {
      showFocusVerticesBtn.setIcon(FontAwesome.EYE);
    } else {
      showFocusVerticesBtn.setIcon(FontAwesome.EYE_SLASH);
    }
    eyeClosed[0] = !eyeClosed[0]; // toggle
    controller.toggleHighlightFocus();
  }
});

代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.app

@Override
  public void buttonClick(Button.ClickEvent event) {
    if(eyeClosed[0]) {
      showFocusVerticesBtn.setIcon(FontAwesome.EYE);
    } else {
      showFocusVerticesBtn.setIcon(FontAwesome.EYE_SLASH);
    }
    eyeClosed[0] = !eyeClosed[0]; // toggle
    controller.toggleHighlightFocus();
  }
});

代码示例来源:origin: com.haulmont.cuba/cuba-web

protected void setPopupButtonIcon(Button button, String icon) {
  if (!StringUtils.isEmpty(icon)) {
    Resource iconResource = getIconResource(icon);
    button.setIcon(iconResource);
  } else {
    button.setIcon(null);
  }
}

代码示例来源:origin: org.ikasan/ikasan-dashboard-jar

public void buttonClick(Button.ClickEvent event)
  {
    selectAllButton.setIcon(VaadinIcons.CHECK_SQUARE_O);
    search(searchField.getValue());
  }
});

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Inject
public void setIconResolver(IconResolver iconResolver) {
  // todo extract icon constants
  component.getFirstButton().setIcon(iconResolver.getIconResource("icons/rows-count-first.png"));
  component.getPrevButton().setIcon(iconResolver.getIconResource("icons/rows-count-prev.png"));
  component.getNextButton().setIcon(iconResolver.getIconResource("icons/rows-count-next.png"));
  component.getLastButton().setIcon(iconResolver.getIconResource("icons/rows-count-last.png"));
}

代码示例来源:origin: org.aperteworkflow/gui-commons

public static Button link(String caption, Resource icon, Button.ClickListener listener) {
  Button b = button(caption, null, "link", listener);
  b.setIcon(icon);
  b.setWidth(b.getWidth() + 10, Sizeable.UNITS_PIXELS);
  return b;
}

代码示例来源:origin: com.github.markash/components

public static Button build(final String caption, final VaadinIcons icon, final ClickListener listener) {
  Button button = new Button(caption);
  button.setIcon(icon);
  button.setWidth(100.0f, Unit.PERCENTAGE);
  if (listener != null) {
    button.addClickListener(listener);
  }
  return button;
}

代码示例来源:origin: com.haulmont.thirdparty/popupbutton

private Button createIconButton(String icon) {
    Button b = new Button();
    b.setIcon(new ThemeResource(icon));
    b.setStyleName(Reindeer.BUTTON_LINK);
    return b;
  }
}

代码示例来源:origin: OpenNMS/opennms

public static Button createButton(
    final String buttonCaption,
    final String buttonDescription,
    final Resource icon,
    final ClickListener clickListener) {
  Button button = new Button();
  button.setCaption(buttonCaption);
  button.setIcon(icon);
  if (buttonDescription != null) button.setDescription(buttonDescription);
  if (clickListener != null) button.addClickListener(clickListener);
  return button;
}

代码示例来源:origin: org.opennms.features.vaadin-components/core

public static Button createButton(
    final String buttonCaption,
    final String buttonDescription,
    final Resource icon,
    final ClickListener clickListener) {
  Button button = new Button();
  button.setCaption(buttonCaption);
  button.setIcon(icon);
  if (buttonDescription != null) button.setDescription(buttonDescription);
  if (clickListener != null) button.addClickListener(clickListener);
  return button;
}

代码示例来源:origin: org.aperteworkflow/gui-commons

public static Button icon(String description, Resource icon, Button.ClickListener listener) {
  Button b = new Button();
  b.setStyleName("link");
  b.setIcon(icon);
  b.setImmediate(true);
  b.setDescription(description);
  if (listener != null) {
    b.addListener(listener);
  }
  return b;
}

代码示例来源:origin: eclipse/hawkbit

private void createComponents() {
  uploadProgressButton = SPUIComponentProvider.getButton(UIComponentIdProvider.UPLOAD_STATUS_BUTTON, "", "", "",
      false, null, SPUIButtonStyleNoBorder.class);
  uploadProgressButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
  uploadProgressButton.setIcon(null);
  uploadProgressButton.setHtmlContentAllowed(true);
  uploadProgressButton.addClickListener(event -> onClickOfUploadProgressButton());
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void initActions() {
 Button newCaseButton = new Button();
 newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW));
 newCaseButton.setIcon(Images.TASK_16);
 addButton(newCaseButton);
 
 newCaseButton.addListener(new ClickListener() {
  public void buttonClick(ClickEvent event) {
   NewCasePopupWindow newTaskPopupWindow = new NewCasePopupWindow();
   viewManager.showPopupWindow(newTaskPopupWindow);
  }
 });
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void addActions() {
 // Delete button
 Button deleteButton = new Button(i18nManager.getMessage(Messages.DEPLOYMENT_DELETE));
 deleteButton.setIcon(Images.DELETE);
 deleteButton.addListener(new ClickListener() {
  public void buttonClick(ClickEvent event) {
   viewManager.showPopupWindow(new DeleteDeploymentPopupWindow(deployment, parent));
  }
 });
 
 parent.getToolBar().removeAllButtons();
 parent.getToolBar().addButton(deleteButton);
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private Component buildToggleButton() {
  final Button valoMenuToggleButton = new Button(i18n.getMessage("label.menu"),
      new MenuToggleClickListenerMyClickListener());
  valoMenuToggleButton.setIcon(FontAwesome.LIST);
  valoMenuToggleButton.addStyleName("valo-menu-toggle");
  valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
  valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_SMALL);
  return valoMenuToggleButton;
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void addDeleteButton() {
 Button deleteProcessInstanceButton = new Button(i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE));
 deleteProcessInstanceButton.setIcon(Images.DELETE);
 deleteProcessInstanceButton.addListener(new DeleteProcessInstanceClickListener(processInstance.getId(), processInstancePage));
 
 // Clear toolbar and add 'start' button
 processInstancePage.getToolBar().removeAllButtons();
 processInstancePage.getToolBar().addButton(deleteProcessInstanceButton);
}

相关文章