本文整理汇总了Java中com.vaadin.ui.Button.addClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Button.addClickListener方法的具体用法?Java Button.addClickListener怎么用?Java Button.addClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Button
的用法示例。
在下文中一共展示了Button.addClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
CheckBoxGroup field = new CheckBoxGroup();
field.setCaption("Caption");
field.setDescription("Description");
Button action1 = new Button("Change Mode to Danger");
action1.setId("action1");
action1.addClickListener(event -> {
field.setMode(BootstrapMode.DANGER);
});
Button action2 = new Button("Remove Mode");
action2.setId("action2");
action2.addClickListener(event -> {
field.removeMode();
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例2: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
ComboBoxGroup<String> field = new ComboBoxGroup<>();
field.setCaption("Caption");
field.setDescription("Description");
field.getField().setItems("1", "2", "3");
Button action1 = new Button("add required");
action1.setId("action1");
action1.addClickListener(event -> {
field.setRequired(true);
});
Button action2 = new Button("remove Required");
action2.setId("action2");
action2.addClickListener(event -> {
field.setRequired(false);
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例3: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
CheckBoxMultiGroup<String> field = new CheckBoxMultiGroup<>();
field.setCaption("Caption");
field.setDescription("Description");
field.getField().setItems("1", "2", "3");
Button action1 = new Button("Change Mode to Danger");
action1.setId("action1");
action1.addClickListener(event -> {
field.setMode(BootstrapMode.DANGER);
});
Button action2 = new Button("Remove Mode");
action2.setId("action2");
action2.addClickListener(event -> {
field.removeMode();
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例4: updateItem
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void updateItem(Item item, PluginApi plugin) {
item.getItemProperty(PROP_PLUGIN_STATE).setValue(plugin.getState().toString());
item.getItemProperty(PROP_PLUGIN_NAME).setValue(plugin.getSymbolicName());
item.getItemProperty(PROP_PLUGIN_VERSION).setValue(plugin.getVersion());
item.getItemProperty(PROP_PLUGIN_SERVICES).setValue(plugin.getServiceCount());
String info;
if (plugin.getState() == State.ERROR) {
info = plugin.getError();
} else {
info = "";
}
item.getItemProperty(PROP_PLUGIN_INFO).setValue(info);
Button deleteButton = new Button("Delete");
deleteButton.addClickListener(event -> deletePlugin(plugin));
item.getItemProperty(PROP_PLUGIN_DELETE).setValue(deleteButton);
}
示例5: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
CheckBoxMultiGroup<String> field = new CheckBoxMultiGroup<>();
field.setCaption("Caption");
field.setDescription("Description");
field.getField().setItems("1", "2", "3");
Button action1 = new Button("add required");
action1.setId("action1");
action1.addClickListener(event -> {
field.setRequired(true);
});
Button action2 = new Button("remove Required");
action2.setId("action2");
action2.addClickListener(event -> {
field.setRequired(false);
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例6: init
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
final TextField name = new TextField();
name.setCaption("Type your name here:");
Button button = new Button("Click Me");
button.addClickListener(e -> {
layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
});
layout.addComponents(name, button);
setContent(layout);
}
示例7: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
NativeSelectGroup<String> field = new NativeSelectGroup<>();
field.setCaption("Caption");
field.setDescription("Description");
field.getField().setItems("1", "2", "3");
Button action1 = new Button("add required");
action1.setId("action1");
action1.addClickListener(event -> {
field.setRequired(true);
});
Button action2 = new Button("remove Required");
action2.setId("action2");
action2.addClickListener(event -> {
field.setRequired(false);
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例8: SimpleDialog
import com.vaadin.ui.Button; //导入方法依赖的package包/类
public SimpleDialog(String title, String message, boolean lightTheme) {
super(title);
addStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK);
label = new Label(message);
label.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.SECONDARY : Typography.Light.Subheader.SECONDARY);
label.addStyleName(Paddings.Horizontal.LARGE + " " + Paddings.Bottom.LARGE);
// Footer
cancel = new Button("Cancel");
cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
cancel.addClickListener(e -> close());
ok = new Button("OK");
ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
ok.addClickListener(e -> close());
footer = new FlexLayout(cancel, ok);
footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END);
footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0);
footer.setWidth(100, Unit.PERCENTAGE);
// Content wrapper
content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, label, footer);
setContent(content);
}
示例9: createNavigationButton
import com.vaadin.ui.Button; //导入方法依赖的package包/类
private Button createNavigationButton(String caption, final String viewName) {
Button button = new Button(caption);
button.addStyleName(ValoTheme.BUTTON_SMALL);
// If you didn't choose Java 8 when creating the project, convert this
// to an anonymous listener class
button.addClickListener(event -> getUI().getNavigator().navigateTo(viewName));
return button;
}
示例10: ScrollableDialog
import com.vaadin.ui.Button; //导入方法依赖的package包/类
public ScrollableDialog(String title, boolean lightTheme) {
super(title);
setPrimaryStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK);
addStyleName(Styles.Windows.SCROLLABLE);
scrollableLayout = new FlexLayout(FlexLayout.FlexDirection.COLUMN);
scrollableLayout.setOverflow(FlexLayout.Overflow.AUTO);
scrollableLayout.addStyleName(Paddings.Horizontal.LARGE);
scrollableLayout.addStyleName(FlexItem.FlexGrow.GROW_1);
// Footer
cancel = new Button("Cancel");
cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
cancel.addClickListener(e -> close());
ok = new Button("OK");
ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
ok.addClickListener(e -> close());
footer = new FlexLayout(cancel, ok);
footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END);
footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0);
footer.addStyleName(lightTheme ? Borders.Light.TOP : Borders.Dark.TOP);
footer.setWidth(100, Sizeable.Unit.PERCENTAGE);
// Content wrapper
content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, scrollableLayout, footer);
content.addStyleName(MaxHeights.MH_FULL);
setContent(content);
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: getTestComponent
import com.vaadin.ui.Button; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
TextFieldGroup field = new TextFieldGroup();
field.setCaption("Caption");
field.setDescription("Description");
Button action1 = new Button("Add ErrorMessage");
action1.setId("action1");
action1.addClickListener(event -> {
field.getField().setComponentError(new ErrorMessage() {
@Override
public ErrorLevel getErrorLevel() {
return ErrorLevel.ERROR;
}
@Override
public String getFormattedHtmlMessage() {
return "<strong>ERROR HERE</strong>";
}
});
});
Button action2 = new Button("Remove ErrorMessage");
action2.setId("action2");
action2.addClickListener(event -> {
field.getField().setComponentError(null);
});
MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
layout.addComponent(field, "field");
return layout;
}
示例15: addTab
import com.vaadin.ui.Button; //导入方法依赖的package包/类
public Button addTab(MaterialIcons icon) {
Button button = new Button();
button.setPrimaryStyleName(lightTheme ? Styles.Tabs.Icon.LIGHT : Styles.Tabs.Icon.DARK);
button.setIcon(icon);
button.addClickListener(event -> selectTab(button));
buttons.add(button);
addComponent(button);
return button;
}