本文整理匯總了Java中com.vaadin.ui.Button類的典型用法代碼示例。如果您正苦於以下問題:Java Button類的具體用法?Java Button怎麽用?Java Button使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Button類屬於com.vaadin.ui包,在下文中一共展示了Button類的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.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);
}
示例4: 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);
}
示例5: buildActions
import com.vaadin.ui.Button; //導入依賴的package包/類
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
actionsContainer.setSpacing(true);
// yes
final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
.caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE)
.messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build())
.onClick(e -> onDialogYesButtonClick(e.getButton())).build();
getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes)));
actionsContainer.addComponent(btnYes);
actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT);
if (getWidth() > -1) {
btnYes.setWidth("100%");
}
// no
final Button btnNo = Components.button()
.caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE)
.messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build())
.onClick(e -> onDialogNoButtonClick(e.getButton())).build();
getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo)));
actionsContainer.addComponent(btnNo);
actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT);
if (getWidth() > -1) {
btnNo.setWidth("100%");
}
}
示例6: refreshButtonBar
import com.vaadin.ui.Button; //導入依賴的package包/類
private void refreshButtonBar(Step step) {
buttonBar.removeAllComponents();
buttonBar.setVisible(true);
if (step == null) {
return;
}
Button backButton = step.getBackButton();
Button cancelButton = step.getCancelButton();
Button skipButton = step.getSkipButton();
Button nextButton = step.getNextButton();
backButton.setVisible(getStepIterator().hasPrevious());
cancelButton.setVisible(step.isCancellable());
skipButton.setVisible(step.isOptional());
nextButton.setVisible(!isComplete());
buttonBar.addComponent(backButton);
Spacer.addToLayout(buttonBar);
buttonBar.addComponent(cancelButton);
buttonBar.addComponent(skipButton);
buttonBar.addComponent(nextButton);
}
示例7: buttonClick
import com.vaadin.ui.Button; //導入依賴的package包/類
@Override
public void buttonClick(Button.ClickEvent event) {
final String alias = (String) event.getButton().getData();
log.info("Removing ssl entry with alias: " + alias);
boolean succeed;
DeleteSslEntryRequest deleteRequest = new DeleteSslEntryRequest(alias);
try {
SslConfigurationLayout.this.deleteSslCertificateService.dispatch(deleteRequest);
succeed = true;
} catch (Exception e) {
succeed = false;
log.error("Failed to remove SSL alias from truststore", e);
}
SslConfigurationLayout.this.buildSslConfigurationTable();
SslConfigurationLayout.this.deleteWindow.close();
String outputMessage = (succeed) ? MAINTENANCE_SSLCONFIGURATION_REMOVED : MAINTENANCE_SSLCONFIGURATION_REMOVE_FAILURE;
ViewUtil.iscNotification(getString(outputMessage, new Date()), null, Notification.Type.TRAY_NOTIFICATION);
}
示例8: 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);
}
示例9: createDownloadButton
import com.vaadin.ui.Button; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createDownloadButton() {
this.download = new Button(VmidcMessages.getString(VmidcMessages_.SUMMARY_DOWNLOAD_LOG)) {
@Override
public void setEnabled(boolean enabled) {
if (enabled) {
// because setEnabled(false) calls are ignored and button is disabled
// on client because of setDisableOnClick(true), by doing this we
// make sure that the button is actually disabled so that setEnabled(true)
// has effect
getUI().getConnectorTracker().getDiffState(this).put("enabled", false);
super.setEnabled(enabled);
}
}
};
SummaryLayout.this.download.setDisableOnClick(true);
if (this.checkbox != null && this.checkbox.getValue()) {
this.download.setCaption(VmidcMessages.getString(VmidcMessages_.SUMMARY_DOWNLOAD_BUNDLE));
}
StreamResource zipStream = getZipStream();
FileDownloader fileDownloader = new FileDownloader(zipStream);
fileDownloader.extend(this.download);
return this.download;
}
示例10: createIPSettingsEditButton
import com.vaadin.ui.Button; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createIPSettingsEditButton() {
// creating edit button
this.editIPSettings = new Button("Edit");
this.editIPSettings.setEnabled(true);
this.editIPSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
this.editIPSettings.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
editIPSettingsClicked();
} catch (Exception e) {
ViewUtil.showError("Error editing IP settings", e);
}
}
});
return this.editIPSettings;
}
示例11: createNATEditButton
import com.vaadin.ui.Button; //導入依賴的package包/類
@SuppressWarnings("serial")
private Button createNATEditButton() {
// creating edit button
this.editNATSettings = new Button("Edit");
this.editNATSettings.setEnabled(true);
this.editNATSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
this.editNATSettings.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
editNATSettingsClicked();
} catch (Exception e) {
ViewUtil.showError("Error editing NAT settings", e);
}
}
});
return this.editNATSettings;
}
示例12: 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("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;
}
示例13: 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;
}
示例14: selectToggleButton
import com.vaadin.ui.Button; //導入依賴的package包/類
public void selectToggleButton(Button button) {
if (!buttons.contains(button)) return;
if (this.mode == SelectionMode.SINGLE) {
for (Button b : buttons) {
b.removeStyleName(ACTIVE);
}
}
if (button.getStyleName().contains(ACTIVE)) {
button.removeStyleName(ACTIVE);
} else {
button.addStyleName(ACTIVE);
}
for (Button btn : buttons) {
if (btn.getStyleName().contains(ACTIVE)) {
addStyleName("card");
return;
}
removeStyleName("card");
}
}
示例15: 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);
}