本文整理汇总了Java中com.vaadin.ui.Button.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setIcon方法的具体用法?Java Button.setIcon怎么用?Java Button.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Button
的用法示例。
在下文中一共展示了Button.setIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SimplyAsAnImageOrIcon
import com.vaadin.ui.Button; //导入方法依赖的package包/类
public SimplyAsAnImageOrIcon() {
setCaption("Image and icon");
addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth());
Image image = new Image(null, new ClassResource("/pull.svg"));
image.setWidth("300px");
addComponent(image);
addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth());
Button button = new Button();
button.setIcon(new ClassResource("/vaadin-logo.svg"));
button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE);
addComponent(button);
}
示例2: enter
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
if (!isLoggedIn()) {
getUI().getNavigator().navigateTo(LoginView.VIEW_NAME);
return;
}
addComponent(new HeadingLabel("会員名簿", VaadinIcons.BULLETS));
printAllMembers();
Button homeButton = new Button("会員メニュー", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.USER);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例3: enter
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("ログアウト確認", VaadinIcons.INFO_CIRCLE));
addComponent(new Label("ログアウトします。"));
HorizontalLayout buttonArea = new HorizontalLayout();
buttonArea.setSpacing(true);
addComponent(buttonArea);
setComponentAlignment(buttonArea, Alignment.MIDDLE_CENTER);
Button cancelButton = new Button("キャンセル", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
buttonArea.addComponent(cancelButton);
Button logoutButton = new Button("ログアウト", click -> {
membershipService.logout();
getUI().getNavigator().navigateTo(FrontView.VIEW_NAME);
});
logoutButton.setIcon(VaadinIcons.SIGN_OUT);
logoutButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
buttonArea.addComponent(logoutButton);
}
示例4: enter
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("参加登録完了", VaadinIcons.CHECK));
addComponent(new Label("参加登録が完了し、確認メールを送信しました。"));
Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。");
addressLabel.setCaption("お願い");
addressLabel.setIcon(VaadinIcons.LIGHTBULB);
addComponent(addressLabel);
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.HOME);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例5: enter
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("パスワードリセット要求送信完了", VaadinIcons.INFO_CIRCLE));
addComponent(new Label("入力された E-mail アドレスへパスワードリセットの案内メールを送信しました。"));
Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。");
addressLabel.setCaption("お願い");
addressLabel.setIcon(VaadinIcons.LIGHTBULB);
addComponent(addressLabel);
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.HOME);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例6: createMenuButton
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {
final Button button = new Button(caption, (e) -> {
contentLayout.removeAllComponents();
contentLayout.addComponent(content.get());
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return button;
}
示例7: buildToolbarButton
import com.vaadin.ui.Button; //导入方法依赖的package包/类
/**
* @param toolbar
* HorizontalLayout which contains all the action Buttons
* @param toolbarButton
* Which Tool bar button to create (Provided using ENUM constant)
* @param listner
* Click listener called when this button is clicked
* @return
*/
public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
ClickListener listner) {
Button button = new Button(toolbarButton.getText());
button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
button.setDescription(toolbarButton.getTooltip());
button.setStyleName(ValoTheme.BUTTON_LINK);
if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
}
button.setEnabled(false);
button.setId(toolbarButton.getId());
button.addClickListener(listner);
toolbar.addComponent(button);
return button;
}
示例8: createHeader
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
populateTable();
}
});
header.addComponent(refresh);
return header;
}
示例9: createMenuButtonForNotification
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return button;
}
示例10: createHeader
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title, final boolean isChildTable) {
HorizontalLayout header = null;
if (isChildTable) {
header = ViewUtil.createSubHeader(title, getChildHelpGuid());
} else {
header = ViewUtil.createSubHeader(title, getParentHelpGuid());
}
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
if (isChildTable) {
populateChildTable(getParentItem());
} else {
populateParentTable();
}
}
});
header.addComponent(refresh);
return header;
}
示例11: createHeaderForSslList
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private HorizontalLayout createHeaderForSslList() {
HorizontalLayout header = ViewUtil.createSubHeader("List of available certificates", null);
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener((Button.ClickListener) event -> buildSslConfigurationTable());
header.addComponent(refresh);
return header;
}
示例12: createSubHeader
import com.vaadin.ui.Button; //导入方法依赖的package包/类
/**
* @param caption
* Caption Text Representing Header
* @param guid
* Help GUID for caller view
* @return
* Horizontal Layout containing Caption text and Help button
*/
public static HorizontalLayout createSubHeader(String caption, String guid) {
HorizontalLayout subHeader = new HorizontalLayout();
subHeader.setWidth("100%");
subHeader.setHeight("35px");
subHeader.setSpacing(true);
subHeader.addStyleName("toolbar");
final Label title = new Label(caption);
title.setSizeUndefined();
subHeader.addComponent(title);
subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
subHeader.setExpandRatio(title, 1);
// create help button if we have some GUID else do not add this button
if (guid != null) {
Button helpButton = new Button();
helpButton.setImmediate(true);
helpButton.setStyleName(Reindeer.BUTTON_LINK);
helpButton.setDescription("Help");
helpButton.setIcon(new ThemeResource("img/Help.png"));
subHeader.addComponent(helpButton);
helpButton.addClickListener(new HelpButtonListener(guid));
}
return subHeader;
}
示例13: addTab
import com.vaadin.ui.Button; //导入方法依赖的package包/类
public Button addTab(MaterialIcons icon, String text) {
Button button = new Button(text);
button.setPrimaryStyleName(lightTheme ? Styles.Tabs.IconText.LIGHT : Styles.Tabs.IconText.DARK);
button.setIcon(icon);
button.addClickListener(event -> selectTab(button));
buttons.add(button);
addComponent(button);
return button;
}
示例14: createMenuButtonForNotification
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Pair<String, Button> createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
getSubject().logout(); //removes all identifying information and invalidates their session too.
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return new Pair<>(mapToShiroRole(caption), button);
}
示例15: createMenuButton
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Pair<String, Button> createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {
final Button button = new Button(caption, (e) -> {
contentLayout.removeAllComponents();
contentLayout.addComponent(content.get());
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(this.getClass(), caption));
return new Pair<>(mapToShiroRole(caption), button);
}